Skip to content

Commit 4a12a93

Browse files
committed
Version 0.63
2 parents 2574bea + ea722e8 commit 4a12a93

27 files changed

Lines changed: 966 additions & 410 deletions

CHANGELOG.md

Lines changed: 101 additions & 0 deletions
Large diffs are not rendered by default.

CHANGELOG_ru.md

Lines changed: 102 additions & 1 deletion
Large diffs are not rendered by default.

README.md

Lines changed: 401 additions & 271 deletions
Large diffs are not rendered by default.

composer.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "dd/evolutioncms-libraries-ddtools",
33
"type": "modxevo-library-ddtools",
4-
"version": "0.62.1",
4+
"version": "0.63.0",
55
"description": "A library with various tools facilitating your work.",
66
"keywords": [
77
"modx",
@@ -10,11 +10,13 @@
1010
"ddtools"
1111
],
1212
"homepage": "https://code.divandesign.ru/modx/ddtools",
13+
"support": {
14+
"chat": "https://t.me/dd_code"
15+
},
1316
"authors": [
1417
{
1518
"name": "Ilyas Ronef",
16-
"email": "ilyas@DivanDesign.ru",
17-
"homepage": "https://ronef.ru",
19+
"homepage": "https://ronef.me",
1820
"role": "Owner"
1921
},
2022
{

modx.ddtools.class.php

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<?php
22
/**
33
* EvolutionCMS.libraries.ddTools
4-
* @version 0.62.1 (2024-06-17)
4+
* @version 0.63 (2024-08-02)
55
*
66
* @see README.md
77
*
8-
* @copyright 2012–2024 Ronef {@link https://Ronef.ru }
8+
* @copyright 2012–2024 https://Ronef.me
99
*/
1010

1111
global $modx;
@@ -112,7 +112,7 @@ class ddTools {
112112

113113
/**
114114
* __construct
115-
* @version 1.0.4 (2020-02-11)
115+
* @version 1.0.5 (2024-08-02)
116116
*/
117117
private function __construct(){
118118
global $modx;
@@ -129,7 +129,7 @@ private function __construct(){
129129
}
130130

131131
//We need to include required files if Composer is not used
132-
if(!class_exists('\DDTools\FilesTools')){
132+
if(!class_exists('\DDTools\Tools\Files')){
133133
require_once(
134134
__DIR__ .
135135
DIRECTORY_SEPARATOR .
@@ -304,7 +304,7 @@ public static function explodeAssoc(
304304

305305
/**
306306
* sort2dArray
307-
* @version 1.3 (2022-12-23)
307+
* @version 1.3.1 (2024-08-02)
308308
*
309309
* @desc Sorts 2-dimensional array by multiple columns (like in SQL) using Hoare's method, also referred to as quicksort. The sorting is stable.
310310
*
@@ -323,7 +323,7 @@ public static function sort2dArray(
323323
$i = 0
324324
){
325325
//В качестве эталона получаем сортируемое значение (по первому условию сортировки) первого элемента
326-
$currentItem_comparisonValue = \DDTools\ObjectTools::getPropValue([
326+
$currentItem_comparisonValue = \DDTools\Tools\Objects::getPropValue([
327327
'object' => array_values($array)[0],
328328
'propName' => $sortBy[$i]
329329
]);
@@ -347,7 +347,7 @@ public static function sort2dArray(
347347
$arrayItemKey =>
348348
$arrayItem
349349
){
350-
$arrayItem_comparisonValue = \DDTools\ObjectTools::getPropValue([
350+
$arrayItem_comparisonValue = \DDTools\Tools\Objects::getPropValue([
351351
'object' => $arrayItem,
352352
'propName' => $sortBy[$i]
353353
]);
@@ -496,7 +496,7 @@ public static function parseFileNameVersion($file){
496496

497497
/**
498498
* convertUrlToAbsolute
499-
* @version 1.0 (2022-09-05)
499+
* @version 1.0.1 (2024-08-02)
500500
*
501501
* @desc Converts relative URLs to absolute.
502502
*
@@ -509,7 +509,7 @@ public static function parseFileNameVersion($file){
509509
*/
510510
public static function convertUrlToAbsolute($params){
511511
//# Prepare params
512-
$params = \DDTools\ObjectTools::extend([
512+
$params = \DDTools\Tools\Objects::extend([
513513
'objects' => [
514514
//Defaults
515515
(object) [
@@ -956,7 +956,7 @@ public static function parseText($params = []){
956956

957957
/**
958958
* parseText_parepareParams
959-
* @version 1.0.1 (2024-06-17)
959+
* @version 1.0.2 (2024-08-02)
960960
*
961961
* @param $params {stdClass|arrayAssociative} — The object of parameters. See $this->parseText.
962962
*
@@ -986,7 +986,7 @@ private static function parseText_parepareParams($params = []): \stdClass {
986986
'returnCorrectedOnly' => false,
987987
]);
988988

989-
$params = \DDTools\ObjectTools::extend([
989+
$params = \DDTools\Tools\Objects::extend([
990990
'objects' => [
991991
//Defaults
992992
(object) [
@@ -1006,7 +1006,7 @@ private static function parseText_parepareParams($params = []): \stdClass {
10061006

10071007
/**
10081008
* parseText_prepareData
1009-
* @version 1.0 (2024-06-06)
1009+
* @version 1.0.1 (2024-08-02)
10101010
*
10111011
* @param $params {stdClass|arrayAssociative} — The object of parameters. See $this->parseText.
10121012
* @param $params->data {stdClass|array|string}
@@ -1023,7 +1023,7 @@ private static function parseText_prepareData($params = []): \stdClass {
10231023
!is_object($params->data) &&
10241024
!is_array($params->data)
10251025
){
1026-
$params->data = \DDTools\ObjectTools::convertType([
1026+
$params->data = \DDTools\Tools\Objects::convertType([
10271027
'object' => $params->data,
10281028
'type' => 'objectArray'
10291029
]);
@@ -1039,7 +1039,7 @@ private static function parseText_prepareData($params = []): \stdClass {
10391039
is_array($value)
10401040
){
10411041
//Unfold for nested objects and arrays support (e. g. ['some' => ['a' => 'one', 'b' => 'two'] ] → '[+some.a+]', '[+some.b+]'; ['some' => ['one', 'two'] ] → '[+some.0+]', '[some.1]')
1042-
$unfoldedValue = \DDTools\ObjectTools::unfold([
1042+
$unfoldedValue = \DDTools\Tools\Objects::unfold([
10431043
'object' => [
10441044
$key => $value
10451045
],
@@ -1055,7 +1055,7 @@ private static function parseText_prepareData($params = []): \stdClass {
10551055
}
10561056

10571057
//Also add object value as JSON
1058-
$value = \DDTools\ObjectTools::convertType([
1058+
$value = \DDTools\Tools\Objects::convertType([
10591059
'object' => $value,
10601060
'type' => 'stringJsonAuto'
10611061
]);
@@ -1329,7 +1329,7 @@ private static function createDocument_prepareAlias($sourceString){
13291329

13301330
/**
13311331
* createDocument
1332-
* @version 1.5 (2020-06-21)
1332+
* @version 1.5.1 (2024-08-02)
13331333
*
13341334
* @desc Create a new document.
13351335
*
@@ -1345,7 +1345,7 @@ public static function createDocument(
13451345
$docGroups = false
13461346
){
13471347
//Defaults
1348-
$docData = \DDTools\ObjectTools::extend([
1348+
$docData = \DDTools\Tools\Objects::extend([
13491349
'objects' => [
13501350
(object) [
13511351
'pagetitle' => 'New resource',
@@ -1507,7 +1507,7 @@ public static function createDocument(
15071507

15081508
/**
15091509
* updateDocument
1510-
* @version 1.5 (2021-03-15)
1510+
* @version 1.5.1 (2024-08-02)
15111511
*
15121512
* @desc Update document(s). Cache of the updated docs and their parents will be cleared.
15131513
*
@@ -1532,7 +1532,7 @@ public static function updateDocument(
15321532
return false;
15331533
}
15341534

1535-
$docData = \DDTools\ObjectTools::extend([
1535+
$docData = \DDTools\Tools\Objects::extend([
15361536
'objects' => [
15371537
//Defaults
15381538
(object) [
@@ -2730,7 +2730,7 @@ function_exists('idn_to_utf8') ?
27302730

27312731
/**
27322732
* verifyRenamedParams
2733-
* @version 1.7.1 (2021-03-09)
2733+
* @version 1.7.2 (2024-08-02)
27342734
*
27352735
* @see README.md
27362736
*/
@@ -2747,7 +2747,7 @@ public static function verifyRenamedParams($params){
27472747
]);
27482748
}
27492749

2750-
$params = \DDTools\ObjectTools::extend([
2750+
$params = \DDTools\Tools\Objects::extend([
27512751
'objects' => [
27522752
//Defaults
27532753
(object) [
@@ -2991,7 +2991,7 @@ public static function getResponse(){
29912991

29922992
/**
29932993
* encodedStringToArray
2994-
* @version 1.2 (2020-06-02)
2994+
* @version 1.2.1 (2024-08-02)
29952995
*
29962996
* @desc Converts encoded strings to arrays.
29972997
* Supported formats:
@@ -3003,7 +3003,7 @@ public static function getResponse(){
30033003
* @return {array}
30043004
*/
30053005
public static function encodedStringToArray($inputString){
3006-
$result = \DDTools\ObjectTools::convertType([
3006+
$result = \DDTools\Tools\Objects::convertType([
30073007
'object' => $inputString,
30083008
'type' => 'objectArray'
30093009
]);
@@ -3027,23 +3027,23 @@ public static function encodedStringToArray($inputString){
30273027

30283028
/**
30293029
* unfoldArray
3030-
* @version 1.1 (2021-11-16)
3030+
* @version 1.1.1 (2024-08-02)
30313031
*
3032-
* @see README.md (\DDTools\ObjectTools::unfold)
3032+
* @see README.md (\DDTools\Tools\Objects::unfold)
30333033
*/
30343034
public static function unfoldArray(
30353035
$array,
30363036
$keyPrefix = ''
30373037
){
3038-
return \DDTools\ObjectTools::unfold([
3038+
return \DDTools\Tools\Objects::unfold([
30393039
'object' => $array,
30403040
'keyPrefix' => $keyPrefix
30413041
]);
30423042
}
30433043

30443044
/**
30453045
* createDir
3046-
* @version 1.0 (2019-10-22)
3046+
* @version 1.0.1 (2024-08-02)
30473047
*
30483048
* @desc Makes directory using `$modx->config['new_folder_permissions']`. Nested directories will be created too. Doesn't throw an exception if the folder already exists.
30493049
*
@@ -3053,12 +3053,12 @@ public static function unfoldArray(
30533053
* @return {boolean} — Success status.
30543054
*/
30553055
public static function createDir($params){
3056-
return \DDTools\FilesTools::createDir($params);
3056+
return \DDTools\Tools\Files::createDir($params);
30573057
}
30583058

30593059
/**
30603060
* copyDir
3061-
* @version 1.1 (2018-10-02)
3061+
* @version 1.1.1 (2024-08-02)
30623062
*
30633063
* @desc Copies a required folder with all contents recursively.
30643064
*
@@ -3071,15 +3071,15 @@ public static function copyDir(
30713071
$sourcePath,
30723072
$destinationPath
30733073
){
3074-
return \DDTools\FilesTools::copyDir([
3074+
return \DDTools\Tools\Files::copyDir([
30753075
'sourcePath' => $sourcePath,
30763076
'destinationPath' => $destinationPath
30773077
]);
30783078
}
30793079

30803080
/**
30813081
* removeDir
3082-
* @version 1.1 (2018-10-02)
3082+
* @version 1.1.1 (2024-08-02)
30833083
*
30843084
* @desc Removes a required folder with all contents recursively.
30853085
*
@@ -3088,7 +3088,7 @@ public static function copyDir(
30883088
* @return {boolean}
30893089
*/
30903090
public static function removeDir($path){
3091-
return \DDTools\FilesTools::removeDir($path);
3091+
return \DDTools\Tools\Files::removeDir($path);
30923092
}
30933093

30943094
/**

require.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
<?php
22
require_once('src/Base/Base.php');
33
require_once('src/Base/AncestorTrait.php');
4-
require_once('src/Base/BaseClass.php');
54

6-
require_once('src/ObjectTools/ObjectTools.php');
7-
require_once('src/FilesTools/FilesTools.php');
5+
require_once('src/Tools/Objects.php');
6+
require_once('src/Tools/Files.php');
7+
require_once('src/Tools/Cache.php');
8+
89
require_once('src/ObjectCollection/ObjectCollection.php');
910
require_once('src/Response/Response.php');
1011
require_once('src/Storage/Storage.php');
1112
require_once('src/Storage/DB/Storage.php');
1213

1314
require_once('src/Snippet/Snippet.php');
15+
16+
require_once('src/backwardCompatibility.php');
1417
?>

src/Base/AncestorTrait.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ final public static function getChildClassName($params): string {
8484

8585
/**
8686
* createChildInstance
87-
* @version 1.2.2 (2024-02-06)
87+
* @version 1.2.3 (2024-08-02)
8888
*
8989
* @see README.md
9090
*/
@@ -94,7 +94,7 @@ final public static function createChildInstance($params){
9494
$objectClass = static::getChildClassName($params);
9595

9696
return new $objectClass(
97-
\DDTools\ObjectTools::isPropExists([
97+
\DDTools\Tools\Objects::isPropExists([
9898
'object' => $params,
9999
'propName' => 'params',
100100
])

src/Base/Base.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,15 +85,15 @@ public static function getClassName(): \stdClass {
8585

8686
/**
8787
* setExistingProps
88-
* @version 1.4 (2022-01-08)
88+
* @version 1.4.1 (2024-08-02)
8989
*
9090
* @see README.md
9191
*
9292
* @return {void}
9393
*/
9494
public function setExistingProps($props){
9595
if (is_string($props)){
96-
$props = \DDTools\ObjectTools::convertType([
96+
$props = \DDTools\Tools\Objects::convertType([
9797
'object' => $props,
9898
'type' => 'objectStdClass'
9999
]);
@@ -224,14 +224,14 @@ public function toArray(){
224224

225225
/**
226226
* toJSON
227-
* @version 1.1 (2022-12-26)
227+
* @version 1.1.1 (2024-08-02)
228228
*
229229
* @see README.md
230230
*
231231
* @return {stringJsonObject}
232232
*/
233233
public function toJSON(){
234-
return \DDTools\ObjectTools::convertType([
234+
return \DDTools\Tools\Objects::convertType([
235235
'object' => $this->toArray(),
236236
'type' => 'stringJsonAuto'
237237
]);

0 commit comments

Comments
 (0)