function _get_file_phpdoc_version in Patterns 6.2
Same name and namespace in other branches
- 6 patterns.module \_get_file_phpdoc_version()
Helper function to get PHPDoc @version tag from a file
1 call to _get_file_phpdoc_version()
- patterns_requirements in ./
patterns.module - Implementation of hook_requirements().
File
- ./
patterns.module, line 3307 - Enables extremely simple adding/removing features to your site with minimal to no configuration
Code
function _get_file_phpdoc_version($path) {
$version = 'unknown';
$needle = '@version ';
if (file_exists($path)) {
$fp = @fopen($path, 'r');
if ($fp) {
while (!feof($fp)) {
$occurence = stristr(fgets($fp), $needle);
if ($occurence) {
// false if stristr found nothing
return rtrim(substr($occurence, strlen($needle)));
}
}
}
}
return $version;
}