PluginProbe
Age Gate / 3.6.1
Age Gate v3.6.1
trunk 1.0.0 1.0.1 1.1.0 1.2.0 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.4.0 1.4.1 1.4.10 1.4.11 1.4.12 1.4.13 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.4.8 1.4.9 All 112 releases
age-gate / age-gate.php

age-gate.php in Age Gate 3.6.1, at age-gate.php

65 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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.6.1
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.6.1');
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