CMS MADE SIMPLE FORGE

CMS Made Simple Core

 

[#12494] Add smarty filter trimwhitespace

avatar
Created By: Yuri Haperski (cmsms)
Date Submitted: 2021-11-08 04:08

Assigned To: Rolf (rolf1)
Resolution: None
State: Open
Summary:
Add smarty filter trimwhitespace
Detailed Description:
In the file lib/classes/internal/class.Smarty_CMS.php
add string 120:

 if ($config['trimwhitespace'])  $this->loadFilter('output', 'trimwhitespace');

Clear Cache.

History

Comments
avatar
Date: 2021-11-08 04:47
Posted By: Ruud van der Velden (ruudvdvelden)

Yuri  10:32
@velden Thank you, it is useful Smarty filter to shorten the output of html
code. This feature is not engaged now, but it is included. Why not to use it.

velden  10:42
What about the {strip}{/strip} tags in the places you want to use it?

Yuri  10:47
My version is simpler. And you can quickly switch of it for debug.
      
avatar
Date: 2021-11-09 19:13
Posted By: tom (tomphantoo)

Smarty already supports this:
/**
 * Smarty trimwhitespace outputfilter plugin
 * Trim unnecessary whitespace from HTML markup.
 *
 * @author Rodney Rehm
 *
 * @param string $source input string
 *
 * @return string filtered output
* @todo   substr_replace() is not overloaded by mbstring.func_overload - so
this function might fail!
 */
function smarty_outputfilter_trimwhitespace($source) ...

see https://www.smarty.net/docs/en/plugins.outputfilters.tpl

Otherwise, add trim() to the allowed PHP functions in the security policy class

      
Updates

Updated: 2021-11-08 04:47
resolution_id: => 5