File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11# (MODX)EvolutionCMS.snippets.ddStringTools changelog
22
33
4+ ## Version 1.5.1 (2020-05-07)
5+ * \* Snippet: A tool will not be applied to an empty string.
6+
7+
48## Version 1.5 (2020-05-07)
59* \* Attention! (MODX)EvolutionCMS.libraries.ddTools >= 0.35 is required.
610* \* The new snippet structure (see README):
Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ Tools for modifying strings.
2121#### 1. Elements → Snippets: Create a new snippet with the following data
2222
23231 . Snippet name: ` ddStringTools ` .
24- 2 . Description: ` <b>1.5</b> Tools for modifying strings. ` .
24+ 2 . Description: ` <b>1.5.1 </b> Tools for modifying strings. ` .
25253 . Category: ` Core ` .
26264 . Parse DocBlock: ` no ` .
27275 . Snippet code (php): Insert content of the ` ddStringTools_snippet.php ` file from the archive.
@@ -208,7 +208,8 @@ Tools for modifying strings.
208208#### Tpl parser
209209
210210* ` tools->tplParser `
211- * Desctription: Gets the chunk contents by its name and parse it.
211+ * Desctription: Gets the chunk contents by its name and parse it.
212+ If `inputString` is empty, the chunk content will not be returned, just an empty string.
212213 * Valid values: `object`
213214 * Default value: —
214215
Original file line number Diff line number Diff line change 11{
22 "name" : " dd/evolutioncms-snippets-ddstringtools" ,
33 "type" : " modxevo-snippet" ,
4- "version" : " 1.5.0 " ,
4+ "version" : " 1.5.1 " ,
55 "description" : " Tools for modifying strings." ,
66 "keywords" : [
77 " modx" ,
Original file line number Diff line number Diff line change 11<?php
22/**
33 * ddStringTools
4- * @version 1.5 (2020-05-07)
4+ * @version 1.5.1 (2020-05-07)
55 *
66 * @see README.md
77 *
134134 $ toolName =>
135135 $ toolParams
136136){
137- $ toolObject = \ddStringTools \Tool \Tool::createChildInstance ([
138- 'name ' => $ toolName ,
139- 'parentDir ' => $ snippetPath_src_tool ,
140- //Passing parameters into constructor
141- 'params ' => $ toolParams
142- ]);
143-
144- $ inputString = $ toolObject ->modify ($ inputString );
137+ //Senselessly to process empty strings. We need to check this on each cycle iteration because string can become empty after one of iterations.
138+ if ($ inputString != '' ){
139+ $ toolObject = \ddStringTools \Tool \Tool::createChildInstance ([
140+ 'name ' => $ toolName ,
141+ 'parentDir ' => $ snippetPath_src_tool ,
142+ //Passing parameters into constructor
143+ 'params ' => $ toolParams
144+ ]);
145+
146+ $ inputString = $ toolObject ->modify ($ inputString );
147+ }
145148}
146149
147150return $ inputString ;
You can’t perform that action at this time.
0 commit comments