| 1 |
<?php |
| 2 |
/** |
| 3 |
* @package VikWP - Libraries |
| 4 |
* @subpackage adapter.application |
| 5 |
* @author E4J s.r.l. |
| 6 |
* @copyright Copyright (C) 2023 E4J s.r.l. All Rights Reserved. |
| 7 |
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL |
| 8 |
* @link https://vikwp.com |
| 9 |
*/ |
| 10 |
|
| 11 |
// No direct access |
| 12 |
defined('ABSPATH') or die('No script kiddies please!'); |
| 13 |
|
| 14 |
/** |
| 15 |
* Version information class for the Joomla CMS. |
| 16 |
* |
| 17 |
* @since 10.1.16 |
| 18 |
*/ |
| 19 |
final class JVersion |
| 20 |
{ |
| 21 |
/** |
| 22 |
* Gets a "PHP standardized" version string for the current WordPress. |
| 23 |
* |
| 24 |
* @return string Version string. |
| 25 |
* |
| 26 |
* @uses getLongVersion() |
| 27 |
*/ |
| 28 |
public function getShortVersion() |
| 29 |
{ |
| 30 |
/** |
| 31 |
* Try to extract the short version from the default one. |
| 32 |
* |
| 33 |
* @since 10.1.26 |
| 34 |
*/ |
| 35 |
$version = $this->getLongVersion(); |
| 36 |
|
| 37 |
if (preg_match("/^[\d\.]+/", $version, $match)) |
| 38 |
{ |
| 39 |
// return initial version only (strip all nightly information) |
| 40 |
return $match[0]; |
| 41 |
} |
| 42 |
|
| 43 |
// return default version |
| 44 |
return $version; |
| 45 |
} |
| 46 |
|
| 47 |
/** |
| 48 |
* Gets a version string for the current WordPress with all release information. |
| 49 |
* |
| 50 |
* @return string Complete version string. |
| 51 |
*/ |
| 52 |
public function getLongVersion() |
| 53 |
{ |
| 54 |
// obtain WP version from global var and return it |
| 55 |
global $wp_version; |
| 56 |
|
| 57 |
return $wp_version; |
| 58 |
} |
| 59 |
} |
| 60 |
|