| 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( array( |
| 15 |
'title' => __( 'Settings', 'merchant' ), |
| 16 |
'module' => Merchant_Advanced_Reviews::MODULE_ID, |
| 17 |
'fields' => array( |
| 18 |
|
| 19 |
// Title. |
| 20 |
array( |
| 21 |
'id' => 'title', |
| 22 |
'type' => 'text', |
| 23 |
'title' => __( 'Title', 'merchant' ), |
| 24 |
'default' => __( 'What our customers are saying', 'merchant' ) |
| 25 |
), |
| 26 |
|
| 27 |
// Title HTML Tag. |
| 28 |
array( |
| 29 |
'id' => 'title_tag', |
| 30 |
'type' => 'select', |
| 31 |
'title' => __( 'Title HTML tag', 'merchant' ), |
| 32 |
'options' => array( |
| 33 |
'h1' => __( 'H1', 'merchant' ), |
| 34 |
'h2' => __( 'H2', 'merchant' ), |
| 35 |
'h3' => __( 'H3', 'merchant' ), |
| 36 |
'h4' => __( 'H4', 'merchant' ), |
| 37 |
'h5' => __( 'H5', 'merchant' ), |
| 38 |
'h6' => __( 'H6', 'merchant' ), |
| 39 |
'div' => __( 'div', 'merchant' ) |
| 40 |
), |
| 41 |
'default' => 'h2' |
| 42 |
), |
| 43 |
|
| 44 |
// Hide Title. |
| 45 |
array( |
| 46 |
'id' => 'hide_title', |
| 47 |
'type' => 'switcher', |
| 48 |
'title' => __( 'Hide title', 'merchant' ), |
| 49 |
'default' => 0 |
| 50 |
), |
| 51 |
|
| 52 |
// Description. |
| 53 |
array( |
| 54 |
'id' => 'description', |
| 55 |
'type' => 'textarea', |
| 56 |
'title' => __( 'Description', 'merchant' ), |
| 57 |
'default' => '' |
| 58 |
), |
| 59 |
|
| 60 |
// Title and Description Alignment. |
| 61 |
array( |
| 62 |
'id' => 'title_desc_align', |
| 63 |
'type' => 'radio', |
| 64 |
'title' => __( 'Title and description alignment', 'merchant' ), |
| 65 |
'options' => array( |
| 66 |
'left' => __( 'Left', 'merchant' ), |
| 67 |
'center' => __( 'Center', 'merchant' ), |
| 68 |
'right' => __( 'Right', 'merchant' ) |
| 69 |
), |
| 70 |
'default' => 'left' |
| 71 |
), |
| 72 |
|
| 73 |
// Default Reviews Sorting. |
| 74 |
array( |
| 75 |
'id' => 'default_sorting', |
| 76 |
'type' => 'select', |
| 77 |
'title' => __( 'Default reviews sorting', 'merchant' ), |
| 78 |
'options' => array( |
| 79 |
'newest' => __( 'Newest', 'merchant' ), |
| 80 |
'oldest' => __( 'Oldest', 'merchant' ), |
| 81 |
'top-rated' => __( 'Top rated', 'merchant' ), |
| 82 |
'low-rated' => __( 'Low rated', 'merchant' ) |
| 83 |
), |
| 84 |
'default' => 'newest' |
| 85 |
), |
| 86 |
|
| 87 |
// Pagination Type. |
| 88 |
array( |
| 89 |
'id' => 'pagination_type', |
| 90 |
'type' => 'select', |
| 91 |
'title' => __( 'Pagination type', 'merchant' ), |
| 92 |
'desc' => sprintf( |
| 93 |
|
| 94 |
/* Translators: 1. Defualt WordPress discussion settings page. */ |
| 95 |
__( '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' ), |
| 96 |
admin_url( 'options-discussion.php' ) |
| 97 |
), |
| 98 |
'options' => array( |
| 99 |
'default' => __( 'Default', 'merchant' ), |
| 100 |
'load-more' => __( 'Load more button', 'merchant' ) |
| 101 |
), |
| 102 |
'default' => 'default' |
| 103 |
), |
| 104 |
|
| 105 |
// Hook Order. |
| 106 |
array( |
| 107 |
'id' => 'hook_order', |
| 108 |
'type' => 'range', |
| 109 |
'title' => __( 'Hook order', 'merchant' ), |
| 110 |
'desc' => __( 'Controls the display order from the entire advanced reviews section. Low values will move the section to top. High values will move the section to bottom.', 'merchant' ), |
| 111 |
'min' => 1, |
| 112 |
'max' => 100, |
| 113 |
'step' => 1, |
| 114 |
'unit' => '', |
| 115 |
'default' => 10 |
| 116 |
), |
| 117 |
|
| 118 |
|
| 119 |
/** |
| 120 |
* Styles |
| 121 |
* |
| 122 |
*/ |
| 123 |
|
| 124 |
// Title color. |
| 125 |
array( |
| 126 |
'id' => 'title_color', |
| 127 |
'type' => 'color', |
| 128 |
'title' => __( 'Title color', 'merchant' ), |
| 129 |
'default' => '#212121' |
| 130 |
), |
| 131 |
|
| 132 |
// Description color. |
| 133 |
array( |
| 134 |
'id' => 'description_color', |
| 135 |
'type' => 'color', |
| 136 |
'title' => __( 'Description color', 'merchant' ), |
| 137 |
'default' => '#777' |
| 138 |
), |
| 139 |
|
| 140 |
// Stars color. |
| 141 |
array( |
| 142 |
'id' => 'stars_color', |
| 143 |
'type' => 'color', |
| 144 |
'title' => __( 'Stars color', 'merchant' ), |
| 145 |
'default' => '#FFA441' |
| 146 |
), |
| 147 |
|
| 148 |
// Stars background color. |
| 149 |
array( |
| 150 |
'id' => 'stars_background_color', |
| 151 |
'type' => 'color', |
| 152 |
'title' => __( 'Stars background color', 'merchant' ), |
| 153 |
'default' => '#757575' |
| 154 |
), |
| 155 |
|
| 156 |
// Progress bar color. |
| 157 |
array( |
| 158 |
'id' => 'progress_bar_color', |
| 159 |
'type' => 'color', |
| 160 |
'title' => __( 'Progress bar color', 'merchant' ), |
| 161 |
'default' => '#212121' |
| 162 |
), |
| 163 |
|
| 164 |
// Progress bar background color. |
| 165 |
array( |
| 166 |
'id' => 'progress_bar_bg_color', |
| 167 |
'type' => 'color', |
| 168 |
'title' => __( 'Progress bar background color', 'merchant' ), |
| 169 |
'default' => '#F5F5F5' |
| 170 |
), |
| 171 |
|
| 172 |
// Dividers color. |
| 173 |
array( |
| 174 |
'id' => 'dividers_color', |
| 175 |
'type' => 'color', |
| 176 |
'title' => __( 'Dividers color', 'merchant' ), |
| 177 |
'default' => '#e9e9e9' |
| 178 |
), |
| 179 |
|
| 180 |
// Button color. |
| 181 |
array( |
| 182 |
'id' => 'button_color', |
| 183 |
'type' => 'color', |
| 184 |
'title' => __( 'Button color', 'merchant' ), |
| 185 |
'default' => '#FFF' |
| 186 |
), |
| 187 |
|
| 188 |
// Button color (hover). |
| 189 |
array( |
| 190 |
'id' => 'button_color_hover', |
| 191 |
'type' => 'color', |
| 192 |
'title' => __( 'Button color (hover)', 'merchant' ), |
| 193 |
'default' => '#FFF' |
| 194 |
), |
| 195 |
|
| 196 |
// Button background color. |
| 197 |
array( |
| 198 |
'id' => 'button_bg_color', |
| 199 |
'type' => 'color', |
| 200 |
'title' => __( 'Button background color', 'merchant' ), |
| 201 |
'default' => '#212121' |
| 202 |
), |
| 203 |
|
| 204 |
// Button background color (hover). |
| 205 |
array( |
| 206 |
'id' => 'button_bg_color_hover', |
| 207 |
'type' => 'color', |
| 208 |
'title' => __( 'Button background color (hover)', 'merchant' ), |
| 209 |
'default' => '#757575' |
| 210 |
) |
| 211 |
|
| 212 |
) |
| 213 |
) ); |
| 214 |
|
| 215 |
// Modal Settings |
| 216 |
Merchant_Admin_Options::create( array( |
| 217 |
'title' => __( 'Modal Settings', 'merchant' ), |
| 218 |
'module' => Merchant_Advanced_Reviews::MODULE_ID, |
| 219 |
'fields' => array( |
| 220 |
|
| 221 |
/** |
| 222 |
* Styles |
| 223 |
* |
| 224 |
*/ |
| 225 |
|
| 226 |
// Modal Close icon color. |
| 227 |
array( |
| 228 |
'id' => 'modal_close_icon_color', |
| 229 |
'type' => 'color', |
| 230 |
'title' => __( 'Close icon color', 'merchant' ), |
| 231 |
'default' => '#757575' |
| 232 |
), |
| 233 |
|
| 234 |
// Modal Close icon color (hover). |
| 235 |
array( |
| 236 |
'id' => 'modal_close_icon_color_hover', |
| 237 |
'type' => 'color', |
| 238 |
'title' => __( 'Close icon color (hover)', 'merchant' ), |
| 239 |
'default' => '#212121' |
| 240 |
), |
| 241 |
|
| 242 |
// Modal Title color. |
| 243 |
array( |
| 244 |
'id' => 'modal_title_color', |
| 245 |
'type' => 'color', |
| 246 |
'title' => __( 'Title color', 'merchant' ), |
| 247 |
'default' => '#212121' |
| 248 |
), |
| 249 |
|
| 250 |
// Modal Description color. |
| 251 |
array( |
| 252 |
'id' => 'modal_description_color', |
| 253 |
'type' => 'color', |
| 254 |
'title' => __( 'Description color', 'merchant' ), |
| 255 |
'default' => '#777' |
| 256 |
), |
| 257 |
|
| 258 |
// Modal Textarea color. |
| 259 |
array( |
| 260 |
'id' => 'modal_textarea_color', |
| 261 |
'type' => 'color', |
| 262 |
'title' => __( 'Textarea color', 'merchant' ), |
| 263 |
'default' => '#777' |
| 264 |
), |
| 265 |
|
| 266 |
// Modal Textarea background color. |
| 267 |
array( |
| 268 |
'id' => 'modal_textarea_background_color', |
| 269 |
'type' => 'color', |
| 270 |
'title' => __( 'Textarea background color', 'merchant' ), |
| 271 |
'default' => '#FFF' |
| 272 |
), |
| 273 |
|
| 274 |
// Modal background color. |
| 275 |
array( |
| 276 |
'id' => 'modal_background_color', |
| 277 |
'type' => 'color', |
| 278 |
'title' => __( 'Modal background color', 'merchant' ), |
| 279 |
'default' => '#F5F5F5' |
| 280 |
) |
| 281 |
|
| 282 |
) |
| 283 |
) ); |
| 284 |
|
| 285 |
// Shortcode |
| 286 |
$merchant_module_id = Merchant_Advanced_Reviews::MODULE_ID; |
| 287 |
Merchant_Admin_Options::create( array( |
| 288 |
'module' => $merchant_module_id, |
| 289 |
'title' => esc_html__( 'Use shortcode', 'merchant' ), |
| 290 |
'fields' => array( |
| 291 |
array( |
| 292 |
'id' => 'use_shortcode', |
| 293 |
'type' => 'switcher', |
| 294 |
'title' => __( 'Use shortcode', 'merchant' ), |
| 295 |
'default' => 0, |
| 296 |
'desc' => 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.', |
| 297 |
'merchant' ), |
| 298 |
), |
| 299 |
array( |
| 300 |
'id' => 'shortcode_text', |
| 301 |
'type' => 'text_readonly', |
| 302 |
'title' => esc_html__( 'Shortcode text', 'merchant' ), |
| 303 |
'default' => '[merchant_module_' . str_replace( '-', '_', $merchant_module_id ) . ']', |
| 304 |
'condition' => array( 'use_shortcode', '==', '1' ), |
| 305 |
), |
| 306 |
), |
| 307 |
) ); |