Skip to content

Commit

Permalink
Fix Smarty modifier time_since using $this out of scope
Browse files Browse the repository at this point in the history
  • Loading branch information
Albert Garcia committed Apr 12, 2017
1 parent 9a6177c commit 6adfb58
Showing 1 changed file with 2 additions and 16 deletions.
18 changes: 2 additions & 16 deletions src/Smarty-sifo-plugins/modifier.time_since.php
Original file line number Diff line number Diff line change
Expand Up @@ -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: */

?>

0 comments on commit 6adfb58

Please sign in to comment.