Skip to content

Commit a8f13e0

Browse files
committed
Version 1.6
2 parents f7e0027 + 91ce196 commit a8f13e0

5 files changed

Lines changed: 264 additions & 16 deletions

File tree

CHANGELOG.md

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,26 @@
11
# (MODX)EvolutionCMS.snippets.ddStringTools changelog
22

33

4+
## Version 1.6 (2020-06-03)
5+
* \* Attention! (MODX)EvolutionCMS.libraries.ddTools >= 0.38.1 is required.
6+
* \+ Parameters → `inputString`: Can also be set as a PHP object or array (e. g. for calls through `$modx->runSnippet`). In this case, it will be converted to JSON first.
7+
* \* Small refactoring.
8+
* \+ README:
9+
* \+ Documentation → Examples → Call through `$modx->runSnippet`.
10+
* \- Home page.
11+
* \+ Links.
12+
* \+ CHANGELOG: Style and text improvements.
13+
* \+ CHANGELOG_ru.
14+
* \* Composer.json:
15+
* \+ `homepage`.
16+
* \+ `authors`.
17+
* \* `require`:
18+
* \* `dd/evolutioncms-libraries-ddtools`: Renamed from `dd/modxevo-library-ddtools`.
19+
* \* `dd/evolutioncms-snippets-ddtypograph`: Renamed from `dd/modxevo-snippet-ddtypograph`.
20+
21+
422
## Version 1.5.2 (2020-05-07)
5-
* \* `tools->charEscaper->lineBreaks`: Line breaks will be replaced to `\r\n` instead of space.
23+
* \* Parameters → `tools->charEscaper->lineBreaks`: Line breaks will be replaced to `\r\n` instead of space.
624
* \* Small refactoring.
725

826

@@ -64,12 +82,12 @@
6482
* \* README:
6583
* \* Style changes.
6684
* \* Documentation → Parameters description: Small order changes.
67-
* \+ Composer.json → Require.
85+
* \+ Composer.json → `require`.
6886

6987

7088
## Version 1.3 (2019-10-20)
71-
* \* Attention! EvolutionCMS.libraries.ddTools >= 0.27 is required (because not tested in older versions).
72-
* \* Attention! EvolutionCMS.snippets.ddTypograph >= 2.4 is required if the `typography` parameter is used.
89+
* \* Attention! (MODX)EvolutionCMS.libraries.ddTools >= 0.27 is required (because not tested in older versions).
90+
* \* Attention! (MODX)EvolutionCMS.snippets.ddTypograph >= 2.4 is required if the `typography` parameter is used.
7391
* \+ Added the ability to text typography (see the `typography` parameter).
7492
* \+ README → Documentation:
7593
* \+ Installation instructions.
@@ -79,19 +97,20 @@
7997

8098

8199
## Version 1.2 (2019-08-09)
82-
* \+ Added an ability to parse Markdown (see the `parseMarkdown` parameter).
100+
* \+ Added the ability to parse Markdown (see the `parseMarkdown` parameter).
83101

84102

85103
## Version 1.1.1 (2017-08-30)
86104
* \* Snippet now compatible with UTF-8 character encoding.
87105

88106

89107
## Version 1.1 (2017-02-25)
90-
* \+ Added an ability to convert characters to lowercase or to uppercase (see the `toLowercase` and `toUppercase` parameters).
108+
* \+ Added the ability to convert characters to lowercase or to uppercase (see the `toLowercase` and `toUppercase` parameters).
91109

92110

93111
## Version 1.0 (2016-12-30)
94112
* \+ The first release.
95113

96114

115+
<link rel="stylesheet" type="text/css" href="https://DivanDesign.ru/assets/files/ddMarkdown.css" />
97116
<style>ul{list-style:none;}</style>

