2010-04-30 Miguel de Dios <miguel.dedios@artica.es>

* include/functions_io.php: added in the function "safe_output" the flag
	$utf8 for set the encoding of output, by default true.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2643 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2010-04-30 10:35:20 +00:00
parent 4f22c5b6d9
commit df0bc48f85
2 changed files with 14 additions and 3 deletions

View File

@ -1,3 +1,8 @@
2010-04-30 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_io.php: added in the function "safe_output" the flag
$utf8 for set the encoding of output, by default true.
2010-04-29 Miguel de Dios <miguel.dedios@artica.es> 2010-04-29 Miguel de Dios <miguel.dedios@artica.es>
* godmode/reporting/reporting_builder.item_editor.php: fixed typo mistake in * godmode/reporting/reporting_builder.item_editor.php: fixed typo mistake in

View File

@ -43,10 +43,11 @@ function safe_input($value) {
* who doesn't make the HTML render by itself. * who doesn't make the HTML render by itself.
* *
* @param mixed String or array of strings to be cleaned. * @param mixed String or array of strings to be cleaned.
* @param boolean $utf8 Flag, set the output encoding in utf8, by default true.
* *
* @return unknown_type * @return unknown_type
*/ */
function safe_output($value) function safe_output($value, $utf8 = true)
{ {
if (is_numeric($value)) if (is_numeric($value))
return $value; return $value;
@ -59,7 +60,12 @@ function safe_output($value)
if (! mb_check_encoding ($value, 'UTF-8')) if (! mb_check_encoding ($value, 'UTF-8'))
$value = utf8_encode ($value); $value = utf8_encode ($value);
$valueHtmlEncode = html_entity_decode ($value, ENT_QUOTES, "UTF-8"); if ($utf8) {
$valueHtmlEncode = html_entity_decode ($value, ENT_QUOTES, "UTF-8");
}
else {
$valueHtmlEncode = html_entity_decode ($value, ENT_QUOTES);
}
return $valueHtmlEncode; return $valueHtmlEncode;
} }