PluginProbe
Age Gate / 3.7.3
Age Gate v3.7.3
3.7.3 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 All 113 releases
age-gate / src / App / AgeGate.php

AgeGate.php in Age Gate 3.7.3, at src/App/AgeGate.php

56 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace AgeGate\App;
4
5 use AgeGate\Common\Content;
6 use AgeGate\Common\Settings;
7 use AgeGate\Integration\Discover;
8 use AgeGate\Controller\JsController;
9 use AgeGate\Controller\StandardController;
10
11 class AgeGate
12 {
13 protected static $content;
14
15 public function __construct()
16 {
17 add_action('wp', [$this, 'init'], PHP_INT_MAX);
18 }
19
20 public function init()
21 {
22 if (is_admin()) {
23 return;
24 }
25
26 new Discover();
27
28 $settings = Settings::getInstance();
29
30 do_action('age_gate/settings', $settings);
31
32 if ($settings->disableAgeGate) {
33 return;
34 }
35
36 $content = new Content();
37 self::$content = apply_filters('age_gate/init/content', $content);
38
39 if (!is_a(self::$content, 'AgeGate\\Common\\Content')) {
40 _doing_it_wrong( 'age_gate/init/content', 'Must return instance of AgeGate\\Common\\Content', '3.4.0');
41 self::$content = $content;
42 }
43
44 if ($settings->method === 'js') {
45 new JsController(self::$content);
46 } else {
47 new StandardController(self::$content);
48 }
49 }
50
51 public static function getContent()
52 {
53 return self::$content;
54 }
55 }
56