| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* Cart Reserved Timer Options. |
| 5 |
* |
| 6 |
* @package Merchant |
| 7 |
*/ |
| 8 |
|
| 9 |
if ( ! defined( 'ABSPATH' ) ) { |
| 10 |
exit; // Exit if accessed directly |
| 11 |
} |
| 12 |
|
| 13 |
Merchant_Admin_Options::create( array( |
| 14 |
'title' => esc_html__( 'Settings', 'merchant' ), |
| 15 |
'module' => Merchant_Countdown_Timer::MODULE_ID, |
| 16 |
'fields' => array( |
| 17 |
array( |
| 18 |
'id' => 'end_date', |
| 19 |
'type' => 'select', |
| 20 |
'title' => esc_html__( 'Countdown timer end date', 'merchant' ), |
| 21 |
'options' => array( |
| 22 |
'evergreen' => esc_html__( 'Evergreen', 'merchant' ), |
| 23 |
'sale-dates' => esc_html__( 'Sale price dates', 'merchant' ), |
| 24 |
), |
| 25 |
'default' => 'sale-dates', |
| 26 |
'desc' => esc_html__( '"Sale Price Dates" will countdown to a specified end-date and time. "Evergreen" generates a unique expiration date for each visitor and product, within set minimum and maximum deadlines', |
| 27 |
'merchant' ), |
| 28 |
), |
| 29 |
|
| 30 |
array( |
| 31 |
'id' => 'sale_start_date', |
| 32 |
'type' => 'date_time', |
| 33 |
'title' => esc_html__( 'Countdown starts at', 'merchant' ), |
| 34 |
'placeholder' => esc_html__( 'mm/dd/yy, --:-- --', 'merchant' ), |
| 35 |
'condition' => array( 'end_date', '==', 'sale-dates' ), |
| 36 |
), |
| 37 |
|
| 38 |
array( |
| 39 |
'id' => 'sale_end_date', |
| 40 |
'type' => 'date_time', |
| 41 |
'title' => esc_html__( 'Countdown ends at', 'merchant' ), |
| 42 |
'placeholder' => esc_html__( 'mm/dd/yy, --:-- --', 'merchant' ), |
| 43 |
'condition' => array( 'end_date', '==', 'sale-dates' ), |
| 44 |
'desc' => sprintf( |
| 45 |
/* Translators: %1$s: Time zone, %2$s WordPress setting link */ |
| 46 |
esc_html__( 'The countdown bar will only be displayed during this range. The times set above are in the %1$s timezone, according to your settings from %2$s.', |
| 47 |
'merchant' ), |
| 48 |
'<strong>' . wp_timezone_string() . '</strong>', |
| 49 |
'<a href="' . esc_url( admin_url( 'options-general.php' ) ) . '" target="_blank">' . esc_html__( 'WordPress Settings', 'merchant' ) . '</a>' |
| 50 |
), |
| 51 |
), |
| 52 |
|
| 53 |
array( |
| 54 |
'id' => 'cool_off_period', |
| 55 |
'type' => 'number', |
| 56 |
'title' => esc_html__( 'Cool off period (minutes)', 'merchant' ), |
| 57 |
'default' => 15, |
| 58 |
'desc' => esc_html__( 'Once the cool off period expires, the countdown timer will be shown again (individually for each customer on each product page).', |
| 59 |
'merchant' ), |
| 60 |
'condition' => array( 'end_date', '==', 'evergreen' ), |
| 61 |
), |
| 62 |
|
| 63 |
// Minimum |
| 64 |
array( |
| 65 |
'id' => 'min_expiration_deadline_label', |
| 66 |
'type' => 'content', |
| 67 |
'title' => esc_html__( 'Minimum expiration deadline', 'merchant' ), |
| 68 |
'content' => '', |
| 69 |
'desc' => esc_html__( 'Sets the time before the end date (set by the Maximum expiration deadline option) when the timer will disappear.', 'merchant' ), |
| 70 |
'class' => 'merchant-countdown-evergreen-content-field', |
| 71 |
'condition' => array( 'end_date', '==', 'evergreen' ), |
| 72 |
), |
| 73 |
array( |
| 74 |
'id' => 'min_expiration_deadline_days', |
| 75 |
'type' => 'number', |
| 76 |
'title' => esc_html__( 'Days', 'merchant' ), |
| 77 |
'default' => 0, |
| 78 |
'min' => 0, |
| 79 |
'step' => 1, |
| 80 |
'placeholder' => esc_html__( 'Days', 'merchant' ), |
| 81 |
'class' => 'merchant-countdown-evergreen-field', |
| 82 |
'condition' => array( 'end_date', '==', 'evergreen' ), |
| 83 |
), |
| 84 |
array( |
| 85 |
'id' => 'min_expiration_deadline', |
| 86 |
'type' => 'number', |
| 87 |
'title' => esc_html__( 'Hours', 'merchant' ), |
| 88 |
'default' => 2, |
| 89 |
'min' => 0, |
| 90 |
'step' => 1, |
| 91 |
'placeholder' => esc_html__( 'Hours', 'merchant' ), |
| 92 |
'class' => 'merchant-countdown-evergreen-field', |
| 93 |
'condition' => array( 'end_date', '==', 'evergreen' ), |
| 94 |
), |
| 95 |
array( |
| 96 |
'id' => 'min_expiration_deadline_minutes', |
| 97 |
'type' => 'number', |
| 98 |
'title' => esc_html__( 'Minutes', 'merchant' ), |
| 99 |
'default' => 0, |
| 100 |
'min' => 0, |
| 101 |
'step' => 1, |
| 102 |
'placeholder' => esc_html__( 'Minutes', 'merchant' ), |
| 103 |
'class' => 'merchant-countdown-evergreen-field', |
| 104 |
'condition' => array( 'end_date', '==', 'evergreen' ), |
| 105 |
), |
| 106 |
|
| 107 |
// Maximum |
| 108 |
array( |
| 109 |
'id' => 'max_expiration_deadline_label', |
| 110 |
'type' => 'content', |
| 111 |
'title' => esc_html__( 'Maximum expiration deadline', 'merchant' ), |
| 112 |
'content' => '', |
| 113 |
'desc' => esc_html__( 'Defines the final countdown end date, when the timer hits 00:00:00.', 'merchant' ), |
| 114 |
'class' => 'merchant-countdown-evergreen-content-field', |
| 115 |
'condition' => array( 'end_date', '==', 'evergreen' ), |
| 116 |
), |
| 117 |
array( |
| 118 |
'id' => 'max_expiration_deadline_days', |
| 119 |
'type' => 'number', |
| 120 |
'title' => esc_html__( 'Days', 'merchant' ), |
| 121 |
'default' => 0, |
| 122 |
'min' => 0, |
| 123 |
'step' => 1, |
| 124 |
'placeholder' => esc_html__( 'Days', 'merchant' ), |
| 125 |
'class' => 'merchant-countdown-evergreen-field', |
| 126 |
'condition' => array( 'end_date', '==', 'evergreen' ), |
| 127 |
), |
| 128 |
array( |
| 129 |
'id' => 'max_expiration_deadline', |
| 130 |
'type' => 'number', |
| 131 |
'title' => esc_html__( 'Hours', 'merchant' ), |
| 132 |
'default' => 26, |
| 133 |
'min' => 0, |
| 134 |
'step' => 1, |
| 135 |
'placeholder' => esc_html__( 'Hours', 'merchant' ), |
| 136 |
'class' => 'merchant-countdown-evergreen-field', |
| 137 |
'condition' => array( 'end_date', '==', 'evergreen' ), |
| 138 |
), |
| 139 |
array( |
| 140 |
'id' => 'max_expiration_deadline_minutes', |
| 141 |
'type' => 'number', |
| 142 |
'title' => esc_html__( 'Minutes', 'merchant' ), |
| 143 |
'min' => 0, |
| 144 |
'step' => 1, |
| 145 |
'placeholder' => esc_html__( 'Minutes', 'merchant' ), |
| 146 |
'class' => 'merchant-countdown-evergreen-field', |
| 147 |
'condition' => array( 'end_date', '==', 'evergreen' ), |
| 148 |
), |
| 149 |
), |
| 150 |
) ); |
| 151 |
|
| 152 |
// Display Settings |
| 153 |
Merchant_Admin_Options::create( array( |
| 154 |
'module' => Merchant_Countdown_Timer::MODULE_ID, |
| 155 |
'title' => esc_html__( 'Display Settings', 'merchant' ), |
| 156 |
'fields' => array( |
| 157 |
array( |
| 158 |
'id' => 'discount_products_only', |
| 159 |
'type' => 'switcher', |
| 160 |
'title' => esc_html__( 'Display on discounted products only', 'merchant' ), |
| 161 |
'desc' => esc_html__( 'Enable this to only show the countdown timer on discounted products.', 'merchant' ), |
| 162 |
'default' => true, |
| 163 |
), |
| 164 |
|
| 165 |
array( |
| 166 |
'id' => 'theme', |
| 167 |
'type' => 'image_picker', |
| 168 |
'title' => esc_html__( 'Select layout', 'merchant' ), |
| 169 |
'options' => array( |
| 170 |
'classic' => array( |
| 171 |
'image' => MERCHANT_URI . 'assets/images/icons/countdown-timer/admin/classic.png', |
| 172 |
'title' => esc_html__( 'Classic', 'merchant' ), |
| 173 |
), |
| 174 |
'progress' => array( |
| 175 |
'image' => MERCHANT_URI . 'assets/images/icons/countdown-timer/admin/progress.png', |
| 176 |
'title' => esc_html__( 'Progress bar', 'merchant' ), |
| 177 |
), |
| 178 |
'circles' => array( |
| 179 |
'image' => MERCHANT_URI . 'assets/images/icons/countdown-timer/admin/circles.png', |
| 180 |
'title' => esc_html__( 'Circles', 'merchant' ), |
| 181 |
), |
| 182 |
'squares' => array( |
| 183 |
'image' => MERCHANT_URI . 'assets/images/icons/countdown-timer/admin/squares.png', |
| 184 |
'title' => esc_html__( 'Squares', 'merchant' ), |
| 185 |
), |
| 186 |
'minimalist' => array( |
| 187 |
'image' => MERCHANT_URI . 'assets/images/icons/countdown-timer/admin/minimalist.png', |
| 188 |
'title' => esc_html__( 'Minimalist', 'merchant' ), |
| 189 |
), |
| 190 |
'cards' => array( |
| 191 |
'image' => MERCHANT_URI . 'assets/images/icons/countdown-timer/admin/cards.png', |
| 192 |
'title' => esc_html__( 'Cards', 'merchant' ), |
| 193 |
), |
| 194 |
'modern' => array( |
| 195 |
'image' => MERCHANT_URI . 'assets/images/icons/countdown-timer/admin/modern.png', |
| 196 |
'title' => esc_html__( 'modern', 'merchant' ), |
| 197 |
), |
| 198 |
), |
| 199 |
'default' => 'classic', |
| 200 |
), |
| 201 |
|
| 202 |
array( |
| 203 |
'id' => 'sale_ending_text', |
| 204 |
'type' => 'text', |
| 205 |
'title' => esc_html__( 'Sale ending message', 'merchant' ), |
| 206 |
'default' => esc_html__( 'Sale ends in', 'merchant' ), |
| 207 |
'desc' => esc_html__( 'The message that shows up above the countdown timer.', 'merchant' ), |
| 208 |
), |
| 209 |
|
| 210 |
array( |
| 211 |
'id' => 'sale_ending_alignment', |
| 212 |
'type' => 'select', |
| 213 |
'title' => esc_html__( 'Align', 'merchant' ), |
| 214 |
'options' => array( |
| 215 |
'left' => esc_html__( 'Left', 'merchant' ), |
| 216 |
'center' => esc_html__( 'Center', 'merchant' ), |
| 217 |
'right' => esc_html__( 'Right', 'merchant' ), |
| 218 |
), |
| 219 |
'default' => 'left', |
| 220 |
), |
| 221 |
), |
| 222 |
) ); |
| 223 |
|
| 224 |
Merchant_Admin_Options::create( array( |
| 225 |
'title' => esc_html__( 'Look and Feel', 'merchant' ), |
| 226 |
'module' => Merchant_Countdown_Timer::MODULE_ID, |
| 227 |
'fields' => array( |
| 228 |
array( |
| 229 |
'id' => 'digits_font_size', |
| 230 |
'type' => 'range', |
| 231 |
'title' => esc_html__( 'Digits\' font size', 'merchant' ), |
| 232 |
'min' => 1, |
| 233 |
'max' => 100, |
| 234 |
'step' => 1, |
| 235 |
'default' => 16, |
| 236 |
'unit' => 'px', |
| 237 |
), |
| 238 |
|
| 239 |
array( |
| 240 |
'id' => 'labels_font_size', |
| 241 |
'type' => 'range', |
| 242 |
'title' => esc_html__( 'Label font size', 'merchant' ), |
| 243 |
'min' => 1, |
| 244 |
'max' => 100, |
| 245 |
'step' => 1, |
| 246 |
'default' => 16, |
| 247 |
'unit' => 'px', |
| 248 |
'condition' => array( 'theme', 'any', 'minimalist|cards|modern|squares|circles' ), |
| 249 |
), |
| 250 |
|
| 251 |
array( |
| 252 |
'id' => 'icon_color', |
| 253 |
'type' => 'color', |
| 254 |
'title' => esc_html__( 'Icon color', 'merchant' ), |
| 255 |
'default' => '#626262', |
| 256 |
'condition' => array( 'theme', '=', 'classic' ), |
| 257 |
), |
| 258 |
|
| 259 |
array( |
| 260 |
'id' => 'sale_ending_color', |
| 261 |
'type' => 'color', |
| 262 |
'title' => esc_html__( 'Sale ending message text color', 'merchant' ), |
| 263 |
'default' => '#626262', |
| 264 |
'condition' => array( 'theme', 'any', 'classic|progress' ), |
| 265 |
), |
| 266 |
|
| 267 |
array( |
| 268 |
'id' => 'digits_color', |
| 269 |
'type' => 'color', |
| 270 |
'title' => esc_html__( 'Digits\' color', 'merchant' ), |
| 271 |
'default' => '#444444', |
| 272 |
), |
| 273 |
|
| 274 |
array( |
| 275 |
'id' => 'labels_color', |
| 276 |
'type' => 'color', |
| 277 |
'title' => esc_html__( 'Label color', 'merchant' ), |
| 278 |
'default' => '#444444', |
| 279 |
'condition' => array( 'theme', 'any', 'minimalist|cards|modern|squares|circles' ), |
| 280 |
), |
| 281 |
|
| 282 |
array( |
| 283 |
'id' => 'digits_background', |
| 284 |
'type' => 'color', |
| 285 |
'title' => esc_html__( 'Digit background color', 'merchant' ), |
| 286 |
'default' => '#fff', |
| 287 |
'condition' => array( 'theme', 'any', 'minimalist|cards|modern|squares|circles' ), |
| 288 |
), |
| 289 |
|
| 290 |
array( |
| 291 |
'id' => 'digits_border', |
| 292 |
'type' => 'color', |
| 293 |
'title' => esc_html__( 'Border color', 'merchant' ), |
| 294 |
'default' => '#444', |
| 295 |
'condition' => array( 'theme', 'any', 'squares|circles' ), |
| 296 |
), |
| 297 |
|
| 298 |
array( |
| 299 |
'id' => 'progress_color', |
| 300 |
'type' => 'color', |
| 301 |
'title' => esc_html__( 'Progress Bar color', 'merchant' ), |
| 302 |
'default' => '#3858E9', |
| 303 |
'condition' => array( 'theme', 'any', 'progress|circles' ), |
| 304 |
), |
| 305 |
|
| 306 |
array( |
| 307 |
'id' => 'digits_width', |
| 308 |
'type' => 'range', |
| 309 |
'title' => esc_html__( 'Width', 'merchant' ), |
| 310 |
'min' => 1, |
| 311 |
'max' => 250, |
| 312 |
'step' => 1, |
| 313 |
'default' => 80, |
| 314 |
'unit' => 'px', |
| 315 |
'condition' => array( 'theme', 'any', 'minimalist|cards|modern|squares|circles' ), |
| 316 |
), |
| 317 |
|
| 318 |
array( |
| 319 |
'id' => 'digits_height', |
| 320 |
'type' => 'range', |
| 321 |
'title' => esc_html__( 'Height', 'merchant' ), |
| 322 |
'min' => 1, |
| 323 |
'max' => 250, |
| 324 |
'step' => 1, |
| 325 |
'default' => 80, |
| 326 |
'unit' => 'px', |
| 327 |
'condition' => array( 'theme', 'any', 'minimalist|cards|modern|squares|circles' ), |
| 328 |
), |
| 329 |
), |
| 330 |
) ); |
| 331 |
|