Skip to content

Commit bdee9a1

Browse files
committed
Version 1.5.1
2 parents bd6b223 + e2c10b0 commit bdee9a1

4 files changed

Lines changed: 20 additions & 12 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
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):

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Tools for modifying strings.
2121
#### 1. Elements → Snippets: Create a new snippet with the following data
2222

2323
1. 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.`.
2525
3. Category: `Core`.
2626
4. Parse DocBlock: `no`.
2727
5. 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

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
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",

ddStringTools_snippet.php

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
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
*
@@ -134,14 +134,17 @@
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

147150
return $inputString;

0 commit comments

Comments
 (0)