CHANGELOG_ru.md

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
# (MODX)EvolutionCMS.snippets.ddStringTools changelog
2+
3+
4+
## Version 1.6 (2020-06-03)
5+
* \* Внимание! Требуется (MODX)EvolutionCMS.libraries.ddTools >= 0.38.1.
6+
* \+ Параметры → `inputString`: Также может быть задан как PHP объект или массив (например, при вызовах через `$modx->runSnippet`). В этом случае, сначала будет преобразован в JSON.
7+
* \* Небольшой рефакторинг.
8+
* \+ README:
9+
* \+ Документация → Примеры → Вызов через `$modx->runSnippet`.
10+
* \- Home page.
11+
* \+ Ссыдки.
12+
* \+ CHANGELOG: Улучшения стиля и текста.
13+
* \+ CHANGELOG_ru.
14+
* \* Composer.json:
15+
* \+ `homepage`.
16+
* \+ `authors`.
17+
* \* `require`:
18+
* \* `dd/evolutioncms-libraries-ddtools`: Переименовано из `dd/modxevo-library-ddtools`.
19+
* \* `dd/evolutioncms-snippets-ddtypograph`: Переименовано из `dd/modxevo-snippet-ddtypograph`.
20+
21+
22+
## Версия 1.5.2 (2020-05-07)
23+
* \* Параметры → `tools->charEscaper->lineBreaks`: Переносы строку будут заменены на `\r\n` вместо пробела.
24+
* \* Небольшой рефакторинг.
25+
26+
27+
## Версия 1.5.1 (2020-05-07)
28+
* \* Сниппет: Инструмент не будет применяться к пустой строке.
29+
30+
31+
## Версия 1.5 (2020-05-07)
32+
* \* Внимание! Требуется (MODX)EvolutionCMS.libraries.ddTools >= 0.35.
33+
* \* Новая структура сниппета (см. README):
34+
* \+ Добавлена возможность использования нескольких инструментов одновременно в нужном порядке.
35+
* \- Следующие параметры удалены (с сохранением обратной совместимости):
36+
* \- `toLowercase`.
37+
* \- `toUppercase`.
38+
* \- `parseMarkdown`.
39+
* \- `typography`.
40+
* \- `typography_params`.
41+
* \- `stripTags`.
42+
* \- `stripTags_allowed`.
43+
* \- `specialCharsToHTMLEntities`.
44+
* \- `removePlaceholders`.
45+
* \- `escapeForJS`.
46+
* \- `URLEncode`.
47+
* \+ Следующие параметры добавлены:
48+
* \+ `tools`.
49+
* \+ `tools->caseConverter`.
50+
* \+ `tools->caseConverter->toLower`.
51+
* \+ `tools->caseConverter->toUpper`.
52+
* \+ `tools->markdownParser`.
53+
* \+ `tools->markdownParser->parseInline`.
54+
* \+ `tools->typographer`.
55+
* \+ `tools->typographer->optAlign`.
56+
* \+ `tools->typographer->text_paragraphs`.
57+
* \+ `tools->typographer->text_autoLinks`.
58+
* \+ `tools->typographer->etc_unicodeConvert`.
59+
* \+ `tools->typographer->noTags`.
60+
* \+ `tools->typographer->excludeTags`.
61+
* \+ `tools->tagRemover`.
62+
* \+ `tools->tagRemover->allowed`.
63+
* \+ `tools->specialCharConverter`.
64+
* \+ `tools->charEscaper`.
65+
* \+ `tools->urlEncoder`.
66+
* \+ `tools->placeholderRemover`.
67+
* \+ Сниппет: Добавлены следующие параметры (см. README):
68+
* \+ `tools->charEscaper->backslashes`.
69+
* \+ `tools->charEscaper->lineBreaks`.
70+
* \+ `tools->charEscaper->tabs`.
71+
* \+ `tools->charEscaper->modxPlaceholders`.
72+
* \+ `tools->charEscaper->quotes`.
73+
* \+ `tools->tplParser`.
74+
* \+ `tools->tplParser->tpl`.
75+
* \+ `tools->tplParser->placeholders`.
76+
* \* Composer.json: Исправлен формат версий.
77+
78+
79+
## Версия 1.4 (2020-04-19)
80+
* \+ Добавлена возможность удалять плейсхолдеры вида `[+placeholder+]`.
81+
* \* Рефакторинг, метод `$modx->getConfig` используется вместо прямого обращения к свойству `$modx->config`.
82+
* \* README:
83+
* \* Изменения стиля.
84+
* \* Документация → Описание параметров: Небольшое изменения порядка.
85+
* \+ Composer.json → `require`.
86+
87+
88+
## Версия 1.3 (2019-10-20)
89+
* \* Внимание! Требуется EvolutionCMS.libraries.ddTools >= 0.27 (потому что не тестировался с более ранними версиями).
90+
* \* Внимание! Требуется EvolutionCMS.snippets.ddTypograph >= 2.4 (если используется параметр `typography`).
91+
* \+ Добавлена возможность типографирования текста (см. параметр `typography`).
92+
* \+ README → Документация:
93+
* \+ Установка.
94+
* \+ Описание параметров.
95+
* \+ Примеры.
96+
* \+ Composer.json.
97+
98+
99+
## Версия 1.2 (2019-08-09)
100+
* \+ Добавлена возможность парсинга Markdown в HTML. (см. параметр `parseMarkdown`).
101+
102+
103+
## Версия 1.1.1 (2017-08-30)
104+
* \* Сниппет теперь совместим с кодировкой UTF-8.
105+
106+
107+
## Версия 1.1 (2017-02-25)
108+
* \+ Добавлена возможность преобразовывать символы в нижний или верхний регистр (см. параметры `toLowercase` и `toUppercase`).
109+
110+
111+
## Версия 1.0 (2016-12-30)
112+
* \+ Первый релиз.
113+
114+
115+
<link rel="stylesheet" type="text/css" href="https://DivanDesign.ru/assets/files/ddMarkdown.css" />
116+
<style>ul{list-style:none;}</style>

