1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
wiki.php
См. документацию.
1
<?php
2
3
namespace
Bitrix\Socialnetwork\Livefeed;
4
5
use Bitrix\Main\Config\Option;
6
use Bitrix\Main\Loader;
7
use Bitrix\Main\Localization\Loc;
8
use Bitrix\Socialnetwork\LogTable;
9
10
final
class
Wiki
extends
Provider
11
{
12
public
const
PROVIDER_ID
=
'WIKI'
;
13
public
const
CONTENT_TYPE_ID
=
'WIKI'
;
14
15
protected
static
$wikiClass
= \CWiki::class;
16
protected
static
$logTableClass
= LogTable::class;
17
18
public
static
function
getId
(): string
19
{
20
return
static::PROVIDER_ID;
21
}
22
23
public
function
getEventId
():
array
24
{
25
return
[
'wiki'
,
'wiki_del'
];
26
}
27
28
public
function
getType
(): string
29
{
30
return
Provider::TYPE_POST
;
31
}
32
33
public
function
getCommentProvider
(): Provider
34
{
35
return
new
ForumPost
();
36
}
37
38
public
function
initSourceFields
()
39
{
40
static
$wikiParser =
false
;
41
static
$cache = [];
42
43
$elementId =
$this->entityId
;
44
45
if
($elementId <= 0)
46
{
47
return
;
48
}
49
50
$sourceFields
= [];
51
52
if
(isset($cache[$elementId]))
53
{
54
$sourceFields
= $cache[$elementId];
55
}
56
elseif
(Loader::includeModule(
'wiki'
))
57
{
58
$res
= self::$logTableClass::getList([
59
'filter'
=> [
60
'SOURCE_ID'
=> $elementId,
61
'@EVENT_ID'
=> $this->
getEventId
(),
62
],
63
'select'
=> [
'ID'
,
'URL'
,
'TITLE'
]
64
]);
65
if
($logEntryFields =
$res
->fetch())
66
{
67
$sourceFields
= [
68
'LOG_ID'
=> $logEntryFields[
'ID'
],
69
'URL'
=> $logEntryFields[
'URL'
]
70
];
71
72
$element = self::$wikiClass::getElementById($elementId, [
73
'CHECK_PERMISSIONS'
=>
'N'
,
74
'ACTIVE'
=>
'Y'
75
]);
76
77
if
($element)
78
{
79
$sourceFields
= array_merge($element,
$sourceFields
);
80
}
81
else
82
{
83
$sourceFields
[
'~NAME'
] =
htmlspecialcharsback
($logEntryFields[
'TITLE'
]);
84
}
85
}
86
87
$cache[$elementId] =
$sourceFields
;
88
}
89
90
$this->
setLogId
(
$sourceFields
[
'LOG_ID'
]);
91
$this->
setSourceFields
(
$sourceFields
);
92
93
$this->
setSourceTitle
(
$sourceFields
[
'NAME'
]);
94
if
(!$wikiParser)
95
{
96
$wikiParser = new \CWikiParser();
97
}
98
$this->
setSourceDescription
(\
CTextParser::clearAllTags
(\CWikiParser::clear($wikiParser->parse(
$sourceFields
[
'DETAIL_TEXT'
],
$sourceFields
[
'DETAIL_TEXT_TYPE'
], []))));
99
}
100
101
public
function
getPinnedTitle
(): string
102
{
103
if
(empty($this->sourceFields))
104
{
105
$this->
initSourceFields
();
106
}
107
108
$sourceFields
= $this->
getSourceFields
();
109
110
return
(
111
!empty(
$sourceFields
[
'ID'
])
112
? Loc::getMessage(
'SONET_LIVEFEED_WIKI_PINNED_TITLE'
, [
113
'#TITLE#'
=>
$sourceFields
[
'~NAME'
]
114
])
115
: Loc::getMessage(
'SONET_LIVEFEED_WIKI_DELETED_PINNED_TITLE'
, [
116
'#TITLE#'
=>
$sourceFields
[
'~NAME'
]
117
])
118
);
119
}
120
121
public
static
function
canRead
(
$params
): bool
122
{
123
return
true
;
124
}
125
126
protected
function
getPermissions
(
array
$post
): string
127
{
128
return
self::PERMISSION_READ;
129
}
130
131
public
function
getLiveFeedUrl
(): string
132
{
133
$pathToWikiArticle =
''
;
134
135
if
(
136
(
$message
= $this->
getSourceFields
())
137
&& !empty(
$message
)
138
)
139
{
140
$pathToWikiArticle = str_replace(
141
"#GROUPS_PATH#"
,
142
Option::get(
'socialnetwork'
,
'workgroups_page'
,
'/workgroups/'
, $this->
getSiteId
()),
143
$message
[
'URL'
]
144
);
145
}
146
147
return
$pathToWikiArticle;
148
}
149
}
Bitrix\Socialnetwork\Livefeed\ForumPost
Определения
forumpost.php:22
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\getSiteId
getSiteId()
Определения
provider.php:97
Bitrix\Socialnetwork\Livefeed\Provider\$sourceFields
$sourceFields
Определения
provider.php:56
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\Wiki
Определения
wiki.php:11
Bitrix\Socialnetwork\Livefeed\Wiki\initSourceFields
initSourceFields()
Определения
wiki.php:38
Bitrix\Socialnetwork\Livefeed\Wiki\getCommentProvider
getCommentProvider()
Определения
wiki.php:33
Bitrix\Socialnetwork\Livefeed\Wiki\CONTENT_TYPE_ID
const CONTENT_TYPE_ID
Определения
wiki.php:13
Bitrix\Socialnetwork\Livefeed\Wiki\getPinnedTitle
getPinnedTitle()
Определения
wiki.php:101
Bitrix\Socialnetwork\Livefeed\Wiki\getPermissions
getPermissions(array $post)
Определения
wiki.php:126
Bitrix\Socialnetwork\Livefeed\Wiki\$wikiClass
static $wikiClass
Определения
wiki.php:15
Bitrix\Socialnetwork\Livefeed\Wiki\getType
getType()
Определения
wiki.php:28
Bitrix\Socialnetwork\Livefeed\Wiki\getLiveFeedUrl
getLiveFeedUrl()
Определения
wiki.php:131
Bitrix\Socialnetwork\Livefeed\Wiki\getEventId
getEventId()
Определения
wiki.php:23
Bitrix\Socialnetwork\Livefeed\Wiki\canRead
static canRead($params)
Определения
wiki.php:121
Bitrix\Socialnetwork\Livefeed\Wiki\getId
static getId()
Определения
wiki.php:18
Bitrix\Socialnetwork\Livefeed\Wiki\PROVIDER_ID
const PROVIDER_ID
Определения
wiki.php:12
Bitrix\Socialnetwork\Livefeed\Wiki\$logTableClass
static $logTableClass
Определения
wiki.php:16
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
htmlspecialcharsback
htmlspecialcharsback($str)
Определения
tools.php:2693
$message
$message
Определения
payment.php:8
elseif
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
Определения
prolog_main_admin.php:393
$params
if($inWords) echo htmlspecialcharsbx(Number2Word_Rus(roundEx($totalVatSum $params['CURRENCY']
Определения
template.php:799
$post
$post
Определения
template.php:8
bitrix
modules
socialnetwork
lib
livefeed
wiki.php
Создано системой
1.14.0