|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace GeminiLabs\SiteReviews\Integrations\Flatsome; |
|
4
|
|
|
|
|
5
|
|
|
use GeminiLabs\SiteReviews\Contracts\ShortcodeContract; |
|
6
|
|
|
use GeminiLabs\SiteReviews\Helpers\Cast; |
|
7
|
|
|
use GeminiLabs\SiteReviews\Modules\Rating; |
|
8
|
|
|
use GeminiLabs\SiteReviews\Shortcodes\SiteReviewsShortcode; |
|
9
|
|
|
|
|
10
|
|
|
class FlatsomeSiteReviews extends FlatsomeShortcode |
|
11
|
|
|
{ |
|
12
|
|
|
public function options(): array |
|
13
|
|
|
{ |
|
14
|
|
|
$options = [ |
|
15
|
|
|
'limit_group' => [ |
|
16
|
|
|
'type' => 'group', |
|
17
|
|
|
'heading' => esc_html_x('Limit Reviews By', 'admin-text', 'site-reviews'), |
|
18
|
|
|
'options' => [ |
|
19
|
|
|
'assigned_posts' => [ |
|
20
|
|
|
'type' => 'select', |
|
21
|
|
|
'heading' => esc_html_x('Limit Reviews by Assigned Pages', 'admin-text', 'site-reviews'), |
|
22
|
|
|
'full_width' => true, |
|
23
|
|
|
'config' => [ |
|
24
|
|
|
'multiple' => true, |
|
25
|
|
|
'placeholder' => esc_html_x('Select...', 'admin-text', 'site-reviews'), |
|
26
|
|
|
'postSelect' => 'assigned_posts_query', |
|
27
|
|
|
], |
|
28
|
|
|
], |
|
29
|
|
|
'assigned_terms' => [ |
|
30
|
|
|
'type' => 'select', |
|
31
|
|
|
'heading' => esc_html_x('Limit Reviews by Categories', 'admin-text', 'site-reviews'), |
|
32
|
|
|
'default' => '', |
|
33
|
|
|
'full_width' => true, |
|
34
|
|
|
'config' => [ |
|
35
|
|
|
'multiple' => true, |
|
36
|
|
|
'placeholder' => esc_html_x('Select...', 'admin-text', 'site-reviews'), |
|
37
|
|
|
'termSelect' => [ |
|
38
|
|
|
'taxonomies' => glsr()->taxonomy, |
|
39
|
|
|
], |
|
40
|
|
|
], |
|
41
|
|
|
], |
|
42
|
|
|
'assigned_users' => [ |
|
43
|
|
|
'type' => 'select', |
|
44
|
|
|
'heading' => esc_html_x('Limit Reviews by Assigned Users', 'admin-text', 'site-reviews'), |
|
45
|
|
|
'default' => '', |
|
46
|
|
|
'full_width' => true, |
|
47
|
|
|
'config' => [ |
|
48
|
|
|
'multiple' => true, |
|
49
|
|
|
'placeholder' => esc_html_x('Select...', 'admin-text', 'site-reviews'), |
|
50
|
|
|
'postSelect' => 'assigned_users_query', |
|
51
|
|
|
], |
|
52
|
|
|
], |
|
53
|
|
|
'terms' => [ |
|
54
|
|
|
'type' => 'select', |
|
55
|
|
|
'heading' => esc_html_x('Limit Reviews by Accepted Terms', 'admin-text', 'site-reviews'), |
|
56
|
|
|
'default' => '', |
|
57
|
|
|
'full_width' => true, |
|
58
|
|
|
'options' => [ |
|
59
|
|
|
'' => esc_html_x('Select...', 'admin-text', 'site-reviews'), |
|
60
|
|
|
'true' => esc_html_x('Terms were accepted', 'admin-text', 'site-reviews'), |
|
61
|
|
|
'false' => esc_html_x('Terms were not accepted', 'admin-text', 'site-reviews'), |
|
62
|
|
|
], |
|
63
|
|
|
], |
|
64
|
|
|
], |
|
65
|
|
|
], |
|
66
|
|
|
'display_group' => [ |
|
67
|
|
|
'type' => 'group', |
|
68
|
|
|
'heading' => esc_html_x('Display Options', 'admin-text', 'site-reviews'), |
|
69
|
|
|
'options' => [ |
|
70
|
|
|
'pagination' => [ |
|
71
|
|
|
'type' => 'select', |
|
72
|
|
|
'heading' => esc_html_x('Pagination Type', 'admin-text', 'site-reviews'), |
|
73
|
|
|
'default' => '', |
|
74
|
|
|
'full_width' => true, |
|
75
|
|
|
'options' => [ |
|
76
|
|
|
'' => esc_attr_x('No Pagination', 'admin-text', 'site-reviews'), |
|
77
|
|
|
'loadmore' => esc_attr_x('Load More Button', 'admin-text', 'site-reviews'), |
|
78
|
|
|
'ajax' => esc_attr_x('Pagination (AJAX)', 'admin-text', 'site-reviews'), |
|
79
|
|
|
'true' => esc_attr_x('Pagination (with page reload)', 'admin-text', 'site-reviews'), |
|
80
|
|
|
], |
|
81
|
|
|
], |
|
82
|
|
|
'display' => [ |
|
83
|
|
|
'type' => 'slider', |
|
84
|
|
|
'heading' => esc_html_x('Reviews Per Page', 'admin-text', 'site-reviews'), |
|
85
|
|
|
'default' => 10, |
|
86
|
|
|
'max' => 50, |
|
87
|
|
|
'min' => 1, |
|
88
|
|
|
], |
|
89
|
|
|
'rating' => [ |
|
90
|
|
|
'type' => 'slider', |
|
91
|
|
|
'heading' => esc_html_x('Minimum Rating', 'admin-text', 'site-reviews'), |
|
92
|
|
|
'default' => 0, |
|
93
|
|
|
'max' => Cast::toInt(glsr()->constant('MAX_RATING', Rating::class)), |
|
94
|
|
|
'min' => Cast::toInt(glsr()->constant('MIN_RATING', Rating::class)), |
|
95
|
|
|
], |
|
96
|
|
|
'schema' => [ |
|
97
|
|
|
'type' => 'checkbox', |
|
98
|
|
|
'heading' => esc_html_x('Enable the schema?', 'admin-text', 'site-reviews'), |
|
99
|
|
|
'description' => esc_html_x('The schema should only be enabled once per page.', 'admin-text', 'site-reviews'), |
|
100
|
|
|
], |
|
101
|
|
|
], |
|
102
|
|
|
], |
|
103
|
|
|
'hide_group' => [ |
|
104
|
|
|
'type' => 'group', |
|
105
|
|
|
'heading' => esc_html_x('Hide Options', 'admin-text', 'site-reviews'), |
|
106
|
|
|
'options' => $this->hideOptions(), |
|
107
|
|
|
], |
|
108
|
|
|
'advanced_group' => [ |
|
109
|
|
|
'type' => 'group', |
|
110
|
|
|
'heading' => esc_html_x('Advanced', 'admin-text', 'site-reviews'), |
|
111
|
|
|
'options' => [ |
|
112
|
|
|
'id' => [ |
|
113
|
|
|
'type' => 'textfield', |
|
114
|
|
|
'heading' => esc_html_x('Custom ID', 'admin-text', 'site-reviews'), |
|
115
|
|
|
'description' => esc_html_x('This should be a unique value.', 'admin-text', 'site-reviews'), |
|
116
|
|
|
'full_width' => true, |
|
117
|
|
|
], |
|
118
|
|
|
'class' => [ |
|
119
|
|
|
'type' => 'textfield', |
|
120
|
|
|
'heading' => esc_html_x('Additional CSS classes', 'admin-text', 'site-reviews'), |
|
121
|
|
|
'description' => esc_html_x('Separate multiple classes with spaces.', 'admin-text', 'site-reviews'), |
|
122
|
|
|
'full_width' => true, |
|
123
|
|
|
], |
|
124
|
|
|
'visibility' => [ |
|
125
|
|
|
'type' => 'select', |
|
126
|
|
|
'heading' => esc_html_x('Visibility', 'admin-text', 'site-reviews'), |
|
127
|
|
|
'default' => '', |
|
128
|
|
|
'options' => [ |
|
129
|
|
|
'' => esc_html_x('Visible', 'admin-text', 'site-reviews'), |
|
130
|
|
|
'hidden' => esc_html_x('Hidden', 'admin-text', 'site-reviews'), |
|
131
|
|
|
'hide-for-medium' => esc_html_x('Only for Desktop', 'admin-text', 'site-reviews'), |
|
132
|
|
|
'show-for-small' => esc_html_x('Only for Mobile', 'admin-text', 'site-reviews'), |
|
133
|
|
|
'show-for-medium hide-for-small' => esc_html_x('Only for Tablet', 'admin-text', 'site-reviews'), |
|
134
|
|
|
'show-for-medium' => esc_html_x('Hide for Desktop', 'admin-text', 'site-reviews'), |
|
135
|
|
|
'hide-for-small' => esc_html_x('Hide for Mobile', 'admin-text', 'site-reviews'), |
|
136
|
|
|
], |
|
137
|
|
|
], |
|
138
|
|
|
], |
|
139
|
|
|
], |
|
140
|
|
|
]; |
|
141
|
|
|
if ($types = $this->typeOptions()) { |
|
142
|
|
|
$options['limit_group']['options']['type'] = $types; |
|
143
|
|
|
} |
|
144
|
|
|
return $options; |
|
145
|
|
|
} |
|
146
|
|
|
|
|
147
|
|
|
protected function icon(): string |
|
148
|
|
|
{ |
|
149
|
|
|
return glsr()->url('assets/images/icons/flatsome/flatsome-reviews.svg'); |
|
150
|
|
|
} |
|
151
|
|
|
|
|
152
|
|
|
protected function name(): string |
|
153
|
|
|
{ |
|
154
|
|
|
return esc_attr_x('Latest Reviews', 'admin-text', 'site-reviews'); |
|
155
|
|
|
} |
|
156
|
|
|
|
|
157
|
|
|
protected function shortcode(): ShortcodeContract |
|
158
|
|
|
{ |
|
159
|
|
|
return glsr(SiteReviewsShortcode::class); |
|
|
|
|
|
|
160
|
|
|
} |
|
161
|
|
|
} |
|
162
|
|
|
|