Back to PhocacartUtils class

Method getPhocaVersion

public static
getPhocaVersion
(mixed $component = 'com_phocacart')

Method getPhocaVersion - Source code

public static function getPhocaVersion($component = 'com_phocacart')
{
    $component = 'com_phocacart';
    $folder = JPATH_ADMINISTRATOR . '/components' . '/' . $component;
    if (Folder::exists($folder)) {
        $xmlFilesInDir = Folder::files($folder, '.xml$');
    } else {
        $folder = JPATH_SITE . '/components' . '/' . $component;
        if (Folder::exists($folder)) {
            $xmlFilesInDir = Folder::files($folder, '.xml$');
        } else {
            $xmlFilesInDir = null;
        }
    }
    $xml_items = array();
    if (count($xmlFilesInDir)) {
        foreach ($xmlFilesInDir as $xmlfile) {
            if ($data = Installer::parseXMLInstallFile($folder . '/' . $xmlfile)) {
                foreach ($data as $key => $value) {
                    $xml_items[$key] = $value;
                }
            }
        }
    }
    if (isset($xml_items['version']) && $xml_items['version'] != '') {
        return $xml_items['version'];
    } else {
        return '';
    }
}