| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* Plugin Name: Age Gate |
| 5 |
* Plugin URI: https://agegate.io/ |
| 6 |
* Description: A customisable age gate to block content from younger people |
| 7 |
* Version: 3.7.2 |
| 8 |
* Requires at least: 6.0.0 |
| 9 |
* Requires PHP: 7.4 |
| 10 |
* Author: Phil Baker |
| 11 |
* Author URI: https://agegate.io/ |
| 12 |
* Text Domain: age-gate |
| 13 |
* Domain Path: /language |
| 14 |
* License: GPL v2 or later |
| 15 |
* License URI: https://www.gnu.org/licenses/gpl-2.0.html |
| 16 |
*/ |
| 17 |
|
| 18 |
if (!defined('WPINC')) { |
| 19 |
die; |
| 20 |
} |
| 21 |
|
| 22 |
define('AGE_GATE_PATH', plugin_dir_path(__FILE__)); |
| 23 |
define('AGE_GATE_URL', plugin_dir_url(__FILE__)); |
| 24 |
define('AGE_GATE_VERSION', '3.7.2'); |
| 25 |
define('AGE_GATE_SLUG', 'age-gate'); |
| 26 |
|
| 27 |
$autoload = AGE_GATE_PATH . 'vendor/autoload.php'; |
| 28 |
|
| 29 |
if (!file_exists($autoload) || !is_readable($autoload)) { |
| 30 |
add_action('admin_notices', function() { |
| 31 |
echo sprintf('<div class="notice notice-error"><p>%s</p></div>', esc_html__('Age Gate could not load its dependencies. Please check your installation.', 'age-gate')); |
| 32 |
}); |
| 33 |
return; |
| 34 |
} |
| 35 |
|
| 36 |
require_once($autoload); |
| 37 |
require_once(AGE_GATE_PATH . 'src/Bootstrap.php'); |
| 38 |
|
| 39 |
function age_gate_activate($networkwide) |
| 40 |
{ |
| 41 |
if (is_multisite() && $networkwide) { |
| 42 |
foreach (get_sites() as $site) { |
| 43 |
switch_to_blog($site->blog_id); |
| 44 |
\AgeGate\Update\Activate::activate(); |
| 45 |
restore_current_blog(); |
| 46 |
} |
| 47 |
} else { |
| 48 |
\AgeGate\Update\Activate::activate(); |
| 49 |
} |
| 50 |
} |
| 51 |
|
| 52 |
function age_gate_deactivate() |
| 53 |
{ |
| 54 |
\AgeGate\Update\Deactivate::deactivate(); |
| 55 |
} |
| 56 |
|
| 57 |
function age_gate_uninstall() |
| 58 |
{ |
| 59 |
\AgeGate\Update\Uninstall::uninstall(); |
| 60 |
} |
| 61 |
|
| 62 |
register_activation_hook(__FILE__, 'age_gate_activate'); |
| 63 |
register_deactivation_hook(__FILE__, 'age_gate_deactivate'); |
| 64 |
register_uninstall_hook(__FILE__, 'age_gate_uninstall'); |
| 65 |
|