Skip to content

Commit

Permalink
Version 0.9.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Ilyas Ronef committed Oct 10, 2013
2 parents 6e4ab66 + fa9253b commit 4dc96a8
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions assets/snippets/ddTools/modx.ddtools.class.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?php
/**
* modx ddTools class
* @version: 0.9 (2013-09-03)
* @version: 0.9.1 (2013-10-10)
*
* @uses modx 1.0.10 (Evo)
*
* @link http://code.divandesign.biz/modx/ddtools/0.9
* @link http://code.divandesign.biz/modx/ddtools/0.9.1
*
* @copyright Copyright 2013, DivanDesign
* http://www.DivanDesign.biz
Expand Down Expand Up @@ -678,7 +678,7 @@ public static function getDocumentChildrenTVarOutput($parentid = 0, $fields = ar
}else{
$result = array();

//Если указано поле ключя результирующего массива, добавим это поле (если ещё нету конечно)
//Если указано поле ключа результирующего массива, добавим это поле (если ещё нету конечно)
if ($resultKey !== false && !in_array($resultKey, $fields)) $fields[] = $resultKey;

//Перебираем все документы
Expand All @@ -705,13 +705,13 @@ public static function getDocumentChildrenTVarOutput($parentid = 0, $fields = ar

/**
* parseFileNameVersion
* @version 1.0 (2013-07-06)
* @version 1.1 (2013-10-10)
*
* @desc Parses a file path and gets its name & version.
* @desc Parses a file path and gets its name, version & extension.
*
* @param $file {string; array} - String of file path or result array of pathinfo() function. @required
*
* @return {array: associative} - Array of: 'name' {string} => File name; 'version' => File version.
* @return {array: associative} - Array of: 'name' {string} => File name; 'version' => File version; 'extension' => File extension.
*/
public static function parseFileNameVersion($file){
//Если сразу передали массив
Expand All @@ -727,7 +727,11 @@ public static function parseFileNameVersion($file){
}

//Fail by default
$result = array('name' => strtolower($file), 'version' => '0');
$result = array(
'name' => strtolower($file),
'version' => '0',
'extension' => !$fileinfo['extension'] ? '' : $fileinfo['extension']
);

//Try to get file version [0 — full name, 1 — script name, 2 — version, 3 — all chars after version]
preg_match('/(\D*?)-?(\d(?:\.\d+)*(?:-?[A-Za-z])*)(.*)/', $fileinfo['basename'], $match);
Expand Down

0 comments on commit 4dc96a8

Please sign in to comment.