PluginProbe
Product Labels, Quick View, Buy Now, Pre-Orders, Frequently Bought Together & More for WooCommerce – Merchant / 1.10.2
Product Labels, Quick View, Buy Now, Pre-Orders, Frequently Bought Together & More for WooCommerce – Merchant v1.10.2
2.3.2 2.3.1 2.3.0 2.2.8 2.2.7 trunk 1.10.0 1.10.1 1.10.2 1.10.3 1.10.4 1.10.5 1.11.0 1.11.1 1.11.2 1.6 1.7 1.8 1.8.1 1.8.2 1.8.3 1.9.0 1.9.1 1.9.10 1.9.11 All 60 releases
merchant / inc / modules / quick-social-links / admin / options.php

options.php in Product Labels, Quick View, Buy Now, Pre-Orders, Frequently Bought Together & More for WooCommerce – Merchant 1.10.2, at inc/modules/quick-social-links/admin/options.php

441 lines 12.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Quick Social Links Options.
5 *
6 * @package Merchant
7 */
8
9 if ( ! defined( 'ABSPATH' ) ) {
10 exit; // Exit if accessed directly
11 }
12
13 // Settings
14 Merchant_Admin_Options::create( array(
15 'module' => Merchant_Quick_Social_Links::MODULE_ID,
16 'title' => esc_html__( 'Settings', 'merchant' ),
17 'fields' => array(
18 array(
19 'id' => 'layout',
20 'type' => 'choices',
21 'title' => esc_html__( 'Layout', 'merchant' ),
22 'options' => array(
23 'pos-bottom' => array(
24 'image' => '%s/qlb.svg',
25 'label' => esc_html__( 'Bottom', 'merchant' ),
26 ),
27 'pos-left' => array(
28 'image' => '%s/qll.svg',
29 'label' => esc_html__( 'Left', 'merchant' ),
30 ),
31 'pos-right' => array(
32 'image' => '%s/qlr.svg',
33 'label' => esc_html__( 'Right', 'merchant' ),
34 ),
35 ),
36 'default' => 'pos-bottom',
37 ),
38 array(
39 'id' => 'visibility',
40 'type' => 'select',
41 'title' => esc_html__( 'Visibility', 'merchant' ),
42 'options' => array(
43 'visibility-all' => esc_html__( 'Show on all devices', 'merchant' ),
44 'visibility-desktop' => esc_html__( 'Desktop only', 'merchant' ),
45 'visibility-mobile' => esc_html__( 'Mobile/Tablet only', 'merchant' ),
46 ),
47 'default' => 'visibility-all',
48 ),
49 ),
50 ) );
51
52 // Link settings
53 Merchant_Admin_Options::create( array(
54 'module' => Merchant_Quick_Social_Links::MODULE_ID,
55 'title' => esc_html__( 'Style Settings', 'merchant' ),
56 'fields' => array(
57 array(
58 'id' => 'icon_color',
59 'type' => 'color',
60 'title' => esc_html__( 'Icon color', 'merchant' ),
61 'default' => '#212121',
62 ),
63
64 array(
65 'id' => 'bg_color',
66 'type' => 'color',
67 'title' => esc_html__( 'Background color', 'merchant' ),
68 'default' => '#ffffff',
69 ),
70
71 array(
72 'id' => 'border_radius',
73 'type' => 'range',
74 'title' => esc_html__( 'Border radius', 'merchant' ),
75 'min' => 1,
76 'max' => 500,
77 'step' => 1,
78 'unit' => 'px',
79 'default' => 15,
80 ),
81 ),
82 )
83 );
84
85 // Get the user roles
86 $user_roles = array();
87 $user_rules = get_editable_roles();
88
89 if ( ! empty( $user_rules ) ) {
90 foreach ( $user_rules as $role_id => $role_data ) {
91 $user_roles[] = array(
92 'id' => 'user_role_' . $role_id,
93 'text' => $role_data['name'],
94 );
95 }
96 }
97
98 // Link settings
99 Merchant_Admin_Options::create( array(
100 'module' => Merchant_Quick_Social_Links::MODULE_ID,
101 'title' => esc_html__( 'Display Conditions', 'merchant' ),
102 'fields' => array(
103
104 array(
105 'id' => 'condition_rules',
106 'type' => 'flexible_content',
107 'style' => 'table',
108 'button_label' => esc_html__( 'Add new', 'merchant' ),
109 'layouts' => array(
110 'display' => array(
111 'title' => esc_html__( 'Display condition', 'merchant' ),
112 'fields' => array(
113 array(
114 'id' => 'type',
115 'title' => esc_html__( 'Inclusion', 'merchant' ),
116 'type' => 'select',
117 'options' => array(
118 'include' => esc_html__( 'Include', 'merchant' ),
119 'exclude' => esc_html__( 'Exclude', 'merchant' ),
120 ),
121 ),
122 array(
123 'id' => 'condition',
124 'type' => 'select_ajax',
125 'title' => __( 'Condition', 'merchant' ),
126 'source' => 'options',
127 'multiple' => false,
128 'classes' => array(
129 'flex-grow',
130 ),
131 'options' => array(
132 array(
133 'id' => 'all',
134 'text' => esc_html__( 'Entire Site', 'merchant' ),
135 ),
136 array(
137 'id' => 'basic',
138 'text' => esc_html__( 'Basic', 'merchant' ),
139 'options' => array(
140 array(
141 'id' => 'singular',
142 'text' => esc_html__( 'Singulars', 'merchant' ),
143 ),
144 array(
145 'id' => 'archive',
146 'text' => esc_html__( 'Archives', 'merchant' ),
147 ),
148 ),
149 ),
150 array(
151 'id' => 'posts',
152 'text' => esc_html__( 'Posts', 'merchant' ),
153 'options' => array(
154 array(
155 'id' => 'single-post',
156 'text' => esc_html__( 'Single Post', 'merchant' ),
157 ),
158 array(
159 'id' => 'post-archives',
160 'text' => esc_html__( 'Post Archives', 'merchant' ),
161 ),
162 array(
163 'id' => 'post-categories',
164 'text' => esc_html__( 'Post Categories', 'merchant' ),
165 ),
166 array(
167 'id' => 'post-tags',
168 'text' => esc_html__( 'Post Tags', 'merchant' ),
169 ),
170 ),
171 ),
172 array(
173 'id' => 'pages',
174 'text' => esc_html__( 'Pages', 'merchant' ),
175 'options' => array(
176 array(
177 'id' => 'single-page',
178 'text' => esc_html__( 'Single Page', 'merchant' ),
179 ),
180 ),
181 ),
182 array(
183 'id' => 'woocommerce',
184 'text' => esc_html__( 'WooCommerce', 'merchant' ),
185 'options' => array(
186 array(
187 'id' => 'cart-page',
188 'text' => esc_html__( 'Cart', 'merchant' ),
189 ),
190 array(
191 'id' => 'checkout-page',
192 'text' => esc_html__( 'Checkout', 'merchant' ),
193 ),
194 array(
195 'id' => 'single-product',
196 'text' => esc_html__( 'Single Product', 'merchant' ),
197 ),
198 array(
199 'id' => 'product-archives',
200 'text' => esc_html__( 'Product Archives', 'merchant' ),
201 ),
202 array(
203 'id' => 'product-categories',
204 'text' => esc_html__( 'Product Categories', 'merchant' ),
205 ),
206 array(
207 'id' => 'product-tags',
208 'text' => esc_html__( 'Product Tags', 'merchant' ),
209 ),
210 array(
211 'id' => 'account-page',
212 'text' => esc_html__( 'My Account', 'merchant' ),
213 ),
214 array(
215 'id' => 'edit-account-page',
216 'text' => esc_html__( 'Edit Account', 'merchant' ),
217 ),
218 array(
219 'id' => 'order-received-page',
220 'text' => esc_html__( 'Order Received', 'merchant' ),
221 ),
222 array(
223 'id' => 'view-order-page',
224 'text' => esc_html__( 'View Order', 'merchant' ),
225 ),
226 array(
227 'id' => 'lost-password-page',
228 'text' => esc_html__( 'Lost Password', 'merchant' ),
229 ),
230 ),
231 ),
232 array(
233 'id' => 'other',
234 'text' => esc_html__( 'Other', 'merchant' ),
235 'options' => array(
236 array(
237 'id' => 'front-page',
238 'text' => esc_html__( 'Front Page', 'merchant' ),
239 ),
240 array(
241 'id' => 'blog',
242 'text' => esc_html__( 'Blog', 'merchant' ),
243 ),
244 array(
245 'id' => 'search',
246 'text' => esc_html__( 'Search', 'merchant' ),
247 ),
248 array(
249 'id' => '404',
250 'text' => esc_html__( '404', 'merchant' ),
251 ),
252 array(
253 'id' => 'author',
254 'text' => esc_html__( 'Author', 'merchant' ),
255 ),
256 array(
257 'id' => 'privacy-policy-page',
258 'text' => esc_html__( 'Privacy Policy Page', 'merchant' ),
259 ),
260 ),
261 ),
262 ),
263 ),
264 ),
265 ),
266 'user' => array(
267 'title' => esc_html__( 'User condition', 'merchant' ),
268 'fields' => array(
269 array(
270 'id' => 'type',
271 'title' => esc_html__( 'Inclusion', 'merchant' ),
272 'type' => 'select',
273 'options' => array(
274 'include' => esc_html__( 'Include', 'merchant' ),
275 'exclude' => esc_html__( 'Exclude', 'merchant' ),
276 ),
277 ),
278 array(
279 'id' => 'condition',
280 'type' => 'select_ajax',
281 'title' => __( 'Condition', 'merchant' ),
282 'source' => 'options',
283 'multiple' => false,
284 'classes' => array(
285 'flex-grow',
286 ),
287 'options' => array(
288 array(
289 'id' => 'user-auth',
290 'text' => esc_html__( 'User Auth', 'merchant' ),
291 'options' => array(
292 array(
293 'id' => 'logged-in',
294 'text' => esc_html__( 'User Logged In', 'merchant' ),
295 ),
296 array(
297 'id' => 'logged-out',
298 'text' => esc_html__( 'User Logged Out', 'merchant' ),
299 ),
300 ),
301 ),
302 array(
303 'id' => 'user-roles',
304 'text' => esc_html__( 'User Roles', 'merchant' ),
305 'options' => $user_roles,
306 ),
307 array(
308 'id' => 'other',
309 'text' => esc_html__( 'Other', 'merchant' ),
310 'options' => array(
311 array(
312 'id' => 'author',
313 'text' => esc_html__( 'Author', 'merchant' ),
314 'ajax' => true,
315 ),
316 ),
317 ),
318 ),
319 ),
320 ),
321 ),
322 ),
323 'default' => array(
324 array(
325 'layout' => 'display',
326 'condition' => 'all',
327 'type' => 'include',
328 ),
329 ),
330 ),
331 ),
332 ) );
333
334
335 // Create the social icon choices.
336 $social_icon_choices = array();
337
338 foreach ( Merchant_Quick_Social_Links::get_socials() as $key => $label ) {
339 $social_icon_choices[ $key ] = array(
340 'label' => $label,
341 'svg' => "icon-{$key}",
342 );
343 }
344
345 // Link settings
346 Merchant_Admin_Options::create( array(
347 'module' => Merchant_Quick_Social_Links::MODULE_ID,
348 'title' => esc_html__( 'Links', 'merchant' ),
349 'fields' => array(
350
351 array(
352 'id' => 'links',
353 'type' => 'flexible_content',
354 'sorting' => true,
355 'desc' => esc_html__( 'Add a social link with an associated icon, or insert a custom link and upload your preferred image or SVG', 'merchant' ),
356 'button_label' => esc_html__( 'Add new', 'merchant' ),
357 'layouts' => array(
358 'social' => array(
359 'title' => esc_html__( 'Social link', 'merchant' ),
360 'fields' => array(
361 array(
362 'id' => 'icon',
363 'type' => 'choices',
364 'title' => esc_html__( 'Icon', 'merchant' ),
365 'options' => $social_icon_choices,
366 'default' => 'cart-icon-1',
367 ),
368 array(
369 'id' => 'url',
370 'title' => esc_html__( 'URL', 'merchant' ),
371 'type' => 'text',
372 'default' => 'https://',
373 'desc' => esc_html__( 'After entering the complete URL, an associated icon will be automatically chosen.', 'merchant' ),
374 ),
375 ),
376 ),
377 'custom' => array(
378 'title' => esc_html__( 'Custom link', 'merchant' ),
379 'fields' => array(
380 array(
381 'id' => "image",
382 'type' => 'upload',
383 'title' => __( 'Select custom image or SVG', 'merchant' ),
384 ),
385 array(
386 'id' => 'url',
387 'title' => esc_html__( 'URL', 'merchant' ),
388 'type' => 'text',
389 'default' => 'https://',
390 ),
391 ),
392 ),
393 ),
394 'default' => array(
395 array(
396 'layout' => 'social',
397 'icon' => 'facebook',
398 'url' => esc_html__( 'https://www.facebook.com', 'merchant' ),
399 ),
400 array(
401 'layout' => 'social',
402 'icon' => 'instagram',
403 'url' => esc_html__( 'https://www.instagram.com', 'merchant' ),
404 ),
405 array(
406 'layout' => 'social',
407 'icon' => 'twitter',
408 'url' => esc_html__( 'https://www.twitter.com', 'merchant' ),
409 ),
410 ),
411 ),
412 ),
413 ) );
414
415 // Shortcode
416 $merchant_module_id = Merchant_Quick_Social_Links::MODULE_ID;
417 Merchant_Admin_Options::create( array(
418 'module' => $merchant_module_id,
419 'title' => esc_html__( 'Use shortcode', 'merchant' ),
420 'fields' => array(
421 array(
422 'id' => 'use_shortcode',
423 'type' => 'switcher',
424 'title' => __( 'Use shortcode', 'merchant' ),
425 'default' => 0,
426 ),
427 array(
428 'type' => 'info',
429 'id' => 'shortcode_info',
430 'content' => esc_html__( 'If you are using a page builder or a theme that supports shortcodes, then you can output the module using the shortcode above. This might be useful if, for example, you find that you want to control the position of the module output more precisely than with the module settings.', 'merchant' ),
431 ),
432 array(
433 'id' => 'shortcode_text',
434 'type' => 'text_readonly',
435 'title' => esc_html__( 'Shortcode text', 'merchant' ),
436 'default' => '[merchant_module_' . str_replace( '-', '_', $merchant_module_id ) . ']',
437 'condition' => array( 'use_shortcode', '==', '1' ),
438 ),
439 ),
440 ) );
441