Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F441621
PhabricatorRemarkupRuleMeme.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
847 B
Referenced Files
None
Subscribers
None
PhabricatorRemarkupRuleMeme.php
View Options
<?php
/**
* @group markup
*/
final
class
PhabricatorRemarkupRuleMeme
extends
PhutilRemarkupRule
{
private
$images
;
public
function
apply
(
$text
)
{
return
preg_replace_callback
(
'@{meme,((?:[^}
\\\\
]+|
\\\\
.)+)}$@m'
,
array
(
$this
,
'markupMeme'
),
$text
);
}
public
function
markupMeme
(
$matches
)
{
$options
=
array
(
'src'
=>
null
,
'above'
=>
null
,
'below'
=>
null
,
);
$parser
=
new
PhutilSimpleOptions
();
$options
=
$parser
->
parse
(
$matches
[
1
])
+
$options
;
$uri
=
id
(
new
PhutilURI
(
'/macro/meme/'
))
->
alter
(
'macro'
,
$options
[
'src'
])
->
alter
(
'uppertext'
,
$options
[
'above'
])
->
alter
(
'lowertext'
,
$options
[
'below'
]);
$img
=
phutil_tag
(
'img'
,
array
(
'src'
=>
(
string
)
$uri
,
));
return
$this
->
getEngine
()->
storeText
(
$img
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sun, May 4, 7:40 AM (2 d)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
64516
Default Alt Text
PhabricatorRemarkupRuleMeme.php (847 B)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment