From a58513cb59ab2a744db6f0d8fa2b81cbb6a38ec4 Mon Sep 17 00:00:00 2001 From: Adam Backstrom Date: Tue, 21 Aug 2012 21:37:36 -0400 Subject: [PATCH] Escape output. New ActionDoubleEntityDecode. --- classes.php | 17 ++++++++++++++++- index.php | 16 +++++++++------- 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/classes.php b/classes.php index 1c2312c..39959c3 100644 --- a/classes.php +++ b/classes.php @@ -68,6 +68,21 @@ class ActionBase64Encode extends AbstractAction } } +class ActionDoubleEntityDecode extends AbstractAction +{ + public function __construct( $value ) + { + parent::__construct( $value ); + $this->setContainer( new TextareaContainer ); + $this->setFormatter( new EchoFormatter ); + } + + public function decode() + { + return html_entity_decode( html_entity_decode( $this->value, ENT_QUOTES, 'UTF-8' ), ENT_QUOTES, 'UTF-8' ); + } +} + class ActionBase64Decode extends AbstractAction { public function __construct( $value ) @@ -145,7 +160,7 @@ class TextareaContainer extends DivContainer { public function wrap( $contents ) { - return parent::wrap( '' ); + return parent::wrap( '' ); } } diff --git a/index.php b/index.php index 402f144..d3cc094 100644 --- a/index.php +++ b/index.php @@ -20,9 +20,10 @@ require_once 'functions.php';