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