Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Html entities Filter

Implemented filter to leverage html entities, closes #9.
  • Loading branch information...
commit 6b77d45b2d97507d7e5ed2fc5ab8ff3ba1f81428 1 parent cb3970d
@rdohms authored
Showing with 43 additions and 0 deletions.
  1. +43 −0 Rules/HtmlEntities.php
View
43 Rules/HtmlEntities.php
@@ -0,0 +1,43 @@
+<?php
+namespace DMS\Filter\Rules;
+
+/**
+ * Html Entities Filter
+ *
+ * @package DMS
+ * @subpackage Filter
+ *
+ * @Annotation
+ */
+class HtmlEntities extends Rule
+{
+ /**
+ * Flags
+ *
+ * @var int
+ */
+ public $flags = ENT_COMPAT;
+
+ /**
+ * Encoding to be used
+ *
+ * @var string
+ */
+ public $encoding = 'UTF-8';
+
+ /**
+ * Convert existing entities
+ *
+ * @var bool
+ */
+ public $doubleEncode = true;
+
+ /**
+ * {@inheritDoc}
+ */
+ public function applyFilter($value)
+ {
+ return htmlentities($value, $this->flags, $this->encoding, $this->doubleEncode);
+ }
+
+}
Please sign in to comment.
Something went wrong with that request. Please try again.