Test Failed
Push — develop ( fe7dfd...f4a85b )
by Paul
08:21
created

VcSiteReviews   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 110
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 3
eloc 83
c 1
b 0
f 1
dl 0
loc 110
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A vcShortcodeClass() 0 3 1
B vcShortcodeSettings() 0 98 1
A vcShortcodeIcon() 0 3 1
1
<?php
2
3
namespace GeminiLabs\SiteReviews\Integrations\WPBakery;
4
5
use GeminiLabs\SiteReviews\Helpers\Cast;
6
use GeminiLabs\SiteReviews\Modules\Rating;
7
use GeminiLabs\SiteReviews\Shortcodes\SiteReviewsShortcode;
8
9
class VcSiteReviews extends VcShortcode
10
{
11
    public static function vcShortcodeClass(): string
12
    {
13
        return SiteReviewsShortcode::class;
14
    }
15
16
    public static function vcShortcodeIcon(): string
17
    {
18
        return glsr()->url('assets/images/icons/wpbakery/wpbakery-reviews.svg');
19
    }
20
21
    public static function vcShortcodeSettings(): array
22
    {
23
        return [
24
            'assigned_posts' => [
25
                'type' => 'autocomplete',
26
                'heading' => esc_html_x('Limit Reviews by Assigned Pages', 'admin-text', 'site-reviews'),
27
                'param_name' => 'assigned_posts',
28
                'settings' => [
29
                    'multiple' => true,
30
                    'sortable' => true,
31
                ],
32
            ],
33
            'assigned_terms' => [
34
                'type' => 'autocomplete',
35
                'heading' => esc_html_x('Limit Reviews by Assigned Categories', 'admin-text', 'site-reviews'),
36
                'param_name' => 'assigned_terms',
37
                'settings' => [
38
                    'multiple' => true,
39
                    'sortable' => true,
40
                ],
41
            ],
42
            'assigned_users' => [
43
                'type' => 'autocomplete',
44
                'heading' => esc_html_x('Limit Reviews by Assigned Users', 'admin-text', 'site-reviews'),
45
                'param_name' => 'assigned_users',
46
                'settings' => [
47
                    'multiple' => true,
48
                    'sortable' => true,
49
                ],
50
            ],
51
            'type' => static::vcTypeOptions(),
52
            'terms' => [
53
                'type' => 'dropdown',
54
                'heading' => esc_html_x('Limit Reviews by Accepted Terms', 'admin-text', 'site-reviews'),
55
                'param_name' => 'terms',
56
                'std' => '',
57
                'value' => [
58
                    esc_html_x('Select Terms...', 'admin-text', 'site-reviews') => '',
59
                    esc_html_x('Terms were accepted', 'admin-text', 'site-reviews') => 'true',
60
                    esc_html_x('Terms were not accepted', 'admin-text', 'site-reviews') => 'false',
61
                ],
62
            ],
63
            'pagination' => [
64
                'type' => 'dropdown',
65
                'heading' => esc_html_x('Pagination Type', 'admin-text', 'site-reviews'),
66
                'param_name' => 'pagination',
67
                'std' => '',
68
                'value' => [
69
                    esc_attr_x('No Pagination', 'admin-text', 'site-reviews') => '',
70
                    esc_attr_x('Load More Button', 'admin-text', 'site-reviews') => 'loadmore',
71
                    esc_attr_x('Pagination (AJAX)', 'admin-text', 'site-reviews') => 'ajax',
72
                    esc_attr_x('Pagination (with page reload)', 'admin-text', 'site-reviews') => 'true',
73
                ],
74
            ],
75
            'display' => [
76
                'type' => 'glsr_type_range',
77
                'heading' => esc_html_x('Reviews Per Page', 'admin-text', 'site-reviews'),
78
                'max' => 50,
79
                'min' => 1,
80
                'param_name' => 'display',
81
                'std' => 10,
82
            ],
83
            'rating' => [
84
                'type' => 'glsr_type_range',
85
                'heading' => esc_html_x('Minimum Rating', 'admin-text', 'site-reviews'),
86
                'max' => Cast::toInt(glsr()->constant('MAX_RATING', Rating::class)),
87
                'min' => Cast::toInt(glsr()->constant('MIN_RATING', Rating::class)),
88
                'param_name' => 'rating',
89
                'std' => 0,
90
            ],
91
            'schema' => [
92
                'type' => 'checkbox',
93
                'heading' => esc_html_x('Enable the schema?', 'admin-text', 'site-reviews'),
94
                'description' => esc_html_x('The schema should only be enabled once on your page.', 'admin-text', 'site-reviews'),
95
                'param_name' => 'schema',
96
                'value' => [
97
                    esc_html_x('Yes', 'admin-text', 'site-reviews') => 'true',
98
                ],
99
            ],
100
            'hide' => [
101
                'type' => 'checkbox',
102
                'heading' => esc_html_x('Hide Options', 'admin-text', 'site-reviews'),
103
                'param_name' => 'hide',
104
                'value' => array_flip(static::vcShortcode()->getHideOptions()),
105
            ],
106
            'id' => [
107
                'type' => 'textfield',
108
                'heading' => esc_html_x('Custom ID', 'admin-text', 'site-reviews'),
109
                'description' => esc_html_x('This should be a unique value.', 'admin-text', 'site-reviews'),
110
                'param_name' => 'id',
111
                'group' => esc_html_x('Advanced', 'admin-text', 'site-reviews'),
112
            ],
113
            'class' => [
114
                'type' => 'textfield',
115
                'heading' => esc_html_x('Additional CSS classes', 'admin-text', 'site-reviews'),
116
                'description' => esc_html_x('Separate multiple classes with spaces.', 'admin-text', 'site-reviews'),
117
                'param_name' => 'class',
118
                'group' => esc_html_x('Advanced', 'admin-text', 'site-reviews'),
119
            ],
120
        ];
121
    }
122
}
123