| 1 |
<?php |
| 2 |
if ( ! defined( "ABSPATH" ) ) exit; |
| 3 |
class wpda_countdown_popup_page{ |
| 4 |
|
| 5 |
private $options; |
| 6 |
private $abstract_options; |
| 7 |
private static $text_parametrs=array('parametrs_sucsses_saved'=>'Successfully saved.','error_in_saving'=>'can\'t save "%s" plugin parameter<br>','missing_title'=>'Type Message Title','missing_fromname'=>'Type From Name','missing_frommail'=>'Type From mail','mising_massage'=>'Type Message','sucsses_mailed'=>'Your message was sent successfully.', 'error_maied'=>'error sending email','authorize_problem' => 'Authorization Problem' ); |
| 8 |
|
| 9 |
function __construct(){ |
| 10 |
$this->update_old_option_to_new(); |
| 11 |
$this->options=self::return_params_array(); |
| 12 |
$this->generete_abstract_params_list(); |
| 13 |
$this->generete_popup_settings(); |
| 14 |
} |
| 15 |
|
| 16 |
public static function return_params_array(){ |
| 17 |
$timers_array = wpda_countdown()->timer_repository()->all_names(); |
| 18 |
$themes_array = wpda_countdown()->theme_repository()->all_names(); |
| 19 |
$params = array( |
| 20 |
"general_options"=>array( |
| 21 |
"heading_name"=>"General", |
| 22 |
"location"=>"left", |
| 23 |
"image"=>wpda_countdown_plugin_url."left", |
| 24 |
"params"=>array( |
| 25 |
"general_show_popup_action"=>array( |
| 26 |
"title"=>"Show/Hide countdown from below list", |
| 27 |
"description"=>"Choose the action to show or hide countdown from below list.", |
| 28 |
"values"=>array("show"=>"Show from Below selecte list","hide"=>"Hide from Below selecte list"), |
| 29 |
"default_value"=>"hide", |
| 30 |
"function_name"=>"simple_select" |
| 31 |
), |
| 32 |
"general_show_popup_on_multiple"=>array( |
| 33 |
"title"=>"Select the list", |
| 34 |
"description"=>"Click on the field and then choose something from list.", |
| 35 |
"default_value"=>array(), |
| 36 |
"function_name"=>"multiplay_select" |
| 37 |
), |
| 38 |
"general_show_quantity"=>array( |
| 39 |
"title"=>"Countdown popup display periodicity", |
| 40 |
"description"=>"Select the countdown popup display periodicity.", |
| 41 |
"values"=>array( |
| 42 |
"one_time"=>"Оne Тime", |
| 43 |
"on_refresh"=>"Еvery Тime", |
| 44 |
), |
| 45 |
"default_value"=>"on_refresh", |
| 46 |
"function_name"=>"simple_select", |
| 47 |
), |
| 48 |
"general_show_popup_after"=>array( |
| 49 |
"title"=>"Time to show the countdown popup", |
| 50 |
"description"=>"Type the time when countdown popup will appear.", |
| 51 |
"function_name"=>"simple_input", |
| 52 |
"small_text"=>"(seconds)", |
| 53 |
"default_value"=>"1", |
| 54 |
"type"=>"number" |
| 55 |
), |
| 56 |
"general_element_ordering"=>array( |
| 57 |
"title"=>"Countdown popup elements ordering(hiding)", |
| 58 |
"description"=>"Choose the countdown popup elements ordering, also you can hide Popup countdown elements by click on exact element.", |
| 59 |
"function_name"=>"oredering", |
| 60 |
"values"=>array( |
| 61 |
"title"=>"Title", |
| 62 |
"message"=>"Message", |
| 63 |
"countdown"=>"Countdown", |
| 64 |
), |
| 65 |
"default_value"=>'{"title":[1,"title"],"message":[1,"message"],"countdown":[1,"countdown"]}', |
| 66 |
"type"=>"number" |
| 67 |
), |
| 68 |
"general_scrolling_content"=>array( |
| 69 |
"title"=>"Visible or hidden scroll inside popup", |
| 70 |
"description"=>"Select visible or hidden scroll inside popup", |
| 71 |
"values"=>array( |
| 72 |
"yes"=>"Visible", |
| 73 |
"no"=>"Hidden", |
| 74 |
), |
| 75 |
"default_value"=>"no", |
| 76 |
"function_name"=>"simple_select" |
| 77 |
), |
| 78 |
"general_hide_after_expire"=>array( |
| 79 |
"title"=>"Hide popup after countdown expires", |
| 80 |
"description"=>"Automatically close the popup when the countdown reaches zero. Useful for time-limited events like Black Friday deals.", |
| 81 |
"values"=>array( |
| 82 |
"no"=>"No — keep popup visible", |
| 83 |
"yes"=>"Yes — close popup when expired", |
| 84 |
), |
| 85 |
"default_value"=>"no", |
| 86 |
"function_name"=>"simple_select" |
| 87 |
), |
| 88 |
) |
| 89 |
), |
| 90 |
"countdown_options"=>array( |
| 91 |
"heading_name"=>"Countdown", |
| 92 |
"location"=>"left", |
| 93 |
"image"=>wpda_countdown_plugin_url."left", |
| 94 |
"params"=>array( |
| 95 |
"countdown_timer"=>array( |
| 96 |
"title"=>"Countdown timer", |
| 97 |
"description"=>"Select the countdown timer.", |
| 98 |
"values"=>$timers_array, |
| 99 |
"default_value"=>"1", |
| 100 |
"function_name"=>"simple_select", |
| 101 |
), |
| 102 |
"countdown_theme"=>array( |
| 103 |
"title"=>"Countdown theme", |
| 104 |
"description"=>"Select the countdown theme.", |
| 105 |
"values"=>$themes_array, |
| 106 |
"default_value"=>"1", |
| 107 |
"function_name"=>"simple_select", |
| 108 |
), |
| 109 |
), |
| 110 |
), |
| 111 |
"overlay_options"=>array( |
| 112 |
"heading_name"=>"Overlay", |
| 113 |
"location"=>"right", |
| 114 |
"image"=>wpda_countdown_plugin_url."left", |
| 115 |
"params"=>array( |
| 116 |
"overlay_show_hide"=>array( |
| 117 |
"title"=>"Show overlay", |
| 118 |
"description"=>"Show/Hide Overlay.", |
| 119 |
"values"=>array( |
| 120 |
"1"=>"Show", |
| 121 |
"0"=>"Hide", |
| 122 |
), |
| 123 |
"default_value"=>"true", |
| 124 |
"function_name"=>"simple_select", |
| 125 |
), |
| 126 |
"overlay_trancparency"=>array( |
| 127 |
"title"=>"Overlay transparency", |
| 128 |
"description"=>"Set the overlay transparency.", |
| 129 |
"default_value"=>"30", |
| 130 |
"small_text"=>"(%)", |
| 131 |
"function_name"=>"range_input" |
| 132 |
), |
| 133 |
"overlay_top_bg_color"=>array( |
| 134 |
"title"=>"Overlay top background color", |
| 135 |
"description"=>"Choose overlay top background color", |
| 136 |
"default_value"=>"#000000", |
| 137 |
"function_name"=>"color_input", |
| 138 |
), |
| 139 |
"overlay_top_bottom_color"=>array( |
| 140 |
"title"=>"Overlay bottom background color", |
| 141 |
"description"=>"Choose overlay bottom background color.", |
| 142 |
"default_value"=>"#000000", |
| 143 |
"function_name"=>"color_input", |
| 144 |
), |
| 145 |
"overlay_fade_efect_time"=>array( |
| 146 |
"title"=>"Overlay fade effect time", |
| 147 |
"description"=>"Set overlay fade effect time.", |
| 148 |
"function_name"=>"simple_input", |
| 149 |
"small_text"=>"(Miliseconds)", |
| 150 |
"default_value"=>"500", |
| 151 |
) |
| 152 |
|
| 153 |
) |
| 154 |
), |
| 155 |
"popup_options"=>array( |
| 156 |
"heading_name"=>"Popup", |
| 157 |
"location"=>"right", |
| 158 |
"image"=>wpda_countdown_plugin_url."left", |
| 159 |
"params"=>array( |
| 160 |
"popup_width"=>array( |
| 161 |
"title"=>"Width", |
| 162 |
"description"=>"Type width for popup", |
| 163 |
"default_value"=>"550", |
| 164 |
"small_text"=>"(Px)", |
| 165 |
"type"=>"number", |
| 166 |
"function_name"=>"simple_input" |
| 167 |
), |
| 168 |
"popup_height"=>array( |
| 169 |
"title"=>"Height", |
| 170 |
"description"=>"Type height for popup", |
| 171 |
"default_value"=>"300", |
| 172 |
"small_text"=>"(Px)", |
| 173 |
"type"=>"number", |
| 174 |
"function_name"=>"simple_input" |
| 175 |
), |
| 176 |
"popup_position"=>array( |
| 177 |
"title"=>"Popup position", |
| 178 |
"description"=>"Select popup position", |
| 179 |
"values"=>array( |
| 180 |
"1"=>"Top Left", |
| 181 |
"2"=>"Top center", |
| 182 |
"3"=>"Top right", |
| 183 |
"4"=>"Middle Left", |
| 184 |
"5"=>"Middle center", |
| 185 |
"6"=>"Middle right", |
| 186 |
"7"=>"Bottom Left", |
| 187 |
"8"=>"Bottom center", |
| 188 |
"9"=>"Bottom right", |
| 189 |
), |
| 190 |
"default_value"=>"5", |
| 191 |
"function_name"=>"simple_select", |
| 192 |
), |
| 193 |
"popup_fixed_position"=>array( |
| 194 |
"title"=>"Popup fixed position", |
| 195 |
"description"=>"Enable/Disable fixed position for Popup", |
| 196 |
"values"=>array( |
| 197 |
"true"=>"Enable", |
| 198 |
"false"=>"Dsiable", |
| 199 |
), |
| 200 |
"default_value"=>"true", |
| 201 |
"function_name"=>"simple_select", |
| 202 |
), |
| 203 |
"popup_outside_margin"=>array( |
| 204 |
"title"=>"Popup distance from window", |
| 205 |
"description"=>"Type Popup distance from window when position is 1,2,3,4,6,7,8,9(except Middle center position)", |
| 206 |
"function_name"=>"simple_input", |
| 207 |
"small_text"=>"(Px)", |
| 208 |
"default_value"=>"20", |
| 209 |
), |
| 210 |
"popup_background_color"=>array( |
| 211 |
"title"=>"Popup background color", |
| 212 |
"description"=>"Set the Popup background color", |
| 213 |
"function_name"=>"color_input", |
| 214 |
"default_value"=>"#ffffff", |
| 215 |
), |
| 216 |
"popup_border_color"=>array( |
| 217 |
"title"=>"Popup border color", |
| 218 |
"description"=>"Set the Popup border color", |
| 219 |
"function_name"=>"color_input", |
| 220 |
"default_value"=>"#000000", |
| 221 |
), |
| 222 |
"popup_border_width"=>array( |
| 223 |
"title"=>"Popup border width", |
| 224 |
"description"=>"Type the Popup border width", |
| 225 |
"function_name"=>"simple_input", |
| 226 |
"small_text"=>"(Px)", |
| 227 |
"default_value"=>"2", |
| 228 |
), |
| 229 |
"popup_border_radius"=>array( |
| 230 |
"title"=>"Popup border radius", |
| 231 |
"description"=>"Set the Popup border radius", |
| 232 |
"function_name"=>"simple_input", |
| 233 |
"small_text"=>"(Px)", |
| 234 |
"default_value"=>"8", |
| 235 |
), |
| 236 |
"popup_animation_type"=>array( |
| 237 |
"title"=>"Popup opening animation type", |
| 238 |
"description"=>"Choose popup opening animation type", |
| 239 |
"values"=>array( |
| 240 |
"disable"=>"Disabel", |
| 241 |
"fade"=>"Fade", |
| 242 |
"zoom_out"=>"Zoom out", |
| 243 |
"zoom_in"=>"Zoom in", |
| 244 |
"slide_in_right"=>"Slide in from right", |
| 245 |
"slide_in_left"=>"Slide in from left", |
| 246 |
"slide_from_top"=>"Slide in from top", |
| 247 |
"slide_from_bottom"=>"Slide in from Bottom", |
| 248 |
"newspaper"=>"Newspaper", |
| 249 |
"flip_hor_left"=>"Flip Horizontal Left", |
| 250 |
"flip_hor_right"=>"Flip Horizontal Right", |
| 251 |
"flip_ver_bottom"=>"Flip Vertical Top", |
| 252 |
"wpdevart_lb_flip_ver_bottom"=>"Flip Vertical Bottom", |
| 253 |
), |
| 254 |
"default_value"=>"disable", |
| 255 |
"function_name"=>"simple_select", |
| 256 |
), |
| 257 |
"popup_animation_time"=>array( |
| 258 |
"title"=>"Popup animation duration", |
| 259 |
"description"=>"Choose duration of Popup animation", |
| 260 |
"function_name"=>"simple_input", |
| 261 |
"type"=>"number", |
| 262 |
"small_text"=>"(Miliseconds)", |
| 263 |
"default_value"=>"500", |
| 264 |
) |
| 265 |
), |
| 266 |
|
| 267 |
), |
| 268 |
"control_buttons"=>array( |
| 269 |
"heading_name"=>"Close Button", |
| 270 |
"location"=>"right", |
| 271 |
"image"=>wpda_countdown_plugin_url."left", |
| 272 |
"params"=>array( |
| 273 |
"control_buttons_show_hide"=>array( |
| 274 |
"title"=>"Show Close button section", |
| 275 |
"description"=>"Select to show/hide close button section", |
| 276 |
"values"=>array( |
| 277 |
"1"=>"Show", |
| 278 |
"0"=>"Hide", |
| 279 |
), |
| 280 |
"default_value"=>"true", |
| 281 |
"function_name"=>"simple_select", |
| 282 |
), |
| 283 |
"control_buttons_line_position"=>array( |
| 284 |
"title"=>"Close button section position", |
| 285 |
"description"=>"Select close button section position", |
| 286 |
"values"=>array( |
| 287 |
"0"=>"Top inside popup", |
| 288 |
"1"=>"Top outside popup", |
| 289 |
"2"=>"Bottom inside popup", |
| 290 |
"3"=>"Bottom outside popup", |
| 291 |
), |
| 292 |
"default_value"=>"0", |
| 293 |
"function_name"=>"simple_select", |
| 294 |
), |
| 295 |
"control_buttons_line_height"=>array( |
| 296 |
"title"=>"Close button section line height", |
| 297 |
"description"=>"Type close button section line height", |
| 298 |
"function_name"=>"simple_input", |
| 299 |
"type"=>"number", |
| 300 |
"small_text"=>"(px)", |
| 301 |
"default_value"=>"30", |
| 302 |
), |
| 303 |
"control_buttons_line_bg_color"=>array( |
| 304 |
"title"=>"Close button section background color", |
| 305 |
"description"=>"Select close button section background color", |
| 306 |
"function_name"=>"color_input", |
| 307 |
"default_value"=>"#000000", |
| 308 |
), |
| 309 |
"control_buttons_transparency"=>array( |
| 310 |
"title"=>"Close button section transparency", |
| 311 |
"description"=>"Select close button section transparency", |
| 312 |
"default_value"=>"60", |
| 313 |
"small_text"=>"(%)", |
| 314 |
"function_name"=>"range_input" |
| 315 |
), |
| 316 |
"control_buttons_transparency_hover"=>array( |
| 317 |
"title"=>"Close button section hover transparency", |
| 318 |
"description"=>"Select close button section hover transparency", |
| 319 |
"default_value"=>"100", |
| 320 |
"small_text"=>"(%)", |
| 321 |
"function_name"=>"range_input" |
| 322 |
), |
| 323 |
"control_buttons_close_position"=>array( |
| 324 |
"title"=>"Close button position", |
| 325 |
"description"=>"Select close button position", |
| 326 |
"values"=>array( |
| 327 |
"right"=>"Right", |
| 328 |
"left"=>"Left", |
| 329 |
), |
| 330 |
"default_value"=>"right", |
| 331 |
"function_name"=>"simple_select", |
| 332 |
), |
| 333 |
"control_buttons_close_icon_style"=>array( |
| 334 |
"title"=>"Close icon style", |
| 335 |
"description"=>"Select the close button icon style", |
| 336 |
"function_name"=>"simple_select_pro_font_size", |
| 337 |
"values"=>array( |
| 338 |
"cross"=>array("✕ Thin cross",""), |
| 339 |
"times"=>array("✖ Bold cross",""), |
| 340 |
"circle_x"=>array("⊗ Circle cross",""), |
| 341 |
), |
| 342 |
"default_value"=>"cross", |
| 343 |
), |
| 344 |
"control_buttons_close_icon_color"=>array( |
| 345 |
"title"=>"Close icon color", |
| 346 |
"description"=>"Select the close icon color", |
| 347 |
"function_name"=>"color_input", |
| 348 |
"default_value"=>"#ffffff", |
| 349 |
), |
| 350 |
), |
| 351 |
), |
| 352 |
"title_options"=>array( |
| 353 |
"heading_name"=>"Popup Title", |
| 354 |
"location"=>"left", |
| 355 |
"image"=>wpda_countdown_plugin_url."left", |
| 356 |
"params"=>array( |
| 357 |
"popup_page_title_text"=>array( |
| 358 |
"title"=>"Title", |
| 359 |
"description"=>"Type here the popup title.", |
| 360 |
"function_name"=>"simple_input", |
| 361 |
"default_value"=>"Countdown", |
| 362 |
), |
| 363 |
"popup_page_title_color"=>array( |
| 364 |
"title"=>"Title color", |
| 365 |
"description"=>"Select the popup title color.", |
| 366 |
"function_name"=>"color_input", |
| 367 |
"default_value"=>"#000000", |
| 368 |
), |
| 369 |
"popup_page_title_font_size"=>array( |
| 370 |
"title"=>"Title font size", |
| 371 |
"description"=>"Type here the popup title font size.", |
| 372 |
"function_name"=>"simple_input", |
| 373 |
"small_text"=>"(px)", |
| 374 |
"default_value"=>"24", |
| 375 |
), |
| 376 |
"popup_page_title_font_family"=>array( |
| 377 |
"title"=>"Title font family", |
| 378 |
"description"=>"Select the popup title font family.", |
| 379 |
"function_name"=>"font_select", |
| 380 |
"values"=>Wpda_Countdown_Admin_Fields::font_choices(), |
| 381 |
"default_value"=>"Arial,Helvetica Neue,Helvetica,sans-serif", |
| 382 |
), |
| 383 |
"popup_page_title_position"=>array( |
| 384 |
"title"=>"Title position", |
| 385 |
"description"=>"Select the popup title position.", |
| 386 |
"values"=>array( |
| 387 |
"left"=>"Left", |
| 388 |
"center"=>"Center", |
| 389 |
"right"=>"Right", |
| 390 |
), |
| 391 |
"default_value"=>"center", |
| 392 |
"function_name"=>"simple_select", |
| 393 |
), |
| 394 |
"popup_page_title_padding"=>array( |
| 395 |
"title"=>"Title padding", |
| 396 |
"description"=>"Type here the popup title padding.", |
| 397 |
"function_name"=>"padding_margin_input", |
| 398 |
"values"=>array("top"=>"30","right"=>"0","bottom"=>"0","left"=>"0"), |
| 399 |
"default_value"=>array("top"=>"30","right"=>"0","bottom"=>"0","left"=>"0"), |
| 400 |
), |
| 401 |
"popup_page_title_animation"=>array( |
| 402 |
"title"=>"Title animation type", |
| 403 |
"description"=>"Select the popup title animation type.", |
| 404 |
"function_name"=>"simple_select", |
| 405 |
"values"=>array( |
| 406 |
"none"=>"None", |
| 407 |
"random"=>"Random", |
| 408 |
"Attention_Seekers"=>array( |
| 409 |
"bounce"=>"Bounce", |
| 410 |
"flash"=>"Flash", |
| 411 |
"pulse"=>"Pulse", |
| 412 |
"rubberBand"=>"RubberBand", |
| 413 |
"shake"=>"Shake", |
| 414 |
"swing"=>"Swing", |
| 415 |
"tada"=>"tada", |
| 416 |
"wobble"=>"wobble", |
| 417 |
), |
| 418 |
"Bouncing_Entrances"=>array( |
| 419 |
"bounceIn"=>"BounceIn", |
| 420 |
"bounceInDown"=>"BounceInDown", |
| 421 |
"bounceInLeft"=>"BounceInLeft", |
| 422 |
"bounceInRight"=>"BounceInRight", |
| 423 |
"bounceInUp"=>"BounceInUp", |
| 424 |
), |
| 425 |
"Fading_Entrances"=>array( |
| 426 |
"fadeIn"=>"FadeIn", |
| 427 |
"fadeInDown"=>"FadeInDown", |
| 428 |
"fadeInDownBig"=>"FadeInDownBig", |
| 429 |
"fadeInLeft"=>"FadeInLeft", |
| 430 |
"fadeInLeftBig"=>"FadeInLeftBig", |
| 431 |
"fadeInRight"=>"FadeInRight", |
| 432 |
"fadeInRightBig"=>"FadeInRightBig", |
| 433 |
"fadeInUp"=>"FadeInUp", |
| 434 |
"fadeInUpBig"=>"FadeInUpBig", |
| 435 |
), |
| 436 |
"Flippers"=>array( |
| 437 |
"flip"=>"Flip", |
| 438 |
"flipInX"=>"FlipInX", |
| 439 |
"flipInY"=>"FlipInY", |
| 440 |
), |
| 441 |
"Lightspeed"=>array( |
| 442 |
"lightSpeedIn"=>"LightSpeedIn", |
| 443 |
), |
| 444 |
"Rotating_Entrances"=>array( |
| 445 |
"rotateIn"=>"RotateIn", |
| 446 |
"rotateInDownLeft"=>"RotateInDownLeft", |
| 447 |
"rotateInDownRight"=>"RotateInDownRight", |
| 448 |
"rotateInUpLeft"=>"RotateInUpLeft", |
| 449 |
"rotateInUpRight"=>"RotateInUpRight", |
| 450 |
), |
| 451 |
"Specials"=>array( |
| 452 |
"rollIn"=>"RollIn", |
| 453 |
), |
| 454 |
"Zoom_Entrances"=>array( |
| 455 |
"zoomIn"=>"ZoomIn", |
| 456 |
"zoomInDown"=>"ZoomInDown", |
| 457 |
"zoomInLeft"=>"ZoomInLeft", |
| 458 |
"zoomInRight"=>"ZoomInRight", |
| 459 |
"zoomInUp"=>"ZoomInUp", |
| 460 |
), |
| 461 |
), |
| 462 |
"default_value"=>"none", |
| 463 |
), |
| 464 |
"popup_page_title_animation_time"=>array( |
| 465 |
"title"=>"Animation waiting time", |
| 466 |
"description"=>"Type here the animation waiting time.", |
| 467 |
"function_name"=>"simple_input", |
| 468 |
"small_text"=>"(milliseconds)", |
| 469 |
"default_value"=>"0", |
| 470 |
), |
| 471 |
) |
| 472 |
), |
| 473 |
"message_options"=>array( |
| 474 |
"heading_name"=>"Popup message", |
| 475 |
"location"=>"left", |
| 476 |
"image"=>wpda_countdown_plugin_url."left", |
| 477 |
"params"=>array( |
| 478 |
"popup_page_message"=>array( |
| 479 |
"title"=>"Message", |
| 480 |
"description"=>"type message", |
| 481 |
"function_name"=>"tinmce", |
| 482 |
"default_value"=>"Countdown message", |
| 483 |
), |
| 484 |
"popup_page_message_animation"=>array( |
| 485 |
"title"=>"Message animation type", |
| 486 |
"description"=>"Select the popup message animation type.", |
| 487 |
"function_name"=>"simple_select", |
| 488 |
"values"=>array( |
| 489 |
"none"=>"None", |
| 490 |
"random"=>"Random", |
| 491 |
"Attention_Seekers"=>array( |
| 492 |
"bounce"=>"Bounce", |
| 493 |
"flash"=>"Flash", |
| 494 |
"pulse"=>"Pulse", |
| 495 |
"rubberBand"=>"RubberBand", |
| 496 |
"shake"=>"Shake", |
| 497 |
"swing"=>"Swing", |
| 498 |
"tada"=>"tada", |
| 499 |
"wobble"=>"wobble", |
| 500 |
), |
| 501 |
"Bouncing_Entrances"=>array( |
| 502 |
"bounceIn"=>"BounceIn", |
| 503 |
"bounceInDown"=>"BounceInDown", |
| 504 |
"bounceInLeft"=>"BounceInLeft", |
| 505 |
"bounceInRight"=>"BounceInRight", |
| 506 |
"bounceInUp"=>"BounceInUp", |
| 507 |
), |
| 508 |
"Fading_Entrances"=>array( |
| 509 |
"fadeIn"=>"FadeIn", |
| 510 |
"fadeInDown"=>"FadeInDown", |
| 511 |
"fadeInDownBig"=>"FadeInDownBig", |
| 512 |
"fadeInLeft"=>"FadeInLeft", |
| 513 |
"fadeInLeftBig"=>"FadeInLeftBig", |
| 514 |
"fadeInRight"=>"FadeInRight", |
| 515 |
"fadeInRightBig"=>"FadeInRightBig", |
| 516 |
"fadeInUp"=>"FadeInUp", |
| 517 |
"fadeInUpBig"=>"FadeInUpBig", |
| 518 |
), |
| 519 |
"Flippers"=>array( |
| 520 |
"flip"=>"Flip", |
| 521 |
"flipInX"=>"FlipInX", |
| 522 |
"flipInY"=>"FlipInY", |
| 523 |
), |
| 524 |
"Lightspeed"=>array( |
| 525 |
"lightSpeedIn"=>"LightSpeedIn", |
| 526 |
), |
| 527 |
"Rotating_Entrances"=>array( |
| 528 |
"rotateIn"=>"RotateIn", |
| 529 |
"rotateInDownLeft"=>"RotateInDownLeft", |
| 530 |
"rotateInDownRight"=>"RotateInDownRight", |
| 531 |
"rotateInUpLeft"=>"RotateInUpLeft", |
| 532 |
"rotateInUpRight"=>"RotateInUpRight", |
| 533 |
), |
| 534 |
"Specials"=>array( |
| 535 |
"rollIn"=>"RollIn", |
| 536 |
), |
| 537 |
"Zoom_Entrances"=>array( |
| 538 |
"zoomIn"=>"ZoomIn", |
| 539 |
"zoomInDown"=>"ZoomInDown", |
| 540 |
"zoomInLeft"=>"ZoomInLeft", |
| 541 |
"zoomInRight"=>"ZoomInRight", |
| 542 |
"zoomInUp"=>"ZoomInUp", |
| 543 |
), |
| 544 |
), |
| 545 |
"default_value"=>"none", |
| 546 |
), |
| 547 |
"popup_page_message_animation_time"=>array( |
| 548 |
"title"=>"Animation waiting time", |
| 549 |
"description"=>"Type here the animation waiting time.", |
| 550 |
"function_name"=>"simple_input", |
| 551 |
"small_text"=>"(milliseconds)", |
| 552 |
"default_value"=>"0", |
| 553 |
), |
| 554 |
) |
| 555 |
), |
| 556 |
); |
| 557 |
|
| 558 |
// Popup is a Pro feature — in the free build every field is marked (pro) |
| 559 |
// so the page renders as a full preview with an alert on any interaction. |
| 560 |
if ( ! WPDA_COUNTDOWN_IS_PRO ) { |
| 561 |
foreach ( $params as $gk => $group ) { |
| 562 |
if ( empty( $group['params'] ) ) continue; |
| 563 |
foreach ( $group['params'] as $pk => $field ) { |
| 564 |
$params[ $gk ]['params'][ $pk ]['pro'] = true; |
| 565 |
} |
| 566 |
} |
| 567 |
} |
| 568 |
|
| 569 |
return $params; |
| 570 |
} |
| 571 |
public static function save_in_db() { |
| 572 |
$params_array = self::return_params_array(); |
| 573 |
$databases_parametrs = json_decode( get_option( 'wpda_countdown_params' ), true ); |
| 574 |
if ( ! is_array( $databases_parametrs ) ) $databases_parametrs = array(); |
| 575 |
|
| 576 |
if ( ! isset( $_POST['curent_page'], $_POST['countdown_options_nonce'] ) |
| 577 |
|| ! wp_verify_nonce( $_POST['countdown_options_nonce'], 'countdown_options_nonce' ) ) { |
| 578 |
die( self::$text_parametrs['authorize_problem'] ); |
| 579 |
} |
| 580 |
|
| 581 |
if ( $_POST['curent_page'] === 'general_save_parametr' && isset( $_POST['countdown_page_mode'] ) ) { |
| 582 |
update_option( 'wpdevart_countdown_popup_enable', sanitize_text_field( $_POST['countdown_page_mode'] ) ); |
| 583 |
} elseif ( isset( $params_array[ $_POST['curent_page'] ]['params'] ) ) { |
| 584 |
foreach ( $params_array[ $_POST['curent_page'] ]['params'] as $key => $value ) { |
| 585 |
if ( isset( $_POST[ $key ] ) ) { |
| 586 |
$databases_parametrs[ $key ] = Wpda_Countdown_Admin_Fields::sanitize_field_value( $value, $_POST[ $key ] ); |
| 587 |
} elseif ( $value['function_name'] === 'multiplay_select' ) { |
| 588 |
$databases_parametrs[ $key ] = array(); |
| 589 |
} |
| 590 |
} |
| 591 |
update_option( 'wpda_countdown_params', wp_json_encode( $databases_parametrs ) ); |
| 592 |
} |
| 593 |
|
| 594 |
die( self::$text_parametrs['parametrs_sucsses_saved'] ); |
| 595 |
} |
| 596 |
public static function get_default_values_array(){ |
| 597 |
$array_of_returned=array(); |
| 598 |
$options=self::return_params_array(); |
| 599 |
foreach($options as $param_heading_key=>$param_heading_value){ |
| 600 |
foreach($param_heading_value['params'] as $key=>$value){ |
| 601 |
$array_of_returned[$key]=$value['default_value']; |
| 602 |
} |
| 603 |
} |
| 604 |
return $array_of_returned; |
| 605 |
} |
| 606 |
private function generete_popup_settings(){ |
| 607 |
$databases_parametrs=json_decode(get_option("wpda_countdown_params"), true); |
| 608 |
if(!is_array($databases_parametrs)) $databases_parametrs=array(); |
| 609 |
foreach($this->options as $param_heading_key=>$param_heading_value){ |
| 610 |
foreach($param_heading_value['params'] as $key=>$value){ |
| 611 |
if(isset($databases_parametrs[$key])){ |
| 612 |
$this->options[$param_heading_key]['params'][$key]["value"]=$databases_parametrs[$key]; |
| 613 |
}else{ |
| 614 |
$this->options[$param_heading_key]['params'][$key]["value"]=$this->options[$param_heading_key]['params'][$key]["default_value"]; |
| 615 |
} |
| 616 |
} |
| 617 |
} |
| 618 |
} |
| 619 |
private function generete_abstract_params_list(){ |
| 620 |
$abstract_options=array(); |
| 621 |
foreach($this->options as $param_heading_key=>$param_heading_value){ |
| 622 |
foreach($param_heading_value['params'] as $key=>$value){ |
| 623 |
if(is_array($this->options[$param_heading_key]['params'][$key]["default_value"])){ |
| 624 |
$abstract_options[$param_heading_key][$key]=wp_json_encode($this->options[$param_heading_key]['params'][$key]["default_value"]); |
| 625 |
} |
| 626 |
else{ |
| 627 |
$abstract_options[$param_heading_key][$key]=$this->options[$param_heading_key]['params'][$key]["default_value"]; |
| 628 |
} |
| 629 |
} |
| 630 |
} |
| 631 |
$this->abstract_options=$abstract_options; |
| 632 |
} |
| 633 |
public function controller_page(){ |
| 634 |
$enable_disable=get_option("wpdevart_countdown_popup_enable","off"); |
| 635 |
$locked = WPDA_COUNTDOWN_IS_PRO ? '' : ' wpda_pro_locked_page'; |
| 636 |
?> |
| 637 |
<script> |
| 638 |
var countdown_ajaxurl="<?php echo esc_url( admin_url( 'admin-ajax.php' ) ); ?>"; |
| 639 |
var countdown_plugin_url="<?php echo esc_url( wpda_countdown_plugin_url ); ?>"; |
| 640 |
var countdown_parametrs_sucsses_saved="<?php echo esc_js( self::$text_parametrs['parametrs_sucsses_saved'] ); ?>"; |
| 641 |
var countdown_all_parametrs = <?php echo wp_json_encode( $this->abstract_options ); ?>; |
| 642 |
</script> |
| 643 |
<?php Wpda_Countdown_Admin_Fields::render_pro_banner(); ?> |
| 644 |
<div class="wpda_popup_page<?php echo esc_attr( $locked ); ?>"> |
| 645 |
<div class="countdown_title"><h1><span><svg class="wpda_section_icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round"><rect x="1" y="4" width="16" height="13" rx="2"/><rect x="7" y="7" width="16" height="13" rx="2" fill="white"/><rect x="7" y="7" width="16" height="13" rx="2"/><line x1="10" y1="13" x2="20" y2="13"/><line x1="10" y1="16" x2="16" y2="16"/></svg>Countdown Popup</span></h1></div> |
| 646 |
<div id="countdown_enable" class="field switch"> |
| 647 |
<label for="radio1" class="cb-enable <?php if($enable_disable=='on') echo 'selected'; ?>"><span>Enable</span></label> |
| 648 |
<label for="radio2" class="cb-disable <?php if($enable_disable=='off') echo 'selected'; ?>"><span>Disable</span></label> |
| 649 |
<span class="progress_enable_disable_buttons"><span class="saving_in_progress"> </span><span class="sucsses_save"> </span><span class="error_in_saving"> </span><span class="error_massage"></span></span> |
| 650 |
<div style="clear:both"></div> |
| 651 |
<br> |
| 652 |
</div> |
| 653 |
<div class="wp-table right_margin"> |
| 654 |
<table class="wp-list-table widefat fixed posts"> |
| 655 |
<thead> |
| 656 |
<tr> |
| 657 |
<th> |
| 658 |
<h4 class="params_subtitle">Parameters </h4> |
| 659 |
<span class="save_all_paramss"> <button type="button" id="save_all_parametrs" class="save_all_section_parametrs button button-primary"><span class="save_button_span">Save All Sections</span> <span class="saving_in_progress"> </span><span class="sucsses_save"> </span><span class="error_in_saving"> </span></button></span> |
| 660 |
</th> |
| 661 |
</tr> |
| 662 |
</thead> |
| 663 |
<tbody> |
| 664 |
<tr> |
| 665 |
<td> |
| 666 |
<div id="countdown_page"> |
| 667 |
<div class="left_sections"> |
| 668 |
<?php |
| 669 |
foreach($this->options as $params_grup_name =>$params_group_value){ |
| 670 |
if($params_group_value["location"]!="right"){ |
| 671 |
?> |
| 672 |
<div class="main_parametrs_group_div closed_params " > |
| 673 |
<div class="head_panel_div" title="Click to toggle"> |
| 674 |
<span class="title_parametrs_group"><?php echo esc_html( $params_group_value["heading_name"] ); ?></span> |
| 675 |
<span class="enabled_or_disabled_parametr"></span> |
| 676 |
<span class="open_or_closed"></span> |
| 677 |
</div> |
| 678 |
<div class="inside_information_div"> |
| 679 |
<table class="wp-list-table widefat fixed posts section_parametrs_table"> |
| 680 |
<tbody> |
| 681 |
<?php |
| 682 |
foreach($params_group_value['params'] as $param_name => $param_value){ |
| 683 |
$args=array( |
| 684 |
"name"=>$param_name, |
| 685 |
"heading_name"=>$params_group_value['heading_name'], |
| 686 |
"heading_group"=>$params_grup_name, |
| 687 |
); |
| 688 |
$args=array_merge($args,$param_value); |
| 689 |
$function_name=$param_value['function_name']; |
| 690 |
Wpda_Countdown_Admin_Fields::$function_name($args); |
| 691 |
} |
| 692 |
?> |
| 693 |
</tbody> |
| 694 |
<tfoot> |
| 695 |
<?php if($params_grup_name!="general_options"){ ?> |
| 696 |
<th colspan="2" width="100%"><button type="button" id="<?php echo esc_attr( $params_grup_name ); ?>" class="save_section_parametrs button button-primary"><span class="save_button_span">Save Section</span> <span class="saving_in_progress"> </span><span class="sucsses_save"> </span><span class="error_in_saving"> </span></button><span class="error_massage"> </span></th> |
| 697 |
<?php }else{ ?> |
| 698 |
<th colspan="1"><button type="button" id="<?php echo esc_attr( $params_grup_name ); ?>" class="save_section_parametrs button button-primary"><span class="save_button_span">Save Section</span> <span class="saving_in_progress"> </span><span class="sucsses_save"> </span><span class="error_in_saving"> </span></button><span class="error_massage"> </span></th> |
| 699 |
<th><button type="button" onclick="countdown_set_cookies('countdown_popup','',2); alert('cookie removed')" class="save_button button button-primary" style="float:right;"><span class="save_button_span">Remove cookies</span></button></th> |
| 700 |
<?php } ?> |
| 701 |
</tfoot> |
| 702 |
</table> |
| 703 |
</div> |
| 704 |
</div> |
| 705 |
<?php }} ?> |
| 706 |
</div> |
| 707 |
<div class="right_sections"> |
| 708 |
<?php |
| 709 |
foreach($this->options as $params_grup_name =>$params_group_value){ |
| 710 |
if($params_group_value["location"]=="right"){ |
| 711 |
?> |
| 712 |
<div class="main_parametrs_group_div closed_params " > |
| 713 |
<div class="head_panel_div" title="Click to toggle"> |
| 714 |
<span class="title_parametrs_group"><?php echo esc_html( $params_group_value["heading_name"] ); ?></span> |
| 715 |
<span class="enabled_or_disabled_parametr"></span> |
| 716 |
<span class="open_or_closed"></span> |
| 717 |
</div> |
| 718 |
<div class="inside_information_div"> |
| 719 |
<table class="wp-list-table widefat fixed posts section_parametrs_table"> |
| 720 |
<tbody> |
| 721 |
<?php |
| 722 |
foreach($params_group_value['params'] as $param_name => $param_value){ |
| 723 |
$args=array( |
| 724 |
"name"=>$param_name, |
| 725 |
"heading_name"=>$params_group_value['heading_name'], |
| 726 |
"heading_group"=>$params_grup_name, |
| 727 |
); |
| 728 |
$args=array_merge($args,$param_value); |
| 729 |
$function_name=$param_value['function_name']; |
| 730 |
Wpda_Countdown_Admin_Fields::$function_name($args); |
| 731 |
} |
| 732 |
?> |
| 733 |
</tbody> |
| 734 |
<tfoot> |
| 735 |
<tr> |
| 736 |
<?php if($params_grup_name!="general_options"){ ?> |
| 737 |
<th colspan="2" width="100%"><button type="button" id="<?php echo esc_attr( $params_grup_name ); ?>" class="save_section_parametrs button button-primary"><span class="save_button_span">Save Section</span> <span class="saving_in_progress"> </span><span class="sucsses_save"> </span><span class="error_in_saving"> </span></button><span class="error_massage"> </span></th> |
| 738 |
<?php }else{ ?> |
| 739 |
<th colspan="1"><button type="button" id="<?php echo esc_attr( $params_grup_name ); ?>" class="save_section_parametrs button button-primary"><span class="save_button_span">Save Section</span> <span class="saving_in_progress"> </span><span class="sucsses_save"> </span><span class="error_in_saving"> </span></button><span class="error_massage"> </span></th> |
| 740 |
<th><button type="button" onclick="countdown_set_cookies('countdown_popup','',2); alert('cookie removed')" class="save_button button button-primary" style="float:right;"><span class="save_button_span">Remove cookies</span></button></th> |
| 741 |
<?php } ?> |
| 742 |
</tr> |
| 743 |
</tfoot> |
| 744 |
</table> |
| 745 |
</div> |
| 746 |
</div> |
| 747 |
<?php }} ?> |
| 748 |
</div> |
| 749 |
</div> |
| 750 |
<div style="clear:both"></div> |
| 751 |
</td> |
| 752 |
</tr> |
| 753 |
</tbody> |
| 754 |
<tfoot> |
| 755 |
<tr> |
| 756 |
<th> |
| 757 |
<span class="save_all_paramss"><button type="button" id="save_all_parametrs" class="save_all_section_parametrs button button-primary"><span class="save_button_span">Save All Sections</span> <span class="saving_in_progress"> </span><span class="sucsses_save"> </span><span class="error_in_saving"> </span></button></span> |
| 758 |
</th> |
| 759 |
</tr> |
| 760 |
</tfoot> |
| 761 |
</table> |
| 762 |
</div> |
| 763 |
<?php |
| 764 |
wp_nonce_field('countdown_options_nonce','countdown_options_nonce'); |
| 765 |
?> |
| 766 |
<script> |
| 767 |
(function(){ |
| 768 |
var icons={ |
| 769 |
'General':'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M12.22 2h-.44a2 2 0 00-2 2v.18a2 2 0 01-1 1.73l-.43.25a2 2 0 01-2 0l-.15-.08a2 2 0 00-2.73.73l-.22.38a2 2 0 00.73 2.73l.15.1a2 2 0 011 1.72v.51a2 2 0 01-1 1.74l-.15.09a2 2 0 00-.73 2.73l.22.38a2 2 0 002.73.73l.15-.08a2 2 0 012 0l.43.25a2 2 0 011 1.73V20a2 2 0 002 2h.44a2 2 0 002-2v-.18a2 2 0 011-1.73l.43-.25a2 2 0 012 0l.15.08a2 2 0 002.73-.73l.22-.39a2 2 0 00-.73-2.73l-.15-.08a2 2 0 01-1-1.74v-.5a2 2 0 011-1.74l.15-.09a2 2 0 00.73-2.73l-.22-.38a2 2 0 00-2.73-.73l-.15.08a2 2 0 01-2 0l-.43-.25a2 2 0 01-1-1.73V4a2 2 0 00-2-2z"/><circle cx="12" cy="12" r="3"/></svg>', |
| 770 |
'Overlay':'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><rect x="2" y="2" width="20" height="20" rx="2" opacity="0.4"/><rect x="6" y="6" width="12" height="12" rx="1"/></svg>', |
| 771 |
'Popup':'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><rect x="1" y="5" width="15" height="11" rx="2" opacity="0.4"/><rect x="8" y="8" width="15" height="11" rx="2"/><line x1="11" y1="13" x2="20" y2="13"/><line x1="11" y1="16" x2="17" y2="16"/></svg>', |
| 772 |
'Close Button':'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><circle cx="12" cy="12" r="10"/><path d="M15 9l-6 6M9 9l6 6"/></svg>', |
| 773 |
'Popup Title':'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M4 7V4h16v3M9 20h6M12 4v16"/></svg>', |
| 774 |
'Popup message':'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"/></svg>', |
| 775 |
'Countdown':'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><circle cx="12" cy="12" r="10"/><path d="M12 6v6l4 2"/></svg>', |
| 776 |
}; |
| 777 |
document.querySelectorAll('.title_parametrs_group').forEach(function(el){ |
| 778 |
var text=el.textContent.trim(); |
| 779 |
if(icons[text]){ |
| 780 |
var span=document.createElement('span'); |
| 781 |
span.className='wpda_section_icon'; |
| 782 |
span.innerHTML=icons[text]; |
| 783 |
span.style.cssText='display:inline-flex;width:18px;height:18px;opacity:0.6;flex-shrink:0;'; |
| 784 |
el.insertBefore(span,el.firstChild); |
| 785 |
} |
| 786 |
}); |
| 787 |
})(); |
| 788 |
</script> |
| 789 |
</div><!-- /.wpda_popup_page --> |
| 790 |
<?php |
| 791 |
} |
| 792 |
private function update_old_option_to_new(){ |
| 793 |
$databases_parametrs=json_decode(get_option("wpda_countdown_params"), true); |
| 794 |
if(!is_array($databases_parametrs)) $databases_parametrs=array(); |
| 795 |
if(isset($databases_parametrs["general_show_popup_on"])){ |
| 796 |
if(isset($databases_parametrs["general_show_popup_on"]["everywhere"])){ |
| 797 |
$databases_parametrs["general_show_popup_action"]="hide"; |
| 798 |
}else{ |
| 799 |
if(isset($databases_parametrs["general_show_popup_on"]["home"])){ |
| 800 |
$databases_parametrs["general_show_popup_on_multiple"]["front_page"]="front_page"; |
| 801 |
} |
| 802 |
if(isset($databases_parametrs["general_show_popup_on"]["post"])){ |
| 803 |
$databases_parametrs["general_show_popup_on_multiple"]["custom_post_type_post"]="custom_post_type_post"; |
| 804 |
} |
| 805 |
if(isset($databases_parametrs["general_show_popup_on"]["page"])){ |
| 806 |
$databases_parametrs["general_show_popup_on_multiple"]["custom_post_type_page"]="custom_post_type_page"; |
| 807 |
} |
| 808 |
} |
| 809 |
unset($databases_parametrs["general_show_popup_on"]); |
| 810 |
update_option("wpda_countdown_params",wp_json_encode($databases_parametrs)); |
| 811 |
} |
| 812 |
} |
| 813 |
|
| 814 |
} |
| 815 |
|
| 816 |
|
| 817 |
?> |
| 818 |
|