| @@ -2,10 +2,9 @@ | ||
| 2 | 2 | /** |
| 3 | 3 | * Plugin Name: User Access Manager |
| 4 | 4 | * Plugin URI: https://wordpress.org/plugins/user-access-manager/ |
| 5 | 5 | * Author URI: https://twitter.com/GM_Alex |
| 6 | - * Version: 2.3.15 | |
| 7 | - * Requires PHP: 8.0 | |
| 6 | + * Version: 2.2.2 | |
| 8 | 7 | * Author: Alexander Schneider |
| 9 | 8 | * Description: Manage the access to your posts, pages, categories and files. |
| 10 | 9 | * Text Domain: user-access-manager |
| 11 | 10 | * |
| @@ -10,9 +9,9 @@ | ||
| 10 | 9 | * Text Domain: user-access-manager |
| 11 | 10 | * |
| 12 | 11 | * user-access-manager.php |
| 13 | 12 | * |
| 14 | - * The user access manager main file. | |
| 13 | + * The the user access manager main file. | |
| 15 | 14 | * |
| 16 | 15 | * PHP versions 5 |
| 17 | 16 | * |
| 18 | 17 | * @author Alexander Schneider <alexanderschneider85@gmail.com> |
| @@ -21,60 +20,56 @@ | ||
| 21 | 20 | * @version SVN: $id$ |
| 22 | 21 | * @link http://wordpress.org/extend/plugins/user-access-manager/ |
| 23 | 22 | */ |
| 24 | 23 | |
| 25 | -function initUam() { | |
| 26 | - $basePath = __DIR__ . DIRECTORY_SEPARATOR; | |
| 24 | +$basePath = __DIR__.DIRECTORY_SEPARATOR; | |
| 25 | +//Load language | |
| 26 | +require_once $basePath.'includes'.DIRECTORY_SEPARATOR.'language.php'; | |
| 27 | +$locale = apply_filters('plugin_locale', get_locale(), 'user-access-manager'); | |
| 28 | +load_textdomain( | |
| 29 | + 'user-access-manager', | |
| 30 | + WP_LANG_DIR.DIRECTORY_SEPARATOR.'user-access-manager'.DIRECTORY_SEPARATOR.'user-access-manager-'.$locale.'.mo' | |
| 31 | +); | |
| 32 | +load_plugin_textdomain( | |
| 33 | + 'user-access-manager', | |
| 34 | + false, | |
| 35 | + plugin_basename(dirname(__FILE__)).DIRECTORY_SEPARATOR.'languages' | |
| 36 | +); | |
| 27 | 37 | |
| 28 | - //Load language | |
| 29 | - require_once $basePath . 'includes' . DIRECTORY_SEPARATOR . 'language.php'; | |
| 30 | - $locale = apply_filters('plugin_locale', get_locale(), 'user-access-manager'); | |
| 31 | - load_textdomain( | |
| 32 | - 'user-access-manager', | |
| 33 | - WP_LANG_DIR . DIRECTORY_SEPARATOR . 'user-access-manager' . DIRECTORY_SEPARATOR . 'user-access-manager-' . $locale . '.mo' | |
| 38 | +//--- Check requirements --- | |
| 39 | + | |
| 40 | +//Check php version | |
| 41 | +if (version_compare(phpversion(), '7.3') === -1) { | |
| 42 | + add_action( | |
| 43 | + 'admin_notices', | |
| 44 | + function () { | |
| 45 | + echo '<div id="message" class="error"><p><strong>' | |
| 46 | + .sprintf(TXT_UAM_PHP_VERSION_TO_LOW, phpversion()) | |
| 47 | + .'</strong></p></div>'; | |
| 48 | + } | |
| 34 | 49 | ); |
| 35 | - load_plugin_textdomain( | |
| 36 | - 'user-access-manager', | |
| 37 | - false, | |
| 38 | - plugin_basename(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'languages' | |
| 39 | - ); | |
| 40 | 50 | |
| 41 | - //--- Check requirements --- | |
| 51 | + return; | |
| 52 | +} | |
| 42 | 53 | |
| 43 | - //Check php version | |
| 44 | - if (version_compare((string)phpversion(), '7.2') === -1) { | |
| 45 | - add_action( | |
| 46 | - 'admin_notices', | |
| 47 | - function () { | |
| 48 | - echo '<div id="message" class="error"><p><strong>' | |
| 49 | - . sprintf(TXT_UAM_PHP_VERSION_TO_LOW, phpversion()) | |
| 50 | - . '</strong></p></div>'; | |
| 51 | - } | |
| 52 | - ); | |
| 54 | +//Check wordpress version | |
| 55 | +global $wp_version; | |
| 53 | 56 | |
| 54 | - return; | |
| 55 | - } | |
| 57 | +if (version_compare($wp_version, '4.6') === -1) { | |
| 58 | + add_action( | |
| 59 | + 'admin_notices', | |
| 60 | + function () use ($wp_version) { | |
| 61 | + echo '<div id="message" class="error"><p><strong>' | |
| 62 | + .sprintf(TXT_UAM_WORDPRESS_VERSION_TO_LOW, $wp_version) | |
| 63 | + .'</strong></p></div>'; | |
| 64 | + } | |
| 65 | + ); | |
| 56 | 66 | |
| 57 | - //Check WordPress version | |
| 58 | - global $wp_version; | |
| 67 | + return; | |
| 68 | +} | |
| 59 | 69 | |
| 60 | - if (version_compare((string)$wp_version, '4.6') === -1) { | |
| 61 | - add_action( | |
| 62 | - 'admin_notices', | |
| 63 | - function () use ($wp_version) { | |
| 64 | - echo '<div id="message" class="error"><p><strong>' | |
| 65 | - . sprintf(TXT_UAM_WORDPRESS_VERSION_TO_LOW, $wp_version) | |
| 66 | - . '</strong></p></div>'; | |
| 67 | - } | |
| 68 | - ); | |
| 70 | +//Defines | |
| 71 | +require_once $basePath.'vendor/autoload.php'; | |
| 72 | +require_once $basePath.'init.php'; | |
| 69 | 73 | |
| 70 | - return; | |
| 71 | - } | |
| 72 | - | |
| 73 | - //Defines | |
| 74 | - require_once $basePath.'vendor/autoload.php'; | |
| 75 | - require_once $basePath.'init.php'; | |
| 76 | - global $userAccessManager; | |
| 77 | - $userAccessManager = initUserAccessManger(); | |
| 78 | -} | |
| 79 | - | |
| 80 | -add_action('init', 'initUam', 0); | |
| 74 | +global $userAccessManager; | |
| 75 | +$userAccessManager = initUserAccessManger(); | |