Browse Source

Adding ansi-to-html

master
Adam Backstrom 8 years ago
parent
commit
d3917a1c24
  1. 16
      classes.php
  2. 3
      composer.json
  3. 1
      index.php

16
classes.php

@ -1,6 +1,7 @@
<?php
use \Ospinto\Dbug;
use \SensioLabs\AnsiConverter\AnsiToHtmlConverter;
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
{
public function setUp()

3
composer.json

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

1
index.php

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

Loading…
Cancel
Save