| 1 |
<?php |
| 2 |
|
| 3 |
declare(strict_types=1); |
| 4 |
|
| 5 |
/** |
| 6 |
* Reads the plugin version from the plugin header, the only place where it is maintained. |
| 7 |
*/ |
| 8 |
|
| 9 |
if (defined('UAM_VERSION') === false) { |
| 10 |
$pluginFile = fopen(__DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'user-access-manager.php', 'r'); |
| 11 |
$pluginHeader = ''; |
| 12 |
|
| 13 |
if ($pluginFile !== false) { |
| 14 |
$pluginHeader = (string) fread($pluginFile, 8192); |
| 15 |
fclose($pluginFile); |
| 16 |
} |
| 17 |
|
| 18 |
define( |
| 19 |
'UAM_VERSION', |
| 20 |
preg_match('/^[ \t\/*#@]*Version:(.*)$/mi', $pluginHeader, $versionMatches) === 1 ? |
| 21 |
trim($versionMatches[1]) : '' |
| 22 |
); |
| 23 |
|
| 24 |
unset($pluginFile, $pluginHeader, $versionMatches); |
| 25 |
} |
| 26 |
|