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 / Integration / Woof.php

Woof.php in Age Gate 3.7.3, at src/Integration/Woof.php

44 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\Integration;
4
5 use AgeGate\Common\Integration;
6
7 class Woof extends Integration
8 {
9 public function exists()
10 {
11 return class_exists('WOOF');
12 }
13
14 public function init()
15 {
16 if ($this->exists()) {
17
18 add_filter('age_gate/init/content', function($content) {
19 global $WOOF;
20
21 if (!$WOOF instanceof \WOOF) {
22 return $content;
23 }
24
25 if (method_exists($WOOF, 'get_really_current_term') && $term = $WOOF->get_really_current_term()) {
26 // dd($term);
27 $content = new \AgeGate\Common\Content($term, 'term');
28 } elseif ($WOOF->is_isset_in_request_data($WOOF->get_swoof_search_slug())) {
29 global $wp_query;
30
31 if (($wp_query->query_vars['taxonomy'] ?? false) && ($wp_query->query_vars['term'] ?? false)) {
32
33 if ($term = get_term_by('slug', $wp_query->query_vars['term'], $wp_query->query_vars['taxonomy'])) {
34 $content = new \AgeGate\Common\Content($term, 'term');
35 }
36 }
37 }
38
39 return $content;
40 });
41 }
42 }
43 }
44