Commit e4fc78c3 authored by Benoit Mortier's avatar Benoit Mortier
Browse files

Fixes: #586 FSF address incorrect in source code and documentation files

Showing with 62 additions and 62 deletions
+62 -62
...@@ -15,15 +15,15 @@ ...@@ -15,15 +15,15 @@
* * * *
* You should have received a copy of the GNU Lesser General Public * * You should have received a copy of the GNU Lesser General Public *
* License along with this library; if not, write to the Free Software * * License along with this library; if not, write to the Free Software *
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA *
* ------------------------------------------------------------------------- * * ------------------------------------------------------------------------- *
* *
* Installation: simply copy this file to the smarty plugins directory. * Installation: simply copy this file to the smarty plugins directory.
* *
* @package smarty-gettext * @package smarty-gettext
* @version $Id: block.t.php,v 1.1 2005/07/27 17:58:56 sagi Exp $ * @version $Id: block.t.php,v 1.1 2005/07/27 17:58:56 sagi Exp $
* @link http://smarty-gettext.sourceforge.net/ * @link http://smarty-gettext.sourceforge.net/
* @author Sagi Bashari <sagi@boom.org.il> * @author Sagi Bashari <sagi@boom.org.il>
* @copyright 2004-2005 Sagi Bashari * @copyright 2004-2005 Sagi Bashari
*/ */
...@@ -31,28 +31,28 @@ ...@@ -31,28 +31,28 @@
* Replaces arguments in a string with their values. * Replaces arguments in a string with their values.
* Arguments are represented by % followed by their number. * Arguments are represented by % followed by their number.
* *
* @param string Source string * @param string Source string
* @param mixed Arguments, can be passed in an array or through single variables. * @param mixed Arguments, can be passed in an array or through single variables.
* @returns string Modified string * @returns string Modified string
*/ */
function smarty_gettext_strarg($str) function smarty_gettext_strarg($str)
{ {
$tr = array(); $tr = array();
$p = 0; $p = 0;
for ($i=1; $i < func_num_args(); $i++) { for ($i=1; $i < func_num_args(); $i++) {
$arg = func_get_arg($i); $arg = func_get_arg($i);
if (is_array($arg)) { if (is_array($arg)) {
foreach ($arg as $aarg) { foreach ($arg as $aarg) {
$tr['%'.++$p] = $aarg; $tr['%'.++$p] = $aarg;
} }
} else { } else {
$tr['%'.++$p] = $arg; $tr['%'.++$p] = $arg;
} }
} }
return strtr($str, $tr); return strtr($str, $tr);
} }
/** /**
...@@ -75,55 +75,55 @@ function smarty_block_t($params, $text, &$smarty) ...@@ -75,55 +75,55 @@ function smarty_block_t($params, $text, &$smarty)
if($text === NULL) { if($text === NULL) {
return; return;
} }
$text = stripslashes($text); $text = stripslashes($text);
// set escape mode // set escape mode
if (isset($params['escape'])) { if (isset($params['escape'])) {
$escape = $params['escape']; $escape = $params['escape'];
unset($params['escape']); unset($params['escape']);
} }
// set plural version // set plural version
if (isset($params['plural'])) { if (isset($params['plural'])) {
$plural = $params['plural']; $plural = $params['plural'];
unset($params['plural']); unset($params['plural']);
// set count // set count
if (isset($params['count'])) { if (isset($params['count'])) {
$count = $params['count']; $count = $params['count'];
unset($params['count']); unset($params['count']);
} }
} }
// use plural if required parameters are set // use plural if required parameters are set
if (isset($count) && isset($plural)) { if (isset($count) && isset($plural)) {
$text = ngettext($text, $plural, $count); $text = ngettext($text, $plural, $count);
} else { // use normal } else { // use normal
$text = gettext($text); $text = gettext($text);
} }
// run strarg if there are parameters // run strarg if there are parameters
if (count($params)) { if (count($params)) {
$text = smarty_gettext_strarg($text, $params); $text = smarty_gettext_strarg($text, $params);
} }
if (!isset($escape) || $escape == 'html') { // html escape, default if (!isset($escape) || $escape == 'html') { // html escape, default
$text = nl2br(htmlspecialchars($text)); $text = nl2br(htmlspecialchars($text));
} elseif (isset($escape)) { } elseif (isset($escape)) {
switch ($escape) { switch ($escape) {
case 'javascript': case 'javascript':
case 'js': case 'js':
// javascript escape // javascript escape
$text = str_replace('\'', '\\\'', stripslashes($text)); $text = str_replace('\'', '\\\'', stripslashes($text));
break; break;
case 'url': case 'url':
// url escape // url escape
$text = urlencode($text); $text = urlencode($text);
break; break;
} }
} }
return $text; return $text;
} }
?> ?>
  • bmortier @bmortier

    mentioned in issue #219

    By obonhomme on 2017-09-02T14:40:30 (imported from GitLab)

    ·

    mentioned in issue #219

    By obonhomme on 2017-09-02T14:40:30 (imported from GitLab)

    Toggle commit list
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment