This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Gets the last commit date from .git repository | |
| * @param string $gitLocation location of .git/logs/HEAD | |
| * @return string date of last commit YYYY-mm-dd | |
| */ | |
| function gitLastCommitInfo($gitLocation) | |
| { | |
| $commitArray = file($gitLocation); // All commits from file | |
| $lastCommit = array_pop($commitArray); // Latest commit | |
| $lastCommitArray = explode("\t", $lastCommit); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| Thanks to | |
| http://www.php.net/manual/en/function.mb-detect-encoding.php#91051 | |
| http://stackoverflow.com/questions/8907196/check-if-csv-file-is-in-utf-8-with-php | |
| */ | |
| if (! mb_check_encoding($data, 'UTF-8')) { | |
| exit("Not UTF-8"); | |
| } | |
| else |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Source: http://www.php.net/manual/en/book.simplexml.php#108035 | |
| function toArray(SimpleXMLElement $xml) { | |
| $array = (array)$xml; | |
| foreach ( array_slice($array, 0) as $key => $value ) { | |
| if ( $value instanceof SimpleXMLElement ) { | |
| $array[$key] = empty($value) ? NULL : toArray($value); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function isInvalid($subject, $pattern) | |
| { | |
| preg_match($pattern, $subject, $matches); | |
| if ($matches[0] == $subject) | |
| { | |
| return FALSE; | |
| } | |
| else | |
| { | |
| return TRUE; |
NewerOlder