1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace GeminiLabs\SiteReviews\Integrations\Bricks; |
4
|
|
|
|
5
|
|
|
use GeminiLabs\SiteReviews\Integrations\IntegrationHooks; |
6
|
|
|
use GeminiLabs\SiteReviews\Modules\Sanitizer; |
7
|
|
|
|
8
|
|
|
class Hooks extends IntegrationHooks |
9
|
|
|
{ |
10
|
|
|
public function run(): void |
11
|
|
|
{ |
12
|
|
|
if (!$this->isInstalled()) { |
13
|
|
|
return; |
14
|
|
|
} |
15
|
|
|
if (!$this->isVersionSupported()) { |
16
|
|
|
$this->notify('Bricks'); |
17
|
|
|
return; |
18
|
|
|
} |
19
|
|
|
$this->hook(Controller::class, [ |
20
|
|
|
['filterBuilderI18n', 'bricks/builder/i18n'], |
21
|
|
|
['filterSettingsMultiCheckbox', 'bricks/element/settings', 10, 2], |
22
|
|
|
['filterSettingsPrefixedId', 'bricks/element/settings', 10, 2], |
23
|
|
|
['printInlineStyles', 'wp_enqueue_scripts', 15], |
24
|
|
|
['registerElements', 'init', 11], |
25
|
|
|
['searchAssignedPosts', 'wp_ajax_bricks_glsr_assigned_posts'], |
26
|
|
|
['searchAssignedTerms', 'wp_ajax_bricks_glsr_assigned_terms'], |
27
|
|
|
['searchAssignedUsers', 'wp_ajax_bricks_glsr_assigned_users'], |
28
|
|
|
['searchPostId', 'wp_ajax_bricks_glsr_post_id'], |
29
|
|
|
]); |
30
|
|
|
} |
31
|
|
|
|
32
|
|
|
protected function isInstalled(): bool |
33
|
|
|
{ |
34
|
|
|
return 'bricks' === wp_get_theme(get_template())->get('TextDomain'); |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
protected function supportedVersion(): string |
38
|
|
|
{ |
39
|
|
|
return '1.11'; |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
protected function version(): string |
43
|
|
|
{ |
44
|
|
|
if ($this->isInstalled()) { |
45
|
|
|
return (string) wp_get_theme(get_template())->get('Version'); |
46
|
|
|
} |
47
|
|
|
return ''; |
48
|
|
|
} |
49
|
|
|
} |
50
|
|
|
|