Adding ansi-to-html

This commit is contained in:
Adam Backstrom 2014-05-13 14:17:41 -04:00
parent 1909871e55
commit d3917a1c24
3 changed files with 19 additions and 1 deletions

View File

@ -1,6 +1,7 @@
<?php <?php
use \Ospinto\Dbug; use \Ospinto\Dbug;
use \SensioLabs\AnsiConverter\AnsiToHtmlConverter;
abstract class AbstractAction abstract class AbstractAction
{ {
@ -202,6 +203,21 @@ class ActionDateC extends AbstractAction
} }
} }
class ActionAnsi2Html extends AbstractAction
{
public function setUp()
{
$this->setContainer( new DivContainer );
$this->setFormatter( new EchoFormatter );
}
public function decode()
{
$converter = new AnsiToHtmlConverter();
return htmlentities(nl2br($converter->convert($this->value)));
}
}
class ActionParseStr extends AbstractAction class ActionParseStr extends AbstractAction
{ {
public function setUp() public function setUp()

View File

@ -1,5 +1,6 @@
{ {
"require": { "require": {
"sunra/dbug": "dev-master" "sunra/dbug": "dev-master",
"sensiolabs/ansi-to-html": "dev-master"
} }
} }

View File

@ -47,6 +47,7 @@ if( 'POST' === $_SERVER['REQUEST_METHOD'] ) {
<option value="JsonEncode" <?php echo selected($action_str, 'JsonEncode'); ?>>json_encode()</option> <option value="JsonEncode" <?php echo selected($action_str, 'JsonEncode'); ?>>json_encode()</option>
<option value="DateC" <?php echo selected($action_str, 'DateC'); ?>>date('c', $timestamp)</option> <option value="DateC" <?php echo selected($action_str, 'DateC'); ?>>date('c', $timestamp)</option>
<option value="ParseStr" <?php echo selected($action_str, 'ParseStr'); ?>>parse_str()</option> <option value="ParseStr" <?php echo selected($action_str, 'ParseStr'); ?>>parse_str()</option>
<option value="Ansi2Html" <?php echo selected($action_str, 'Ansi2HTml'); ?>>ansi-to-html</option>
<select> <select>
<input type="submit"> <input type="submit">
</form> </form>