Skip to content

Commit

Permalink
Version 1.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Ronef committed May 7, 2020
2 parents 32affc7 + 5291f1e commit 495e624
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 9 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# (MODX)EvolutionCMS.snippets.ddStash changelog


## Version 1.2.1 (2020-05-08)
* \* When you try to get non existent elements, an empty string will be returned.


## Version 1.2 (2020-05-03)
* \+ Added the ability to prevent overwriting fields with empty values (the `save_extendExistingWithEmpty` parameter, see README).
* \+ README_ru.
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG_ru.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# (MODX)EvolutionCMS.snippets.ddStash changelog


## Version 1.2.1 (2020-05-08)
* \* При попытке получить несуществующий элемент будет возвращена пустая строка.


## Версия 1.2 (2020-05-03)
* \+ Добавлена возможность предотвратить перезапись полей при расширении пустыми значениями (параметр `save_extendExistingWithEmpty`, см. README).
* \+ README_ru.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Save data as [JSON](https://en.wikipedia.org/wiki/JSON) or [Query string](https:
Elements → Snippets: Create a new snippet with the following data:

1. Snippet name: `ddStash`.
2. Description: `<b>1.2</b> Save data as JSON or QueryString, then extend if needed and use it later without database queries.`.
2. Description: `<b>1.2.1</b> Save data as JSON or QueryString, then extend if needed and use it later without database queries.`.
3. Category: `Core`.
4. Parse DocBlock: `no`.
5. Snippet code (php): Insert content of the `ddStash_snippet.php` file from the archive.
Expand Down
2 changes: 1 addition & 1 deletion README_ru.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
Элементы → Сниппеты: Создайте новый сниппет со следующими параметрами:

1. Название сниппета: `ddStash`.
2. Описание: `<b>1.2</b> Сохраняйте данные в формате JSON или QueryString, затем расширяйте по необходимости и используйте позже без запросов к базе данных.`.
2. Описание: `<b>1.2.1</b> Сохраняйте данные в формате JSON или QueryString, затем расширяйте по необходимости и используйте позже без запросов к базе данных.`.
3. Категория: `Core`.
4. Анализировать DocBlock: `no`.
5. Код сниппета (php): Вставьте содержимое файла `ddStash_snippet.php` из архива.
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "dd/evolutioncms-snippets-ddstash",
"type": "modxevo-snippet",
"version": "1.2.0",
"version": "1.2.1",
"description": "Save data as JSON or QueryString, then extend if needed and use it later without database queries.",
"keywords": [
"modx",
Expand Down
18 changes: 12 additions & 6 deletions ddStash_snippet.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* ddStash
* @version 1.2 (2020-05-03)
* @version 1.2.1 (2020-05-08)
*
* @see README.md
*
Expand Down Expand Up @@ -105,11 +105,17 @@
$key
){
//If need to see deeper
if (
is_array($snippetResult) &&
isset($snippetResult[$key])
){
$snippetResult = $snippetResult[$key];
if (is_array($snippetResult)){
//If element exists
if (isset($snippetResult[$key])){
//Save it
$snippetResult = $snippetResult[$key];
}else{
//Return empty string for non-existing elements
$snippetResult = '';

break;
}
}else{
break;
}
Expand Down

0 comments on commit 495e624

Please sign in to comment.