smarty-gettext / smarty-gettext

Gettext plugin enabling internationalization in Smarty Package files. Smarty-gettext is a module that provides gettext support to Smarty, the popular PHP template engine.
GNU Lesser General Public License v2.1
72 stars 27 forks source link

small improvements to the switch statement #34

Open shoulders opened 4 years ago

shoulders commented 4 years ago

I would like to see the following small improvements to the switch statement in block.t.php:

    switch ($escape) {
    case 'html':
        // This is the default case (set above)
        $text = nl2br(htmlspecialchars($text));
        break;
    case 'javascript':
    case 'js':
        // javascript escape
        $text = strtr($text, array('\\' => '\\\\', "'" => "\\'", '"' => '\\"', "\r" => '\\r', "\n" => '\\n', '</' => '<\/'));
        break;
    case 'url':
        // url escape
        $text = urlencode($text);
        break;
    case 'no':
        // no escaping
        break;
    }
glensc commented 4 years ago

You are welcome to send PR with the change.

shoulders commented 4 years ago

will do

note for me i might add a the default case in:

case: no
default: