1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace GeminiLabs\SiteReviews\Integrations\Elementor; |
4
|
|
|
|
5
|
|
|
use GeminiLabs\SiteReviews\Integrations\IntegrationHooks; |
6
|
|
|
|
7
|
|
|
class Hooks extends IntegrationHooks |
8
|
|
|
{ |
9
|
|
|
public function run(): void |
10
|
|
|
{ |
11
|
|
|
if (!$this->isInstalled()) { |
12
|
|
|
return; |
13
|
|
|
} |
14
|
|
|
if (!$this->isVersionSupported()) { |
15
|
|
|
$this->notify('Elementor'); |
16
|
|
|
return; |
17
|
|
|
} |
18
|
|
|
$this->hook(Controller::class, [ |
19
|
|
|
['filterElementorPublicInlineScript', 'site-reviews/enqueue/public/inline-script/after', 1], |
20
|
|
|
['filterElementorStarRatingDefaults', 'site-reviews/defaults/star-rating/defaults'], |
21
|
|
|
['filterGeneratedSchema', 'site-reviews/schema/generate'], |
22
|
|
|
['parseElementCss', 'elementor/element/parse_css', 10, 2], |
23
|
|
|
['registerElementorCategory', 'elementor/elements/categories_registered'], |
24
|
|
|
['registerElementorWidgets', 'elementor/widgets/register'], |
25
|
|
|
['registerInlineStyles', 'admin_enqueue_scripts', 20], |
26
|
|
|
['registerInlineStyles', 'elementor/editor/after_enqueue_styles'], |
27
|
|
|
['registerInlineStyles', 'elementor/preview/enqueue_styles'], |
28
|
|
|
['registerScripts', 'elementor/editor/after_enqueue_scripts'], |
29
|
|
|
]); |
30
|
|
|
} |
31
|
|
|
|
32
|
|
|
protected function isInstalled(): bool |
33
|
|
|
{ |
34
|
|
|
return class_exists('Elementor\Plugin'); |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
protected function supportedVersion(): string |
38
|
|
|
{ |
39
|
|
|
return '3.19.0'; |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
protected function version(): string |
43
|
|
|
{ |
44
|
|
|
return defined('ELEMENTOR_VERSION') |
45
|
|
|
? (string) \ELEMENTOR_VERSION |
46
|
|
|
: ''; |
47
|
|
|
} |
48
|
|
|
} |
49
|
|
|
|