pluf2

pluf2 Commit Details


Date:2009-01-27 07:50:05 (15 years 10 months ago)
Author:Loic d'Anterroches
Branch:master
Commit:138931df6fbf7ea438dcea7133a92230da595104
Parents: 929b87663dd612e295105c2516bcd2364cf51872
Message:Changed the way to escape to accomodate multiple input encodings.

Changes:

File differences

src/Pluf.php
359359
360360
361361
362
362
363363
364
365
364
365
366
367
368
369
366370
367371
368372
369
373
374
375
370376
/**
* Shortcut to avoid typing again and again this htmlspecialchars call.
* Shortcut needed all over the place.
*
* @param string Raw string.
* @return string HTML escaped string.
* Note that in some cases, we need to escape strings not in UTF-8, so
* this is not possible to safely use a call to htmlspecialchars. This
* is why str_replace is used.
*
* @param string Raw string
* @return string HTML escaped string
*/
function Pluf_esc($string)
{
return htmlspecialchars((string)$string, ENT_COMPAT, 'UTF-8');
return str_replace(array('&', '"', '<', '>'),
array('&amp;', '&quot;', '&lt;', '&gt;'),
(string) $string);
}

Archive Download the corresponding diff file

Branches

Number of commits:
Page rendered in 0.05495s using 13 queries.