Browse Source

Added a function for handling HTML special characters

Carlos 12 years ago
parent
commit
b47fc6476a
1 changed files with 13 additions and 0 deletions
  1. 13 0
      laravel/html.php

+ 13 - 0
laravel/html.php

@@ -45,6 +45,19 @@ class HTML {
 		return html_entity_decode($value, ENT_QUOTES, Config::get('application.encoding'));
 	}
 
+	/**
+	 * Convert HTML special characters.
+	 * 
+	 * The encoding specified in the application configuration file will be used.
+	 * 
+	 * @param  string $value
+	 * @return string
+	 */
+	public static function specialchars($value)
+	{
+		return htmlspecialchars($value, ENT_QUOTES, Config::get('application.encoding', false));
+	}
+
 	/**
 	 * Generate a link to a JavaScript file.
 	 *