| 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.5.3 |
| 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 |
*/ |
| 15 |
|
| 16 |
if (!defined('WPINC')) { |
| 17 |
die; |
| 18 |
} |
| 19 |
|
| 20 |
define('AGE_GATE_PATH', plugin_dir_path(__FILE__)); |
| 21 |
define('AGE_GATE_URL', plugin_dir_url(__FILE__)); |
| 22 |
define('AGE_GATE_VERSION', '3.5.3'); |
| 23 |
define('AGE_GATE_SLUG', 'age-gate'); |
| 24 |
|
| 25 |
$autoload = AGE_GATE_PATH . 'vendor/autoload.php'; |
| 26 |
|
| 27 |
if (!file_exists($autoload) || !is_readable($autoload)) { |
| 28 |
add_action('admin_notices', function() { |
| 29 |
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')); |
| 30 |
}); |
| 31 |
return; |
| 32 |
} |
| 33 |
|
| 34 |
require_once($autoload); |
| 35 |
require_once(AGE_GATE_PATH . 'src/Bootstrap.php'); |
| 36 |
|
| 37 |
function age_gate_activate($networkwide) |
| 38 |
{ |
| 39 |
if (is_multisite() && $networkwide) { |
| 40 |
foreach (get_sites() as $site) { |
| 41 |
switch_to_blog($site->blog_id); |
| 42 |
\AgeGate\Update\Activate::activate(); |
| 43 |
restore_current_blog(); |
| 44 |
} |
| 45 |
} else { |
| 46 |
\AgeGate\Update\Activate::activate(); |
| 47 |
} |
| 48 |
} |
| 49 |
|
| 50 |
function age_gate_deactivate() |
| 51 |
{ |
| 52 |
\AgeGate\Update\Deactivate::deactivate(); |
| 53 |
} |
| 54 |
|
| 55 |
function age_gate_uninstall() |
| 56 |
{ |
| 57 |
\AgeGate\Update\Uninstall::uninstall(); |
| 58 |
} |
| 59 |
|
| 60 |
register_activation_hook(__FILE__, 'age_gate_activate'); |
| 61 |
register_deactivation_hook(__FILE__, 'age_gate_deactivate'); |
| 62 |
register_uninstall_hook(__FILE__, 'age_gate_uninstall'); |
| 63 |
|