Skip to content

Commit

Permalink
Remove deprecated JVersion usage
Browse files Browse the repository at this point in the history
  • Loading branch information
andrepereiradasilva authored and wilsonge committed Jan 27, 2016
1 parent 2317826 commit 7719186
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@
<?php echo $language->name; ?>

<?php // Display a Note if language pack version is not equal to Joomla version ?>
<?php if (substr($language->version, 0, 3) != $version->RELEASE
|| substr($language->version, 0, 5) != $version->RELEASE . "." . $version->DEV_LEVEL) : ?>
<?php if (substr($language->version, 0, 3) != $version::RELEASE
|| substr($language->version, 0, 5) != $version->getShortVersion()) : ?>
<div class="small"><?php echo JText::_('JGLOBAL_LANGUAGE_VERSION_NOT_PLATFORM'); ?></div>
<?php endif; ?>
</label>
Expand Down
19 changes: 9 additions & 10 deletions administrator/modules/mod_version/helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,19 @@ abstract class ModVersionHelper
*/
public static function getVersion(&$params)
{
$format = $params->get('format', 'short');
$product = $params->get('product', 0);
$method = 'get' . ucfirst($format) . "Version";
$version = new JVersion;
$versionText = $version->getShortVersion();

// Get the joomla version
$instance = new JVersion;
$version = call_user_func(array($instance, $method));
if ($params->get('format', 'short') === 'long')
{
$versionText = str_replace($version::PRODUCT . ' ', '', $version->getLongVersion());
}

if ($format == 'short' && !empty($product))
if (!empty($params->get('product', 0)))
{
// Add the product name to short format only (in long format it's included)
$version = $instance->PRODUCT . ' ' . $version;
$versionText = $version::PRODUCT . ' ' . $versionText;
}

return $version;
return $versionText;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@
<?php echo $language->name; ?>

<?php // Display a Note if language pack version is not equal to Joomla version ?>
<?php if (substr($language->version, 0, 3) != $version->RELEASE
|| substr($language->version, 0, 5) != $version->RELEASE . "." . $version->DEV_LEVEL) : ?>
<?php if (substr($language->version, 0, 3) != $version::RELEASE
|| substr($language->version, 0, 5) != $version->getShortVersion()) : ?>
<div class="small"><?php echo JText::_('JGLOBAL_LANGUAGE_VERSION_NOT_PLATFORM'); ?></div>
<?php endif; ?>
</td>
Expand Down
4 changes: 2 additions & 2 deletions build/helpTOC.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function doExecute()
{
// Get the version data for the script
$version = new JVersion;
$helpVersion = str_replace('.', '', $version->RELEASE);
$helpVersion = str_replace('.', '', $version::RELEASE);
$namespace = 'Help' . $helpVersion . ':';

// Set up options for JMediawiki
Expand All @@ -63,7 +63,7 @@ public function doExecute()

// Get the category members (local hack)
$this->out('Fetching data from docs wiki', true);
$categoryMembers = $mediawiki->categories->getCategoryMembers('Category:Help_screen_' . $version->RELEASE, null, 'max');
$categoryMembers = $mediawiki->categories->getCategoryMembers('Category:Help_screen_' . $version::RELEASE, null, 'max');

$members = array();

Expand Down
4 changes: 2 additions & 2 deletions installation/view/languages/tmpl/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ class="btn btn-primary"
/> <?php echo $language->name; ?>

<?php // Display a Note if language pack version is not equal to Joomla version ?>
<?php if (substr($language->version, 0, 3) != $version->RELEASE
|| substr($language->version, 0, 5) != $version->RELEASE . "." . $version->DEV_LEVEL) : ?>
<?php if (substr($language->version, 0, 3) != $version::RELEASE
|| substr($language->version, 0, 5) != $version->getShortVersion()) : ?>
<div class="small"><?php echo JText::_('JGLOBAL_LANGUAGE_VERSION_NOT_PLATFORM'); ?></div>
<?php endif; ?>
</label>
Expand Down
4 changes: 2 additions & 2 deletions libraries/joomla/updater/adapters/collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ public function _startElement($parser, $name, $attrs = array())
$ver = new JVersion;

// Lower case and remove the exclamation mark
$product = strtolower(JFilterInput::getInstance()->clean($ver->PRODUCT, 'cmd'));
$product = strtolower(JFilterInput::getInstance()->clean($ver::PRODUCT, 'cmd'));

/*
* Set defaults, the extension file should clarify in case but it may be only available in one version
Expand All @@ -166,7 +166,7 @@ public function _startElement($parser, $name, $attrs = array())
// Set this to ourself as a default
if (!isset($values['targetplatformversion']))
{
$values['targetplatformversion'] = $ver->RELEASE;
$values['targetplatformversion'] = $ver::RELEASE;
}

// Set this to ourselves as a default
Expand Down
6 changes: 3 additions & 3 deletions libraries/joomla/updater/adapters/extension.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ protected function _endElement($parser, $name)
$ver = new JVersion;

// Lower case and remove the exclamation mark
$product = strtolower(JFilterInput::getInstance()->clean($ver->PRODUCT, 'cmd'));
$product = strtolower(JFilterInput::getInstance()->clean($ver::PRODUCT, 'cmd'));

/*
* Check that the product matches and that the version matches (optionally a regexp)
Expand All @@ -107,8 +107,8 @@ protected function _endElement($parser, $name)
*/
if ($product == $this->currentUpdate->targetplatform['NAME']
&& preg_match('/^' . $this->currentUpdate->targetplatform['VERSION'] . '/', JVERSION)
&& ((!isset($this->currentUpdate->targetplatform->min_dev_level)) || $ver->DEV_LEVEL >= $this->currentUpdate->targetplatform->min_dev_level)
&& ((!isset($this->currentUpdate->targetplatform->max_dev_level)) || $ver->DEV_LEVEL <= $this->currentUpdate->targetplatform->max_dev_level))
&& ((!isset($this->currentUpdate->targetplatform->min_dev_level)) || $ver::DEV_LEVEL >= $this->currentUpdate->targetplatform->min_dev_level)
&& ((!isset($this->currentUpdate->targetplatform->max_dev_level)) || $ver::DEV_LEVEL <= $this->currentUpdate->targetplatform->max_dev_level))
{
// Check if PHP version supported via <php_minimum> tag, assume true if tag isn't present
if (!isset($this->currentUpdate->php_minimum) || version_compare(PHP_VERSION, $this->currentUpdate->php_minimum, '>='))
Expand Down
8 changes: 4 additions & 4 deletions libraries/joomla/updater/update.php
Original file line number Diff line number Diff line change
Expand Up @@ -298,14 +298,14 @@ public function _endElement($parser, $name)
// Closing update, find the latest version and check
case 'UPDATE':
$ver = new JVersion;
$product = strtolower(JFilterInput::getInstance()->clean($ver->PRODUCT, 'cmd'));
$product = strtolower(JFilterInput::getInstance()->clean($ver::PRODUCT, 'cmd'));

// Check for optional min_dev_level and max_dev_level attributes to further specify targetplatform (e.g., 3.0.1)
if (isset($this->currentUpdate->targetplatform->name)
&& $product == $this->currentUpdate->targetplatform->name
&& preg_match('/' . $this->currentUpdate->targetplatform->version . '/', $ver->RELEASE)
&& ((!isset($this->currentUpdate->targetplatform->min_dev_level)) || $ver->DEV_LEVEL >= $this->currentUpdate->targetplatform->min_dev_level)
&& ((!isset($this->currentUpdate->targetplatform->max_dev_level)) || $ver->DEV_LEVEL <= $this->currentUpdate->targetplatform->max_dev_level))
&& preg_match('/' . $this->currentUpdate->targetplatform->version . '/', $ver::RELEASE)
&& ((!isset($this->currentUpdate->targetplatform->min_dev_level)) || $ver::DEV_LEVEL >= $this->currentUpdate->targetplatform->min_dev_level)
&& ((!isset($this->currentUpdate->targetplatform->max_dev_level)) || $ver::DEV_LEVEL <= $this->currentUpdate->targetplatform->max_dev_level))
{
// Check if PHP version supported via <php_minimum> tag, assume true if tag isn't present
if (!isset($this->currentUpdate->php_minimum) || version_compare(PHP_VERSION, $this->currentUpdate->php_minimum->_data, '>='))
Expand Down

0 comments on commit 7719186

Please sign in to comment.