From 6adfb585a43a5c8c2bfda90103d4d843e1dfc271 Mon Sep 17 00:00:00 2001 From: Albert Garcia Date: Wed, 12 Apr 2017 13:10:00 +0200 Subject: [PATCH] Fix Smarty modifier time_since using $this out of scope --- .../modifier.time_since.php | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/src/Smarty-sifo-plugins/modifier.time_since.php b/src/Smarty-sifo-plugins/modifier.time_since.php index 6c65cc46..3b1ebceb 100644 --- a/src/Smarty-sifo-plugins/modifier.time_since.php +++ b/src/Smarty-sifo-plugins/modifier.time_since.php @@ -78,21 +78,7 @@ function smarty_modifier_time_since( $diff_time ) $value[1] = \Sifo\I18N::getTranslation("just some seconds"); } - $value[1] = smarty_block_t( array( 'count' => $value[0] ), $value[1], $this, null ); + $final_string = ($value > 0) ? $value[0] .' ' . $value[1] : $value[1]; - if ( $value[0] > 0 ) - { - $params[1] = $value[0] . ' '. $value[1]; - } - else - { - $params[1] = $value[1]; - } - - return smarty_block_t( $params, \Sifo\I18N::getTranslation( '%1 ago' ), $this, null ); -; + return \Sifo\I18N::getTranslation('%1 ago', ['%1' => $final_string]); } - -/* vim: set expandtab: */ - -?>