Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F5992889
EchoPlainTextEmailFormatter.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
EchoPlainTextEmailFormatter.php
View Options
<?php
namespace
MediaWiki\Extension\Notifications\Formatters
;
use
MediaWiki\Parser\Sanitizer
;
use
MediaWiki\SpecialPage\SpecialPage
;
class
EchoPlainTextEmailFormatter
extends
EchoEventFormatter
{
protected
function
formatModel
(
EchoEventPresentationModel
$model
)
{
$subject
=
Sanitizer
::
stripAllTags
(
$model
->
getSubjectMessage
()->
parse
()
);
$text
=
Sanitizer
::
stripAllTags
(
$model
->
getHeaderMessage
()->
parse
()
);
$text
.=
"
\n\n
"
;
$bodyMsg
=
$model
->
getBodyMessage
();
if
(
$bodyMsg
)
{
$text
.=
Sanitizer
::
stripAllTags
(
$bodyMsg
->
parse
()
);
}
$primaryLink
=
$model
->
getPrimaryLinkWithMarkAsRead
();
$colon
=
$this
->
msg
(
'colon-separator'
)->
text
();
if
(
$primaryLink
)
{
$primaryUrl
=
wfExpandUrl
(
$primaryLink
[
'url'
],
PROTO_CANONICAL
);
$text
.=
"
\n\n
{$primaryLink['label']}$colon <$primaryUrl>"
;
}
foreach
(
array_filter
(
$model
->
getSecondaryLinks
()
)
as
$secondaryLink
)
{
$url
=
wfExpandUrl
(
$secondaryLink
[
'url'
],
PROTO_CANONICAL
);
$text
.=
"
\n\n
{$secondaryLink['label']}$colon <$url>"
;
}
// Footer
$text
.=
"
\n\n
{$this->getFooter()}"
;
return
[
'body'
=>
$text
,
'subject'
=>
$subject
,
];
}
/**
* @return string
*/
public
function
getFooter
()
{
global
$wgEchoEmailFooterAddress
;
$footerMsg
=
$this
->
msg
(
'echo-email-plain-footer'
,
$this
->
user
)->
text
();
$prefsUrl
=
SpecialPage
::
getTitleFor
(
'Preferences'
,
false
,
'mw-prefsection-echo'
)
->
getFullURL
(
''
,
false
,
PROTO_CANONICAL
);
$text
=
"--
\n\n
$footerMsg
\n
$prefsUrl"
;
if
(
$wgEchoEmailFooterAddress
!==
''
)
{
$text
.=
"
\n\n
$wgEchoEmailFooterAddress"
;
}
return
$text
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Oct 4 2026, 02:30 (4 w, 6 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
5f/4f/887df68c26028a71b71973f1e1ad
Default Alt Text
EchoPlainTextEmailFormatter.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment