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 / Admin / Controller / PostController.php

PostController.php in Age Gate 3.7.3, at src/Admin/Controller/PostController.php

62 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace AgeGate\Admin\Controller;
4
5 use AgeGate\Admin\Post\Edit;
6 use AgeGate\Common\Settings;
7 use Asylum\Utility\Language;
8 use AgeGate\Admin\Taxonomy\Term;
9 use AgeGate\Admin\Post\ListTable;
10 use AgeGate\Common\Admin\AbstractController;
11
12 class PostController extends AbstractController
13 {
14 protected const INIT = true;
15 protected $listTable;
16
17 protected $edit;
18 protected $term;
19
20 public function register(): void
21 {
22 $this->listTable = new ListTable($this->view);
23 $this->edit = new Edit($this->view);
24 $this->term = new Term($this->view);
25 }
26
27 public function required(): bool
28 {
29 return true;
30 }
31
32 public function data(): array
33 {
34 return [];
35 }
36
37 public function fields(): array
38 {
39 return [];
40 }
41
42 public function enqueue(): void
43 {
44 wp_enqueue_script('age-gate-edit', AGE_GATE_URL . '/dist/edit.js', [], AGE_GATE_VERSION, true);
45
46 if ($languages = Language::getInstance()->getLanguages()) {
47 $settings = Settings::getInstance();
48 $default = Language::getInstance()->getLanguages('default');
49
50 $data = [];
51
52 $data[$default['code']] = $settings->defaultAge;
53
54 foreach ($languages as $code => $language) {
55 $data[$code] = $settings->{$code}['defaultAge'] ?? $settings->defaultAge;
56 }
57
58 wp_localize_script('age-gate-edit', 'agagemap', $data);
59 }
60 }
61 }
62