1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace GeminiLabs\SiteReviews\Integrations\SchemaPro; |
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->isEnabled()) { |
15
|
|
|
return; |
16
|
|
|
} |
17
|
|
|
$this->hook(Controller::class, [ |
18
|
|
|
['filterSchema', 'wp_schema_pro_schema_article'], |
19
|
|
|
['filterSchema', 'wp_schema_pro_schema_book'], |
20
|
|
|
['filterSchema', 'wp_schema_pro_schema_course'], |
21
|
|
|
['filterSchema', 'wp_schema_pro_schema_event'], |
22
|
|
|
['filterSchema', 'wp_schema_pro_schema_faq'], |
23
|
|
|
['filterSchema', 'wp_schema_pro_schema_how_to'], |
24
|
|
|
['filterSchema', 'wp_schema_pro_schema_image_license'], |
25
|
|
|
['filterSchema', 'wp_schema_pro_schema_local_business'], |
26
|
|
|
['filterSchema', 'wp_schema_pro_schema_product'], |
27
|
|
|
['filterSchema', 'wp_schema_pro_schema_recipe'], |
28
|
|
|
['filterSchema', 'wp_schema_pro_schema_service'], |
29
|
|
|
['filterSchema', 'wp_schema_pro_schema_software_application'], |
30
|
|
|
['filterSchema', 'wp_schema_pro_schema_video_object'], |
31
|
|
|
['onReviewCreated', 'site-reviews/review/created'], |
32
|
|
|
['onSettingsUpdated', 'site-reviews/settings/updated'], |
33
|
|
|
]); |
34
|
|
|
} |
35
|
|
|
|
36
|
|
|
protected function isEnabled(): bool |
37
|
|
|
{ |
38
|
|
|
return 'schema_pro' === $this->option('schema.integration.plugin'); |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
protected function isInstalled(): bool |
42
|
|
|
{ |
43
|
|
|
return class_exists('BSF_AIOSRS_Pro_Helper') |
44
|
|
|
&& defined('BSF_AIOSRS_PRO_CACHE_KEY'); |
45
|
|
|
} |
46
|
|
|
} |
47
|
|
|
|