Skip to content

Commit

Permalink
Version 3.6
Browse files Browse the repository at this point in the history
  • Loading branch information
Ronef committed Jun 28, 2021
2 parents c5b54ff + d4e3d94 commit b7349bf
Show file tree
Hide file tree
Showing 8 changed files with 984 additions and 778 deletions.
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,25 @@
# (MODX)EvolutionCMS.snippets.ddGetMultipleField changelog


## Version 3.6 (2021-06-28)
* \* Attention! PHP >= 5.6 is required.
* \* Attention! (MODX)EvolutionCMS.libraries.ddTools >= 0.50 is required.
* \* Attention! (MODX)EvolutionCMS.snippets.ddTypograph >= 2.5 is required.
* \+ Parameters:
* \+ `placeholders`: Can also be set as [HJSON](https://hjson.github.io/) or as a native PHP object or array (e. g. for calls through `$modx->runSnippet`).
* \+ `columns`, `sortBy`, `typography`, `colTpl`: Can also be set as a native PHP array (e. g. for calls through `$modx->runSnippet`).
* \+ You can just call `\DDTools\Snippet::runSnippet` to run the snippet without DB and eval (see README → Examples).
* \+ `\ddGetMultipleField\Snippet`: The new class. All snippet code was moved here.
* \* `\DDTools\Snippet::runSnippet` is used instead of `$modx->runSnippet` to run (MODX)EvolutionCMS.snippets.ddTypograph without DB and eval.
* \- Removed compatibility with ancient versions of (MODX)EvolutionCMS.libraries.ddTools.
* \+ README:
* \+ Documentation → Installation → Using (MODX)EvolutionCMS.libraries.ddInstaller.
* \+ Links.
* \+ Composer.json:
* \+ `support`.
* \+ `authors`: Added missed homepages.


## Version 3.5.1 (2020-06-22)
* \* Improved compatibility with new versions of (MODX)EvolutionCMS.libraries.ddTools.

Expand Down
19 changes: 19 additions & 0 deletions CHANGELOG_ru.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,25 @@
# (MODX)EvolutionCMS.snippets.ddGetMultipleField changelog


## Версия 3.6 (2021-06-28)
* \* Внимание! Требуется PHP >= 5.6.
* \* Внимание! Требуется (MODX)EvolutionCMS.libraries.ddTools >= 0.50.
* \* Внимание! Требуется (MODX)EvolutionCMS.snippets.ddTypograph >= 2.5.
* \+ Параметры:
* \+ `placeholders`: Также может быть задан, как [HJSON](https://hjson.github.io/) или как нативный PHP объект или массив (например, для вызовов через `$modx->runSnippet`).
* \+ `columns`, `sortBy`, `typography`, `colTpl`: Также могут быть заданы, как нативные PHP массивы (например, для вызовов через `$modx->runSnippet`).
* \+ Запустить сниппет без DB и eval можно через `\DDTools\Snippet::runSnippet` (см. примеры в README).
* \+ `\ddGetMultipleField\Snippet`: Новый класс. Весь код сниппета перенесён туда.
* \* `\DDTools\Snippet::runSnippet` используется вместо `$modx->runSnippet` для запуска (MODX)EvolutionCMS.snippets.ddTypograph без DB и eval.
* \- Удалена совместимость с древними версиями (MODX)EvolutionCMS.libraries.ddTools.
* \+ README:
* \+ Документация → Установка → Используя (MODX)EvolutionCMS.libraries.ddInstaller.
* \+ Ссылки.
* \+ Composer.json:
* \+ `support`.
* \+ `authors`: Добавлены недостающие ссылки.


## Версия 3.5.1 (2020-06-22)
* \* Улучшена совместимость с новыми версиями (MODX)EvolutionCMS.libraries.ddTools.

Expand Down
93 changes: 84 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,26 +19,57 @@ Features:

## Requires

* PHP >= 5.4
* PHP >= 5.6
* [(MODX)EvolutionCMS](https://github.com/evolution-cms/evolution) >= 1.1
* [(MODX)EvolutionCMS.libraries.ddTools](https://code.divandesign.biz/modx/ddtools) >= 0.37
* [(MODX)EvolutionCMS.snippets.ddTypograph](https://code.divandesign.biz/modx/ddtypograph) >= 1.4.3 (if typography is required)
* [(MODX)EvolutionCMS.libraries.ddTools](https://code.divandesign.biz/modx/ddtools) >= 0.50
* [(MODX)EvolutionCMS.snippets.ddTypograph](https://code.divandesign.biz/modx/ddtypograph) >= 2.5 (if typography is required)


## Documentation


### Installation

Elements → Snippets: Create a new snippet with the following data:

#### Manually


##### 1. Elements → Snippets: Create a new snippet with the following data

1. Snippet name: `ddGetMultipleField`.
2. Description: `<b>3.5.1</b> A snippet for processing, manipulations and custom output structured data (JSON or separated by delimiters strings).`.
2. Description: `<b>3.6</b> A snippet for processing, manipulations and custom output structured data (JSON or separated by delimiters strings).`.
3. Category: `Core`.
4. Parse DocBlock: `no`.
5. Snippet code (php): Insert content of the `ddGetMultipleField_snippet.php` file from the archive.


##### 2. Elements → Manage Files

1. Create a new folder `assets/snippets/ddGetMultipleField/`.
2. Extract the archive to the folder (except `ddGetMultipleField_snippet.php`).


#### Using [(MODX)EvolutionCMS.libraries.ddInstaller](https://github.com/DivanDesign/EvolutionCMS.libraries.ddInstaller)

Just run the following PHP code in your sources or [Console](https://github.com/vanchelo/MODX-Evolution-Ajax-Console):

```php
//Include (MODX)EvolutionCMS.libraries.ddInstaller
require_once(
$modx->getConfig('base_path') .
'assets/libs/ddInstaller/require.php'
);

//Install (MODX)EvolutionCMS.snippets.ddGetMultipleField
\DDInstaller::install([
'url' => 'https://github.com/DivanDesign/EvolutionCMS.snippets.ddGetMultipleField',
'type' => 'snippet'
]);
```

* If `ddGetMultipleField` is not exist on your site, `ddInstaller` will just install it.
* If `ddGetMultipleField` is already exist on your site, `ddInstaller` will check it version and update it if needed.


### Parameters description

Expand Down Expand Up @@ -93,6 +124,7 @@ From the pair of `inputString` / `inputString_docField` parameters one is requir
* Desctription: The indexes of columns to return (indexes start at `0`).
* Valid values:
* `stringCommaSeparated`
* `array`
* `'all'` — all columns will be returned
* Default value: `'all'`

Expand Down Expand Up @@ -145,7 +177,9 @@ From the pair of `inputString` / `inputString_docField` parameters one is requir
* `sortBy`
* Desctription: The index of the column to sort by (indexes start at `0`).
The parameter also takes comma-separated values for multiple sort, e.g. `'0,1'`.
* Valid values: `stringCommaSeparated`
* Valid values:
* `stringCommaSeparated`
* `array`
* Default value: `'0'`

* `sortDir`
Expand All @@ -161,7 +195,9 @@ From the pair of `inputString` / `inputString_docField` parameters one is requir
* `typography`
* Desctription: The comma separated indexes of the columns which values have to be corrected (indexes start at `0`).
If unset, there will be no correction.
* Valid values: `stringCommaSeparated`
* Valid values:
* `stringCommaSeparated`
* `array`
* Default value: —

* `outputFormat`
Expand Down Expand Up @@ -201,7 +237,9 @@ From the pair of `inputString` / `inputString_docField` parameters one is requir
* `colTpl`
* Desctription: The comma-separated list of templates for column rendering (`outputFormat` has to be == `'html'`).
If the number of templates is lesser than the number of columns then the last passed template will be used to render the rest of the columns.
* Valid values: `stringCommaSeparated`
* Valid values:
* `stringCommaSeparated`
* `array`
* Default value: —

* `colTpl[i]`
Expand Down Expand Up @@ -237,7 +275,11 @@ From the pair of `inputString` / `inputString_docField` parameters one is requir
* `{"some": ["one", "two"] }` => `[+some.0+]`, `[+some.1+]`.
* Valid values:
* `stringJsonObject` — as [JSON](https://en.wikipedia.org/wiki/JSON)
* `stringHjsonObject` — as [HJSON](https://hjson.github.io/)
* `stringQueryFormated` — as [Query string](https://en.wikipedia.org/wiki/Query_string)
* It can also be set as a native PHP object or array (e. g. for calls through `$modx->runSnippet`):
* `arrayAssociative`
* `object`
* Default value: —

* `urlencode`
Expand Down Expand Up @@ -581,10 +623,43 @@ Returns:
```


#### Run the snippet through `\DDTools\Snippet::runSnippet` without DB and eval

```php
//Include (MODX)EvolutionCMS.libraries.ddTools
require_once(
$modx->getConfig('base_path') .
'assets/libs/ddTools/modx.ddtools.class.php'
);

//Run (MODX)EvolutionCMS.snippets.ddGetMultipleField
\DDTools\Snippet::runSnippet([
'name' => 'ddGetMultipleField',
'params' => [
'inputString' => '[
[
"assets/images/example1.png",
"Example image 1"
],
[
"assets/images/example2.png",
"Example image 2"
]
]',
'rowTpl' => '@CODE:<img src="[+col0+]" alt="[+col1+]" />'
]
]);
```


_It is hard to write here all possible examples so if here is something that you do not completely understand, please ask us._


## [Home page →](https://code.divandesign.biz/modx/ddgetmultiplefield)
## Links

* [Home page](https://code.divandesign.biz/modx/ddgetmultiplefield)
* [Telegram chat](https://t.me/dd_code)
* [Packagist](https://packagist.org/packages/dd/evolutioncms-snippets-ddgetmultiplefield)


<link rel="stylesheet" type="text/css" href="https://DivanDesign.ru/assets/files/ddMarkdown.css" />
102 changes: 89 additions & 13 deletions README_ru.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,26 +19,58 @@

## Использует

* PHP >= 5.4
* PHP >= 5.6
* [(MODX)EvolutionCMS](https://github.com/evolution-cms/evolution) >= 1.1
* [(MODX)EvolutionCMS.libraries.ddTools](https://code.divandesign.biz/modx/ddtools) >= 0.37
* [(MODX)EvolutionCMS.snippets.ddTypograph](https://code.divandesign.biz/modx/ddtypograph) >= 1.4.3 (if typography is required)
* [(MODX)EvolutionCMS.libraries.ddTools](https://code.divandesign.biz/modx/ddtools) >= 0.50
* [(MODX)EvolutionCMS.snippets.ddTypograph](https://code.divandesign.biz/modx/ddtypograph) >= 2.5 (if typography is required)


## Документация


### Установка

Элементы → Сниппеты: Создайте новый сниппет со следующими параметрами

#### Вручную


##### 1. Элементы → Сниппеты: Создайте новый сниппет со следующими параметрами

1. Название сниппета: `ddGetMultipleField`.
2. Описание: `<b>3.5.1</b> Сниппет для обработки, изменения и произвольного вывода структурированных данных (JSON или разделённых через определённые разделители).`.
2. Описание: `<b>3.6</b> Сниппет для обработки, изменения и произвольного вывода структурированных данных (JSON или разделённых через определённые разделители).`.
3. Категория: `Core`.
4. Анализировать DocBlock: `no`.
5. Код сниппета (php): Вставьте содержимое файла `ddGetMultipleField_snippet.php` из архива.


##### 2. Элементы → Управление файлами

1. Создайте новую папку `assets/snippets/ddGetMultipleField/`.
2. Извлеките содержимое архива в неё (кроме файла `ddGetMultipleField_snippet.php`).


#### Используя [(MODX)EvolutionCMS.libraries.ddInstaller](https://github.com/DivanDesign/EvolutionCMS.libraries.ddInstaller)

Просто вызовите следующий код в своих исходинках или модуле [Console](https://github.com/vanchelo/MODX-Evolution-Ajax-Console):

```php
//Подключение (MODX)EvolutionCMS.libraries.ddInstaller
require_once(
$modx->getConfig('base_path') .
'assets/libs/ddInstaller/require.php'
);

//Установка (MODX)EvolutionCMS.snippets.ddGetMultipleField
\DDInstaller::install([
'url' => 'https://github.com/DivanDesign/EvolutionCMS.snippets.ddGetMultipleField',
'type' => 'snippet'
]);
```

* Если `ddGetMultipleField` отсутствует на вашем сайте, `ddInstaller` просто установит его.
* Если `ddGetMultipleField` уже есть на вашем сайте, `ddInstaller` проверит его версию и обновит, если нужно.


### Описание параметров

Из пары параметров `inputString` / `inputString_docField` необходимо передавать лишь один.
Expand Down Expand Up @@ -77,7 +109,7 @@
* Значение по умолчанию: `'::'`

* `startRow`
* Описание: Номер строки, начиная с которой необходимо возвращать (строки нсмертьуются с `0`).
* Описание: Номер строки, начиная с которой необходимо возвращать (строки нумеруются с `0`).
* Допустимые значения: `integer`
* Значение по умолчанию: `0`

Expand All @@ -89,9 +121,10 @@
* Значение по умолчанию: `'all'`

* `columns`
* Описание: Номера колонк через запятую, которые нужно вернуть (колонки нсмертьуются с `0`).
* Описание: Номера колонк через запятую, которые нужно вернуть (колонки нумеруются с `0`).
* Допустимые значения:
* `stringCommaSeparated`
* `array`
* `'all'` — будут возвращены все колонки
* Значение по умолчанию: `'all'`

Expand Down Expand Up @@ -142,9 +175,11 @@
* Значение по умолчанию: `1`

* `sortBy`
* Описание: Номер колонки, по которой необходимо сортировать (нсмертьуются с `0`).
* Описание: Номер колонки, по которой необходимо сортировать (нумеруются с `0`).
Для множественной сортировки параметры указываются через запятую (например: `'0,1'`).
* Допустимые значения: `stringCommaSeparated`
* Допустимые значения:
* `stringCommaSeparated`
* `array`
* Значение по умолчанию: `'0'`

* `sortDir`
Expand All @@ -158,9 +193,11 @@
* Значение по умолчанию: `''`

* `typography`
* Описание: Номера колонок через запятую, значения которых нужно типографировать (колонки нсмертьуются с `0`).
* Описание: Номера колонок через запятую, значения которых нужно типографировать (колонки нумеруются с `0`).
Если не задано, ничего не типографируется.
* Допустимые значения: `stringCommaSeparated`
* Допустимые значения:
* `stringCommaSeparated`
* `array`
* Значение по умолчанию: —

* `outputFormat`
Expand Down Expand Up @@ -200,7 +237,9 @@
* `colTpl`
* Описание: Список шаблонов для вывода колонок, через запятую (при `outputFormat` == `'html'`).
Если шаблонов меньше, чем колонок, для всех недостающих выставляется последний указанный шаблон.
* Допустимые значения: `stringCommaSeparated`
* Допустимые значения:
* `stringCommaSeparated`
* `array`
* Значение по умолчанию: —

* `colTpl[i]`
Expand Down Expand Up @@ -236,7 +275,11 @@
* `{"some": ["one", "two"] }` => `[+some.0+]`, `[+some.1+]`.
* Допустимые значения:
* `stringJsonObject` — в виде [JSON](https://ru.wikipedia.org/wiki/JSON)
* `stringHjsonObject` — в виде [HJSON](https://hjson.github.io/)
* `stringQueryFormated` — в виде [Query string](https://en.wikipedia.org/wiki/Query_string)
* Также может быть задан, как нативный PHP объект или массив (например, для вызовов через `$modx->runSnippet`).
* `arrayAssociative`
* `object`
* Значение по умолчанию: —

* `urlencode`
Expand Down Expand Up @@ -580,10 +623,43 @@ Returns:
```


#### Запустить сниппет через `\DDTools\Snippet::runSnippet` без DB и eval

```php
//Подключение (MODX)EvolutionCMS.libraries.ddTools
require_once(
$modx->getConfig('base_path') .
'assets/libs/ddTools/modx.ddtools.class.php'
);

//Запуск (MODX)EvolutionCMS.snippets.ddGetMultipleField
\DDTools\Snippet::runSnippet([
'name' => 'ddGetMultipleField',
'params' => [
'inputString' => '[
[
"assets/images/example1.png",
"Пример изображения 1"
],
[
"assets/images/example2.png",
"Пример изображения 2"
]
]',
'rowTpl' => '@CODE:<img src="[+col0+]" alt="[+col1+]" />'
]
]);
```


_Примеров здесь можно напридумывать великое множество. Так что, если что не понятно, спрашивайте._


## [Home page →](https://code.divandesign.biz/modx/ddgetmultiplefield)
## Ссылки

* [Home page](https://code.divandesign.ru/modx/ddgetmultiplefield)
* [Telegram chat](https://t.me/dd_code)
* [Packagist](https://packagist.org/packages/dd/evolutioncms-snippets-ddgetmultiplefield)


<link rel="stylesheet" type="text/css" href="https://DivanDesign.ru/assets/files/ddMarkdown.css" />
Loading

0 comments on commit b7349bf

Please sign in to comment.