Test Failed
Push — develop ( 1da57b...1707fa )
by Paul
07:25
created

Hooks::supportedVersion()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace GeminiLabs\SiteReviews\Integrations\WPBakery;
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('WPBakery Page Builder');
16
            return;
17
        }
18
        $this->hook(Controller::class, [
19
            ['enqueueInlineScripts', 'vc_frontend_editor_enqueue_js_css'],
20
            ['enqueueInlineStyles', 'vc_backend_editor_enqueue_js_css'],
21
            ['enqueueInlineStyles', 'vc_frontend_editor_enqueue_js_css'],
22
            ['filterAutocompleteAssignedPosts', 'vc_autocomplete_site_reviews_assigned_posts_callback'],
23
            ['filterAutocompleteAssignedPosts', 'vc_autocomplete_site_reviews_form_assigned_posts_callback'],
24
            ['filterAutocompleteAssignedPosts', 'vc_autocomplete_site_reviews_summary_assigned_posts_callback'],
25
            ['filterAutocompleteAssignedTerms', 'vc_autocomplete_site_reviews_assigned_terms_callback'],
26
            ['filterAutocompleteAssignedTerms', 'vc_autocomplete_site_reviews_form_assigned_terms_callback'],
27
            ['filterAutocompleteAssignedTerms', 'vc_autocomplete_site_reviews_summary_assigned_terms_callback'],
28
            ['filterAutocompleteAssignedUsers', 'vc_autocomplete_site_reviews_assigned_users_callback'],
29
            ['filterAutocompleteAssignedUsers', 'vc_autocomplete_site_reviews_form_assigned_users_callback'],
30
            ['filterAutocompleteAssignedUsers', 'vc_autocomplete_site_reviews_summary_assigned_users_callback'],
31
            ['filterAutocompletePostId', 'vc_autocomplete_site_review_post_id_callback'],
32
            ['filterSettingOutput', 'vc_single_param_edit_holder_output', 10, 4],
33
            ['registerParameters', 'vc_load_default_params'],
34
            ['registerShortcodes', 'vc_before_init', 5],
35
        ]);
36
    }
37
38
    protected function isInstalled(): bool
39
    {
40
        return class_exists('WPBakeryShortCode')
41
            && function_exists('vc_add_shortcode_param')
42
            && function_exists('vc_map')
43
            && defined('WPB_VC_VERSION');
44
    }
45
46
    protected function supportedVersion(): string
47
    {
48
        return '8.0';
49
    }
50
51
    protected function version(): string
52
    {
53
        return defined('WPB_VC_VERSION')
54
            ? (string) \WPB_VC_VERSION
1 ignored issue
show
Bug introduced by
The constant WPB_VC_VERSION was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
55
            : '';
56
    }
57
}
58