Created
September 4, 2014 11:03
-
-
Save skurvish/6d9ba9b273a98f947735 to your computer and use it in GitHub Desktop.
How to get DocMan Version
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 get_docman_ver( &$majDMver, &$minDMver) { | |
$maj = $min = 0; | |
if ( file_exists(JPATH_BASE . '/administrator/components/com_docman/version.php') ) { | |
include_once( JPATH_BASE . '/administrator/components/com_docman/version.php' ); | |
sscanf( ComDocmanVersion::getVersion(), "%i.%i", $maj, $min); | |
} else { | |
if ( file_exists(JPATH_BASE . '/administrator/components/com_docman/includes/defines.php') ) { | |
include_once( JPATH_BASE . '/administrator/components/com_docman/includes/defines.php' ); | |
sscanf( _DM_VERSION, "%i.%i", $maj, $min); | |
} else // Unknown DocMan or not installed | |
return FALSE; | |
} | |
$majDMver = $maj; | |
$minDMver = $min; | |
return TRUE; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To check the version against a pre-defined version in your code you can use http://php.net/manual/en/function.version-compare.php
Example