/** * Function that returns version info in JSON format * @return string * @since 1.3.1 */ function getVersionInfo($updateFrequency = 2) { require_once JPATH_COMPONENT_ADMINISTRATOR . DIRECTORY_SEPARATOR . 'helpers' . DIRECTORY_SEPARATOR . 'update.php'; $version_info = array(); $html = ''; $html_current = ''; $html_outdated = ''; $pathToXML = JPATH_COMPONENT_ADMINISTRATOR . DIRECTORY_SEPARATOR . 'customfilters.xml'; $installData = JApplicationHelper::parseXMLInstallFile($pathToXML); $updateHelper = extensionUpdateHelper::getInstance($extension = 'com_customfilters', $targetFile = 'assets/lastversion.ini', $updateFrequency = 2); $updateRegistry = $updateHelper->getData(); if ($installData['version']) { if (is_object($updateRegistry) && $updateRegistry !== false) { $isoutdated_code = version_compare($installData['version'], $updateRegistry->version); if ($isoutdated_code < 0) { $html_current = '<div class="cfversion"> <span class="pbversion_label">' . JText::_('COM_CUSTOMFILTERS_LATEST_VERSION') . ' : v. </span> <span class="cfversion_no">' . $updateRegistry->version . '</span><span> (' . $updateRegistry->date . ')</span> </div>'; } if ($isoutdated_code < 0) { $html_outdated = ' <span id="cfoutdated">!Outdated</span>'; } else { $html_outdated = ' <span id="cfupdated">Updated</span>'; } } $html .= '<div class="cfversion"> <span class="pbversion_label">' . JText::_('COM_CUSTOMFILTERS_CURRENT_VERSION') . ' : v. </span> <span class="cfversion_no">' . $installData['version'] . '</span><span> (' . $installData['creationDate'] . ')</span>' . $html_outdated . '</div>'; } $html .= $html_current; $version_info['html'] = $html; $version_info['status_code'] = $isoutdated_code; return $version_info; }