| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* Advanced Reviews 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( |
| 15 |
array( |
| 16 |
'title' => __( 'Settings', 'merchant' ), |
| 17 |
'module' => Merchant_Advanced_Reviews::MODULE_ID, |
| 18 |
'fields' => array( |
| 19 |
|
| 20 |
// Title. |
| 21 |
array( |
| 22 |
'id' => 'title', |
| 23 |
'type' => 'text', |
| 24 |
'title' => __( 'Title', 'merchant' ), |
| 25 |
'default' => __( 'What our customers are saying', 'merchant' ), |
| 26 |
), |
| 27 |
|
| 28 |
// Title HTML Tag. |
| 29 |
array( |
| 30 |
'id' => 'title_tag', |
| 31 |
'type' => 'select', |
| 32 |
'title' => __( 'Title HTML tag', 'merchant' ), |
| 33 |
'options' => array( |
| 34 |
'h1' => __( 'H1', 'merchant' ), |
| 35 |
'h2' => __( 'H2', 'merchant' ), |
| 36 |
'h3' => __( 'H3', 'merchant' ), |
| 37 |
'h4' => __( 'H4', 'merchant' ), |
| 38 |
'h5' => __( 'H5', 'merchant' ), |
| 39 |
'h6' => __( 'H6', 'merchant' ), |
| 40 |
'div' => __( 'div', 'merchant' ), |
| 41 |
), |
| 42 |
'default' => 'h2', |
| 43 |
), |
| 44 |
|
| 45 |
// Hide Title. |
| 46 |
array( |
| 47 |
'id' => 'hide_title', |
| 48 |
'type' => 'switcher', |
| 49 |
'title' => __( 'Hide title', 'merchant' ), |
| 50 |
'default' => 0, |
| 51 |
), |
| 52 |
|
| 53 |
// Description. |
| 54 |
array( |
| 55 |
'id' => 'description', |
| 56 |
'type' => 'textarea', |
| 57 |
'title' => __( 'Description', 'merchant' ), |
| 58 |
'default' => '', |
| 59 |
), |
| 60 |
|
| 61 |
// Title and Description Alignment. |
| 62 |
array( |
| 63 |
'id' => 'title_desc_align', |
| 64 |
'type' => 'radio', |
| 65 |
'title' => __( 'Title and description alignment', 'merchant' ), |
| 66 |
'options' => array( |
| 67 |
'left' => __( 'Left', 'merchant' ), |
| 68 |
'center' => __( 'Center', 'merchant' ), |
| 69 |
'right' => __( 'Right', 'merchant' ), |
| 70 |
), |
| 71 |
'default' => 'left', |
| 72 |
), |
| 73 |
|
| 74 |
// Default Reviews Sorting. |
| 75 |
array( |
| 76 |
'id' => 'default_sorting', |
| 77 |
'type' => 'select', |
| 78 |
'title' => __( 'Default reviews sorting', 'merchant' ), |
| 79 |
'options' => array( |
| 80 |
'newest' => __( 'Newest', 'merchant' ), |
| 81 |
'oldest' => __( 'Oldest', 'merchant' ), |
| 82 |
'top-rated' => __( 'Top rated', 'merchant' ), |
| 83 |
'low-rated' => __( 'Low rated', 'merchant' ), |
| 84 |
'photo-first' => __( 'Photo first', 'merchant' ), |
| 85 |
), |
| 86 |
'default' => 'newest', |
| 87 |
), |
| 88 |
|
| 89 |
// Pagination Type. |
| 90 |
array( |
| 91 |
'id' => 'pagination_type', |
| 92 |
'type' => 'select', |
| 93 |
'title' => __( 'Pagination type', 'merchant' ), |
| 94 |
'desc' => sprintf( |
| 95 |
/* Translators: 1. Defualt WordPress discussion settings page. */ |
| 96 |
__( 'This option works only if you have pagination for comments enabled. By default, WordPress doesn\'t have pagination enabled for comments/reviews. You can change it from: <a href="%1$s" target="_blank">Settings > Discusson</a>', 'merchant' ), |
| 97 |
admin_url( 'options-discussion.php' ) |
| 98 |
), |
| 99 |
'options' => array( |
| 100 |
'default' => __( 'Default', 'merchant' ), |
| 101 |
'load-more' => __( 'Load more button', 'merchant' ), |
| 102 |
), |
| 103 |
'default' => 'load-more', |
| 104 |
), |
| 105 |
|
| 106 |
// Review options. |
| 107 |
array( |
| 108 |
'id' => 'review_options', |
| 109 |
'type' => 'radio', |
| 110 |
'title' => __( 'Review options', 'merchant' ), |
| 111 |
'options' => array( |
| 112 |
'image_and_text' => __( 'Image and text', 'merchant' ), |
| 113 |
'image' => __( 'Image only', 'merchant' ), |
| 114 |
'text' => __( 'Text only', 'merchant' ), |
| 115 |
), |
| 116 |
'default' => 'image_and_text', |
| 117 |
), |
| 118 |
|
| 119 |
// Photos Upload limit. |
| 120 |
array( |
| 121 |
'id' => 'photos_limit', |
| 122 |
'type' => 'range', |
| 123 |
'title' => __( 'Photos upload limit', 'merchant' ), |
| 124 |
'desc' => __( 'Controls the photos upload limit for a review.', 'merchant' ), |
| 125 |
'min' => 1, |
| 126 |
'max' => '', |
| 127 |
'step' => 1, |
| 128 |
'unit' => '', |
| 129 |
'default' => 6, |
| 130 |
), |
| 131 |
|
| 132 |
// Review images carousel. |
| 133 |
array( |
| 134 |
'id' => 'review_images_carousel', |
| 135 |
'type' => 'switcher', |
| 136 |
'title' => __( 'Review images carousel', 'merchant' ), |
| 137 |
'desc' => __( 'Display the first image from each review in a carousel to engage shoppers and help their decision-making process.', 'merchant' ), |
| 138 |
'default' => 0, |
| 139 |
), |
| 140 |
|
| 141 |
// Number of Images per page. |
| 142 |
array( |
| 143 |
'id' => 'review_images_carousel_total', |
| 144 |
'type' => 'range', |
| 145 |
'title' => __( 'Total images', 'merchant' ), |
| 146 |
'desc' => __( 'Controls the total number of images to be displayed in the slider.', 'merchant' ), |
| 147 |
'min' => 1, |
| 148 |
'step' => 1, |
| 149 |
'unit' => '', |
| 150 |
'default' => 12, |
| 151 |
'condition' => array( 'review_images_carousel', '==', '1' ), |
| 152 |
), |
| 153 |
|
| 154 |
// Number of Columns. |
| 155 |
array( |
| 156 |
'id' => 'review_images_carousel_per_page', |
| 157 |
'type' => 'range', |
| 158 |
'title' => __( 'Columns', 'merchant' ), |
| 159 |
'desc' => __( 'Controls the number of images to be displayed per slide.', 'merchant' ), |
| 160 |
'min' => 1, |
| 161 |
'max' => 6, |
| 162 |
'step' => 1, |
| 163 |
'unit' => '', |
| 164 |
'default' => 3, |
| 165 |
'condition' => array( 'review_images_carousel', '==', '1' ), |
| 166 |
), |
| 167 |
|
| 168 |
// Carousel Title. |
| 169 |
array( |
| 170 |
'id' => 'carousel_title', |
| 171 |
'type' => 'text', |
| 172 |
'title' => __( 'Carousel Title', 'merchant' ), |
| 173 |
'default' => __( 'Review images', 'merchant' ), |
| 174 |
), |
| 175 |
|
| 176 |
// Hook Order. |
| 177 |
array( |
| 178 |
'id' => 'hook_order', |
| 179 |
'type' => 'range', |
| 180 |
'title' => __( 'Hook order', 'merchant' ), |
| 181 |
'desc' => __( 'Controls the display position for the entire advanced reviews section. Lower values will move the section towards the top, while higher values will move the section towards the bottom.', 'merchant' ), |
| 182 |
'min' => 1, |
| 183 |
'max' => 100, |
| 184 |
'step' => 1, |
| 185 |
'unit' => '', |
| 186 |
'default' => 10, |
| 187 |
), |
| 188 |
|
| 189 |
/** |
| 190 |
* Styles |
| 191 |
* |
| 192 |
*/ |
| 193 |
|
| 194 |
// Title color. |
| 195 |
array( |
| 196 |
'id' => 'title_color', |
| 197 |
'type' => 'color', |
| 198 |
'title' => __( 'Title color', 'merchant' ), |
| 199 |
'default' => '#212121', |
| 200 |
), |
| 201 |
|
| 202 |
// Description color. |
| 203 |
array( |
| 204 |
'id' => 'description_color', |
| 205 |
'type' => 'color', |
| 206 |
'title' => __( 'Description color', 'merchant' ), |
| 207 |
'default' => '#777', |
| 208 |
), |
| 209 |
|
| 210 |
// Stars color. |
| 211 |
array( |
| 212 |
'id' => 'stars_color', |
| 213 |
'type' => 'color', |
| 214 |
'title' => __( 'Stars color', 'merchant' ), |
| 215 |
'default' => '#FFA441', |
| 216 |
), |
| 217 |
|
| 218 |
// Stars background color. |
| 219 |
array( |
| 220 |
'id' => 'stars_background_color', |
| 221 |
'type' => 'color', |
| 222 |
'title' => __( 'Stars background color', 'merchant' ), |
| 223 |
'default' => '#757575', |
| 224 |
), |
| 225 |
|
| 226 |
// Progress bar color. |
| 227 |
array( |
| 228 |
'id' => 'progress_bar_color', |
| 229 |
'type' => 'color', |
| 230 |
'title' => __( 'Progress bar color', 'merchant' ), |
| 231 |
'default' => '#212121', |
| 232 |
), |
| 233 |
|
| 234 |
// Progress bar background color. |
| 235 |
array( |
| 236 |
'id' => 'progress_bar_bg_color', |
| 237 |
'type' => 'color', |
| 238 |
'title' => __( 'Progress bar background color', 'merchant' ), |
| 239 |
'default' => '#F5F5F5', |
| 240 |
), |
| 241 |
|
| 242 |
// Dividers color. |
| 243 |
array( |
| 244 |
'id' => 'dividers_color', |
| 245 |
'type' => 'color', |
| 246 |
'title' => __( 'Dividers color', 'merchant' ), |
| 247 |
'default' => '#e9e9e9', |
| 248 |
), |
| 249 |
|
| 250 |
// Button color. |
| 251 |
array( |
| 252 |
'id' => 'button_color', |
| 253 |
'type' => 'color', |
| 254 |
'title' => __( 'Button color', 'merchant' ), |
| 255 |
'default' => '#FFF', |
| 256 |
), |
| 257 |
|
| 258 |
// Button color (hover). |
| 259 |
array( |
| 260 |
'id' => 'button_color_hover', |
| 261 |
'type' => 'color', |
| 262 |
'title' => __( 'Button color (hover)', 'merchant' ), |
| 263 |
'default' => '#FFF', |
| 264 |
), |
| 265 |
|
| 266 |
// Button background color. |
| 267 |
array( |
| 268 |
'id' => 'button_bg_color', |
| 269 |
'type' => 'color', |
| 270 |
'title' => __( 'Button background color', 'merchant' ), |
| 271 |
'default' => '#212121', |
| 272 |
), |
| 273 |
|
| 274 |
// Button background color (hover). |
| 275 |
array( |
| 276 |
'id' => 'button_bg_color_hover', |
| 277 |
'type' => 'color', |
| 278 |
'title' => __( 'Button background color (hover)', 'merchant' ), |
| 279 |
'default' => '#757575', |
| 280 |
), |
| 281 |
|
| 282 |
), |
| 283 |
) |
| 284 |
); |
| 285 |
|
| 286 |
// Modal Settings |
| 287 |
Merchant_Admin_Options::create( |
| 288 |
array( |
| 289 |
'title' => __( 'Modal Settings', 'merchant' ), |
| 290 |
'module' => Merchant_Advanced_Reviews::MODULE_ID, |
| 291 |
'fields' => array( |
| 292 |
|
| 293 |
/** |
| 294 |
* Styles |
| 295 |
* |
| 296 |
*/ |
| 297 |
|
| 298 |
// Modal Close icon color. |
| 299 |
array( |
| 300 |
'id' => 'modal_close_icon_color', |
| 301 |
'type' => 'color', |
| 302 |
'title' => __( 'Close icon color', 'merchant' ), |
| 303 |
'default' => '#757575', |
| 304 |
), |
| 305 |
|
| 306 |
// Modal Close icon color (hover). |
| 307 |
array( |
| 308 |
'id' => 'modal_close_icon_color_hover', |
| 309 |
'type' => 'color', |
| 310 |
'title' => __( 'Close icon color (hover)', 'merchant' ), |
| 311 |
'default' => '#212121', |
| 312 |
), |
| 313 |
|
| 314 |
// Modal Title color. |
| 315 |
array( |
| 316 |
'id' => 'modal_title_color', |
| 317 |
'type' => 'color', |
| 318 |
'title' => __( 'Title color', 'merchant' ), |
| 319 |
'default' => '#212121', |
| 320 |
), |
| 321 |
|
| 322 |
// Modal Description color. |
| 323 |
array( |
| 324 |
'id' => 'modal_description_color', |
| 325 |
'type' => 'color', |
| 326 |
'title' => __( 'Description color', 'merchant' ), |
| 327 |
'default' => '#777', |
| 328 |
), |
| 329 |
|
| 330 |
// Modal Textarea color. |
| 331 |
array( |
| 332 |
'id' => 'modal_textarea_color', |
| 333 |
'type' => 'color', |
| 334 |
'title' => __( 'Textarea color', 'merchant' ), |
| 335 |
'default' => '#777', |
| 336 |
), |
| 337 |
|
| 338 |
// Modal Textarea background color. |
| 339 |
array( |
| 340 |
'id' => 'modal_textarea_background_color', |
| 341 |
'type' => 'color', |
| 342 |
'title' => __( 'Textarea background color', 'merchant' ), |
| 343 |
'default' => '#FFF', |
| 344 |
), |
| 345 |
|
| 346 |
// Modal background color. |
| 347 |
array( |
| 348 |
'id' => 'modal_background_color', |
| 349 |
'type' => 'color', |
| 350 |
'title' => __( 'Modal background color', 'merchant' ), |
| 351 |
'default' => '#F5F5F5', |
| 352 |
), |
| 353 |
|
| 354 |
), |
| 355 |
) |
| 356 |
); |
| 357 |
|
| 358 |
// Shortcode |
| 359 |
$merchant_module_id = Merchant_Advanced_Reviews::MODULE_ID; |
| 360 |
Merchant_Admin_Options::create( |
| 361 |
array( |
| 362 |
'module' => $merchant_module_id, |
| 363 |
'title' => esc_html__( 'Use shortcode', 'merchant' ), |
| 364 |
'fields' => array( |
| 365 |
array( |
| 366 |
'id' => 'use_shortcode', |
| 367 |
'type' => 'switcher', |
| 368 |
'title' => __( 'Use shortcode', 'merchant' ), |
| 369 |
'default' => 0, |
| 370 |
), |
| 371 |
array( |
| 372 |
'type' => 'info', |
| 373 |
'id' => 'shortcode_info', |
| 374 |
'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. Note that the shortcodes can only be used on single product pages.', 'merchant' ), |
| 375 |
), |
| 376 |
array( |
| 377 |
'id' => 'shortcode_text', |
| 378 |
'type' => 'text_readonly', |
| 379 |
'title' => esc_html__( 'Shortcode text', 'merchant' ), |
| 380 |
'default' => '[merchant_module_' . str_replace( '-', '_', $merchant_module_id ) . ']', |
| 381 |
'condition' => array( 'use_shortcode', '==', '1' ), |
| 382 |
), |
| 383 |
), |
| 384 |
) |
| 385 |
); |
| 386 |
|