Page Menu
Home
GnuPG
Search
Configure Global Search
Log In
Files
F32914110
PhabricatorRemarkupFigletBlockInterpreter.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Size
1 KB
Subscribers
None
PhabricatorRemarkupFigletBlockInterpreter.php
View Options
<?php
final
class
PhabricatorRemarkupFigletBlockInterpreter
extends
PhutilRemarkupBlockInterpreter
{
public
function
getInterpreterName
()
{
return
'figlet'
;
}
public
function
markupContent
(
$content
,
array
$argv
)
{
if
(!
Filesystem
::
binaryExists
(
'figlet'
))
{
return
$this
->
markupError
(
pht
(
'Unable to locate the `%s` binary. Install figlet.'
,
'figlet'
));
}
$font
=
idx
(
$argv
,
'font'
,
'standard'
);
$safe_font
=
preg_replace
(
'/[^0-9a-zA-Z-_.]/'
,
''
,
$font
);
$future
=
id
(
new
ExecFuture
(
'figlet -f %s'
,
$safe_font
))
->
setTimeout
(
15
)
->
write
(
trim
(
$content
,
"
\n
"
));
list
(
$err
,
$stdout
,
$stderr
)
=
$future
->
resolve
();
if
(
$err
)
{
return
$this
->
markupError
(
pht
(
'Execution of `%s` failed: %s'
,
'figlet'
,
$stderr
));
}
if
(
$this
->
getEngine
()->
isTextMode
())
{
return
$stdout
;
}
return
phutil_tag
(
'div'
,
array
(
'class'
=>
'PhabricatorMonospaced remarkup-figlet'
,
),
$stdout
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Mon, Nov 17, 9:23 PM (6 h, 47 m)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
e0/9e/6394d8646e5350fa7fab59ade510
Attached To
rPHAB Phabricator
Event Timeline
Log In to Comment