README.md

Lines changed: 75 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Tools for modifying strings.
77

88
* PHP >= 5.4
99
* [(MODX)EvolutionCMS](https://github.com/evolution-cms/evolution) >= 1.1
10-
* [(MODX)EvolutionCMS.libraries.ddTools](https://code.divandesign.biz/modx/ddtools) >= 0.35
10+
* [(MODX)EvolutionCMS.libraries.ddTools](https://code.divandesign.biz/modx/ddtools) >= 0.38.1
1111
* [(MODX)EvolutionCMS.snippets.ddtypograph](https://code.divandesign.biz/modx/ddtypograph) >= 2.4 (if the `tools->typographer` parameter is used)
1212
* [PHP.libraries.Parsedown](https://github.com/erusev/parsedown) >= 1.8.0-beta-7 (contains in archive)
1313

@@ -21,11 +21,12 @@ 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.2</b> Tools for modifying strings.`.
24+
2. Description: `<b>1.6</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.
2828

29+
2930
#### 2. Elements → Manage Files:
3031

3132
1. Create a new folder `assets/snippets/ddStringTools/`.
@@ -36,14 +37,21 @@ Tools for modifying strings.
3637

3738
* `inputString`
3839
* Desctription: The input string.
39-
* Valid values: `string`
40+
* Valid values:
41+
* `string`
42+
* The input string can also be set as a PHP object or array (e. g. for calls through `$modx->runSnippet`). In this case, it will be converted to JSON first.
43+
* `object`
44+
* `array`
4045
* Default value: `''`
4146

4247
* `tools`
4348
* Desctription: List of string tools to be applied to `inputString`. Tools are called in accordance with the specified order.
4449
* Valid values:
4550
* `stirngJsonObject` — as [JSON](https://en.wikipedia.org/wiki/JSON)
4651
* `stringQueryFormated` — as [Query string](https://en.wikipedia.org/wiki/Query_string)
52+
* It can also be set as a PHP object or array (e. g. for calls through `$modx->runSnippet`).
53+
* `arrayAssociative`
54+
* `object`
4755
* Default value: `'{}'`
4856

4957
* `tools->{$toolName}`
@@ -508,7 +516,70 @@ Tools are called in accordance with the specified order:
508516
5. And escaped for JS.
509517
510518
511-
## [Home page →](http://code.divandesign.biz/modx/ddstringtools)
519+
#### Call through `$modx->runSnippet`
520+
521+
```php
522+
$modx->runSnippet(
523+
'ddStringTools',
524+
[
525+
'inputString' => '<div class="someTrash"></div><p><b>Some</b> <a href="#">sample</a> <i>text</i>. [+somePlaceholder+]</p>.',
526+
//`tools` in this case can be set as a native PHP array or object
527+
'tools' => [
528+
'placeholderRemover' => true,
529+
'typographer' => true,
530+
'tagRemover' => [
531+
'allowed' => '<p><a>'
532+
],
533+
'caseConverter' => [
534+
'toLower' => true
535+
],
536+
'charEscaper' => true
537+
]
538+
]
539+
);
540+
```
541+
542+
543+
#### Pass `inputString` as an array through `$modx->runSnippet`
544+
545+
The input string can also be set as a PHP object or array (e. g. for calls through `$modx->runSnippet`).
546+
In this case, it will be converted to JSON first.
547+
548+
```php
549+
$modx->runSnippet(
550+
'ddStringTools',
551+
[
552+
//This is an array, not string
553+
'inputString' => [
554+
'someObjectField' => '[+somePlaceholder+] need to be removed.',
555+
//And this is an array too
556+
'otherObjectField' => [
557+
'deepField' => '[+placeholders+] will be removed in any depth.'
558+
]
559+
],
560+
'tools' => [
561+
'placeholderRemover' => true
562+
]
563+
]
564+
);
565+
```
566+
567+
Returns:
568+
569+
```json
570+
{
571+
"someObjectField": " need to be removed.",
572+
"otherObjectField": {
573+
"deepField": " will be removed in any depth."
574+
}
575+
}
576+
```
577+
578+
579+
## Links
580+
581+
* [Home page](https://code.divandesign.biz/modx/ddstringtools)
582+
* [Telegram chat](https://t.me/dd_code)
512583
513584
514585
<link rel="stylesheet" type="text/css" href="https://DivanDesign.ru/assets/files/ddMarkdown.css" />

composer.json

Lines changed: 27 additions & 3 deletions
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.2",
4+
"version": "1.6.0",
55
"description": "Tools for modifying strings.",
66
"keywords": [
77
"modx",
@@ -22,9 +22,33 @@
2222
"js escaping",
2323
"url encode"
2424
],
25+
"homepage": "https://code.divandesign.biz/modx/ddstringtools",
26+
"authors": [
27+
{
28+
"name": "DD Group",
29+
"email": "code@DivanDesign.biz",
30+
"homepage": "https://code.divandesign.biz",
31+
"role": "Owner"
32+
},
33+
{
34+
"name": "Ilyas Ronef",
35+
"email": "ilyas@DivanDesign.ru",
36+
"homepage": "https://ronef.ru",
37+
"role": "Developer"
38+
},
39+
{
40+
"name": "Alexey Davydov",
41+
"email": "davalemic@DivanDesign.ru",
42+
"role": "Developer"
43+
},
44+
{
45+
"name": "Andrey Demchenko",
46+
"role": "Developer"
47+
}
48+
],
2549
"require": {
2650
"php": ">=5.4.0",
27-
"dd/modxevo-library-ddtools": ">=0.35.0",
28-
"dd/modxevo-snippet-ddtypograph": ">=2.4.0"
51+
"dd/evolutioncms-libraries-ddtools": ">=0.38.1",
52+
"dd/evolutioncms-snippets-ddtypograph": ">=2.4.0"
2953
}
3054
}

0 commit comments

Comments
 (0)