| 1 |
<?php |
| 2 |
class WDW_FM_Library { |
| 3 |
/** |
| 4 |
* PLUGIN = 2 points to Contact Form Maker |
| 5 |
*/ |
| 6 |
const PLUGIN = 1; |
| 7 |
|
| 8 |
/** |
| 9 |
* The single instance of the class. |
| 10 |
*/ |
| 11 |
protected static $_instance = null; |
| 12 |
|
| 13 |
/** |
| 14 |
* Main WDW_FM_Library Instance. |
| 15 |
* |
| 16 |
* Ensures only one instance is loaded or can be loaded. |
| 17 |
* |
| 18 |
* @static |
| 19 |
* @return WDW_FM_Library - Main instance. |
| 20 |
*/ |
| 21 |
public static function instance() { |
| 22 |
if ( is_null( self::$_instance ) ) { |
| 23 |
self::$_instance = new self(); |
| 24 |
} |
| 25 |
return self::$_instance; |
| 26 |
} |
| 27 |
|
| 28 |
public static $qpKeys = array( |
| 29 |
"\x00", |
| 30 |
"\x01", |
| 31 |
"\x02", |
| 32 |
"\x03", |
| 33 |
"\x04", |
| 34 |
"\x05", |
| 35 |
"\x06", |
| 36 |
"\x07", |
| 37 |
"\x08", |
| 38 |
"\x09", |
| 39 |
"\x0A", |
| 40 |
"\x0B", |
| 41 |
"\x0C", |
| 42 |
"\x0D", |
| 43 |
"\x0E", |
| 44 |
"\x0F", |
| 45 |
"\x10", |
| 46 |
"\x11", |
| 47 |
"\x12", |
| 48 |
"\x13", |
| 49 |
"\x14", |
| 50 |
"\x15", |
| 51 |
"\x16", |
| 52 |
"\x17", |
| 53 |
"\x18", |
| 54 |
"\x19", |
| 55 |
"\x1A", |
| 56 |
"\x1B", |
| 57 |
"\x1C", |
| 58 |
"\x1D", |
| 59 |
"\x1E", |
| 60 |
"\x1F", |
| 61 |
"\x7F", |
| 62 |
"\x80", |
| 63 |
"\x81", |
| 64 |
"\x82", |
| 65 |
"\x83", |
| 66 |
"\x84", |
| 67 |
"\x85", |
| 68 |
"\x86", |
| 69 |
"\x87", |
| 70 |
"\x88", |
| 71 |
"\x89", |
| 72 |
"\x8A", |
| 73 |
"\x8B", |
| 74 |
"\x8C", |
| 75 |
"\x8D", |
| 76 |
"\x8E", |
| 77 |
"\x8F", |
| 78 |
"\x90", |
| 79 |
"\x91", |
| 80 |
"\x92", |
| 81 |
"\x93", |
| 82 |
"\x94", |
| 83 |
"\x95", |
| 84 |
"\x96", |
| 85 |
"\x97", |
| 86 |
"\x98", |
| 87 |
"\x99", |
| 88 |
"\x9A", |
| 89 |
"\x9B", |
| 90 |
"\x9C", |
| 91 |
"\x9D", |
| 92 |
"\x9E", |
| 93 |
"\x9F", |
| 94 |
"\xA0", |
| 95 |
"\xA1", |
| 96 |
"\xA2", |
| 97 |
"\xA3", |
| 98 |
"\xA4", |
| 99 |
"\xA5", |
| 100 |
"\xA6", |
| 101 |
"\xA7", |
| 102 |
"\xA8", |
| 103 |
"\xA9", |
| 104 |
"\xAA", |
| 105 |
"\xAB", |
| 106 |
"\xAC", |
| 107 |
"\xAD", |
| 108 |
"\xAE", |
| 109 |
"\xAF", |
| 110 |
"\xB0", |
| 111 |
"\xB1", |
| 112 |
"\xB2", |
| 113 |
"\xB3", |
| 114 |
"\xB4", |
| 115 |
"\xB5", |
| 116 |
"\xB6", |
| 117 |
"\xB7", |
| 118 |
"\xB8", |
| 119 |
"\xB9", |
| 120 |
"\xBA", |
| 121 |
"\xBB", |
| 122 |
"\xBC", |
| 123 |
"\xBD", |
| 124 |
"\xBE", |
| 125 |
"\xBF", |
| 126 |
"\xC0", |
| 127 |
"\xC1", |
| 128 |
"\xC2", |
| 129 |
"\xC3", |
| 130 |
"\xC4", |
| 131 |
"\xC5", |
| 132 |
"\xC6", |
| 133 |
"\xC7", |
| 134 |
"\xC8", |
| 135 |
"\xC9", |
| 136 |
"\xCA", |
| 137 |
"\xCB", |
| 138 |
"\xCC", |
| 139 |
"\xCD", |
| 140 |
"\xCE", |
| 141 |
"\xCF", |
| 142 |
"\xD0", |
| 143 |
"\xD1", |
| 144 |
"\xD2", |
| 145 |
"\xD3", |
| 146 |
"\xD4", |
| 147 |
"\xD5", |
| 148 |
"\xD6", |
| 149 |
"\xD7", |
| 150 |
"\xD8", |
| 151 |
"\xD9", |
| 152 |
"\xDA", |
| 153 |
"\xDB", |
| 154 |
"\xDC", |
| 155 |
"\xDD", |
| 156 |
"\xDE", |
| 157 |
"\xDF", |
| 158 |
"\xE0", |
| 159 |
"\xE1", |
| 160 |
"\xE2", |
| 161 |
"\xE3", |
| 162 |
"\xE4", |
| 163 |
"\xE5", |
| 164 |
"\xE6", |
| 165 |
"\xE7", |
| 166 |
"\xE8", |
| 167 |
"\xE9", |
| 168 |
"\xEA", |
| 169 |
"\xEB", |
| 170 |
"\xEC", |
| 171 |
"\xED", |
| 172 |
"\xEE", |
| 173 |
"\xEF", |
| 174 |
"\xF0", |
| 175 |
"\xF1", |
| 176 |
"\xF2", |
| 177 |
"\xF3", |
| 178 |
"\xF4", |
| 179 |
"\xF5", |
| 180 |
"\xF6", |
| 181 |
"\xF7", |
| 182 |
"\xF8", |
| 183 |
"\xF9", |
| 184 |
"\xFA", |
| 185 |
"\xFB", |
| 186 |
"\xFC", |
| 187 |
"\xFD", |
| 188 |
"\xFE", |
| 189 |
"\xFF" |
| 190 |
); |
| 191 |
public static $qpReplaceValues = array( |
| 192 |
"=00", |
| 193 |
"=01", |
| 194 |
"=02", |
| 195 |
"=03", |
| 196 |
"=04", |
| 197 |
"=05", |
| 198 |
"=06", |
| 199 |
"=07", |
| 200 |
"=08", |
| 201 |
"=09", |
| 202 |
"=0A", |
| 203 |
"=0B", |
| 204 |
"=0C", |
| 205 |
"=0D", |
| 206 |
"=0E", |
| 207 |
"=0F", |
| 208 |
"=10", |
| 209 |
"=11", |
| 210 |
"=12", |
| 211 |
"=13", |
| 212 |
"=14", |
| 213 |
"=15", |
| 214 |
"=16", |
| 215 |
"=17", |
| 216 |
"=18", |
| 217 |
"=19", |
| 218 |
"=1A", |
| 219 |
"=1B", |
| 220 |
"=1C", |
| 221 |
"=1D", |
| 222 |
"=1E", |
| 223 |
"=1F", |
| 224 |
"=7F", |
| 225 |
"=80", |
| 226 |
"=81", |
| 227 |
"=82", |
| 228 |
"=83", |
| 229 |
"=84", |
| 230 |
"=85", |
| 231 |
"=86", |
| 232 |
"=87", |
| 233 |
"=88", |
| 234 |
"=89", |
| 235 |
"=8A", |
| 236 |
"=8B", |
| 237 |
"=8C", |
| 238 |
"=8D", |
| 239 |
"=8E", |
| 240 |
"=8F", |
| 241 |
"=90", |
| 242 |
"=91", |
| 243 |
"=92", |
| 244 |
"=93", |
| 245 |
"=94", |
| 246 |
"=95", |
| 247 |
"=96", |
| 248 |
"=97", |
| 249 |
"=98", |
| 250 |
"=99", |
| 251 |
"=9A", |
| 252 |
"=9B", |
| 253 |
"=9C", |
| 254 |
"=9D", |
| 255 |
"=9E", |
| 256 |
"=9F", |
| 257 |
"=A0", |
| 258 |
"=A1", |
| 259 |
"=A2", |
| 260 |
"=A3", |
| 261 |
"=A4", |
| 262 |
"=A5", |
| 263 |
"=A6", |
| 264 |
"=A7", |
| 265 |
"=A8", |
| 266 |
"=A9", |
| 267 |
"=AA", |
| 268 |
"=AB", |
| 269 |
"=AC", |
| 270 |
"=AD", |
| 271 |
"=AE", |
| 272 |
"=AF", |
| 273 |
"=B0", |
| 274 |
"=B1", |
| 275 |
"=B2", |
| 276 |
"=B3", |
| 277 |
"=B4", |
| 278 |
"=B5", |
| 279 |
"=B6", |
| 280 |
"=B7", |
| 281 |
"=B8", |
| 282 |
"=B9", |
| 283 |
"=BA", |
| 284 |
"=BB", |
| 285 |
"=BC", |
| 286 |
"=BD", |
| 287 |
"=BE", |
| 288 |
"=BF", |
| 289 |
"=C0", |
| 290 |
"=C1", |
| 291 |
"=C2", |
| 292 |
"=C3", |
| 293 |
"=C4", |
| 294 |
"=C5", |
| 295 |
"=C6", |
| 296 |
"=C7", |
| 297 |
"=C8", |
| 298 |
"=C9", |
| 299 |
"=CA", |
| 300 |
"=CB", |
| 301 |
"=CC", |
| 302 |
"=CD", |
| 303 |
"=CE", |
| 304 |
"=CF", |
| 305 |
"=D0", |
| 306 |
"=D1", |
| 307 |
"=D2", |
| 308 |
"=D3", |
| 309 |
"=D4", |
| 310 |
"=D5", |
| 311 |
"=D6", |
| 312 |
"=D7", |
| 313 |
"=D8", |
| 314 |
"=D9", |
| 315 |
"=DA", |
| 316 |
"=DB", |
| 317 |
"=DC", |
| 318 |
"=DD", |
| 319 |
"=DE", |
| 320 |
"=DF", |
| 321 |
"=E0", |
| 322 |
"=E1", |
| 323 |
"=E2", |
| 324 |
"=E3", |
| 325 |
"=E4", |
| 326 |
"=E5", |
| 327 |
"=E6", |
| 328 |
"=E7", |
| 329 |
"=E8", |
| 330 |
"=E9", |
| 331 |
"=EA", |
| 332 |
"=EB", |
| 333 |
"=EC", |
| 334 |
"=ED", |
| 335 |
"=EE", |
| 336 |
"=EF", |
| 337 |
"=F0", |
| 338 |
"=F1", |
| 339 |
"=F2", |
| 340 |
"=F3", |
| 341 |
"=F4", |
| 342 |
"=F5", |
| 343 |
"=F6", |
| 344 |
"=F7", |
| 345 |
"=F8", |
| 346 |
"=F9", |
| 347 |
"=FA", |
| 348 |
"=FB", |
| 349 |
"=FC", |
| 350 |
"=FD", |
| 351 |
"=FE", |
| 352 |
"=FF" |
| 353 |
); |
| 354 |
const LINELENGTH = 72; |
| 355 |
const LINEEND = "\n"; |
| 356 |
|
| 357 |
public static $fm_js_content; |
| 358 |
/** |
| 359 |
* Get request value. |
| 360 |
* |
| 361 |
* @param string $key |
| 362 |
* @param string $default_value |
| 363 |
* @param bool $esc_html |
| 364 |
* |
| 365 |
* @return string|array |
| 366 |
*/ |
| 367 |
public static function get($key, $default_value = '', $esc_html = true) { |
| 368 |
if (isset($_GET[$key])) { |
| 369 |
$value = $_GET[$key]; |
| 370 |
} |
| 371 |
elseif (isset($_POST[$key])) { |
| 372 |
$value = $_POST[$key]; |
| 373 |
} |
| 374 |
elseif (isset($_REQUEST[$key])) { |
| 375 |
$value = $_REQUEST[$key]; |
| 376 |
} |
| 377 |
else { |
| 378 |
$value = $default_value; |
| 379 |
} |
| 380 |
if (is_array($value)) { |
| 381 |
array_walk_recursive($value, array('self', 'validate_data'), $esc_html); |
| 382 |
} |
| 383 |
else { |
| 384 |
self::validate_data($value, $esc_html); |
| 385 |
} |
| 386 |
return $value; |
| 387 |
} |
| 388 |
|
| 389 |
/** |
| 390 |
* Validate data. |
| 391 |
* |
| 392 |
* @param $value |
| 393 |
* @param $esc_html |
| 394 |
*/ |
| 395 |
private static function validate_data(&$value, $esc_html) { |
| 396 |
$value = stripslashes($value); |
| 397 |
if ($esc_html) { |
| 398 |
$value = esc_html($value); |
| 399 |
} |
| 400 |
} |
| 401 |
|
| 402 |
/** |
| 403 |
* Generate message container by message id or directly by message. |
| 404 |
* |
| 405 |
* @param int $message_id |
| 406 |
* @param string $message If message_id is 0 |
| 407 |
* @param string $type |
| 408 |
* |
| 409 |
* @return mixed|string|void |
| 410 |
*/ |
| 411 |
public static function message_id($message_id, $message = '', $type = 'updated') { |
| 412 |
if ($message_id) { |
| 413 |
switch ( $message_id ) { |
| 414 |
case 1: { |
| 415 |
$message = 'Item Successfully Saved.'; |
| 416 |
$type = 'updated'; |
| 417 |
break; |
| 418 |
} |
| 419 |
case 2: { |
| 420 |
$message = 'Failed.'; |
| 421 |
$type = 'error'; |
| 422 |
break; |
| 423 |
} |
| 424 |
case 3: { |
| 425 |
$message = 'Item successfully deleted.'; |
| 426 |
$type = 'updated'; |
| 427 |
break; |
| 428 |
} |
| 429 |
case 4: { |
| 430 |
$message = "You can't delete default theme"; |
| 431 |
$type = 'error'; |
| 432 |
break; |
| 433 |
} |
| 434 |
case 5: { |
| 435 |
// Todo: delete message. |
| 436 |
$message = 'Items successfully deleted.'; |
| 437 |
$type = 'updated'; |
| 438 |
break; |
| 439 |
} |
| 440 |
case 6: { |
| 441 |
// Todo: delete message. |
| 442 |
$message = 'You must select at least one item.'; |
| 443 |
$type = 'error'; |
| 444 |
break; |
| 445 |
} |
| 446 |
case 7: { |
| 447 |
$message = 'The item is successfully set as default.'; |
| 448 |
$type = 'updated'; |
| 449 |
break; |
| 450 |
} |
| 451 |
case 8: { |
| 452 |
$message = 'Options Successfully Saved.'; |
| 453 |
$type = 'updated'; |
| 454 |
break; |
| 455 |
} |
| 456 |
case 9: |
| 457 |
$message = 'Item successfully published.'; |
| 458 |
$type = 'updated'; |
| 459 |
break; |
| 460 |
case 10: |
| 461 |
$message = 'Item successfully unpublished.'; |
| 462 |
$type = 'updated'; |
| 463 |
break; |
| 464 |
case 11: |
| 465 |
$message = 'Item successfully duplicated.'; |
| 466 |
$type = 'updated'; |
| 467 |
break; |
| 468 |
case 12: |
| 469 |
$message = 'IP Successfully Blocked.'; |
| 470 |
$type = 'updated'; |
| 471 |
break; |
| 472 |
case 13: |
| 473 |
$message = 'IP Successfully Unblocked.'; |
| 474 |
$type = 'updated'; |
| 475 |
break; |
| 476 |
case 14: |
| 477 |
$message = 'Submission Successfully Saved.'; |
| 478 |
$type = 'updated'; |
| 479 |
break; |
| 480 |
default: { |
| 481 |
$message = ''; |
| 482 |
break; |
| 483 |
} |
| 484 |
} |
| 485 |
} |
| 486 |
|
| 487 |
if ($message) { |
| 488 |
ob_start(); |
| 489 |
?><div class="<?php echo $type; ?> inline"> |
| 490 |
<p> |
| 491 |
<strong><?php echo $message; ?></strong> |
| 492 |
</p> |
| 493 |
</div><?php |
| 494 |
$message = ob_get_clean(); |
| 495 |
} |
| 496 |
|
| 497 |
return $message; |
| 498 |
} |
| 499 |
|
| 500 |
/** |
| 501 |
* Generate message. |
| 502 |
* |
| 503 |
* @param string $message |
| 504 |
* @param string $type |
| 505 |
* |
| 506 |
* @return mixed|string|void |
| 507 |
*/ |
| 508 |
public static function message($message, $type) { |
| 509 |
if ( $message ) { |
| 510 |
ob_start(); |
| 511 |
?><div class="fm-message <?php echo $type; ?>"><?php echo $message; ?></div><?php |
| 512 |
$message = ob_get_clean(); |
| 513 |
} |
| 514 |
return $message; |
| 515 |
} |
| 516 |
|
| 517 |
public static function fm_container($theme_id, $form_body) { |
| 518 |
return '<div style="display:none" class="fm-form-container fm-theme' . $theme_id . '">' . $form_body . '</div>'; |
| 519 |
} |
| 520 |
|
| 521 |
/** |
| 522 |
* Ordering. |
| 523 |
* |
| 524 |
* @param $id |
| 525 |
* @param $orderby |
| 526 |
* @param $order |
| 527 |
* @param $text |
| 528 |
* @param $page_url |
| 529 |
* @param string $additional_class |
| 530 |
* |
| 531 |
* @return string |
| 532 |
*/ |
| 533 |
public static function ordering($id, $orderby, $order, $text, $page_url, $additional_class = '') { |
| 534 |
$class = array( |
| 535 |
($orderby == $id ? 'sorted': 'sortable'), |
| 536 |
$order, |
| 537 |
$additional_class, |
| 538 |
'col_' . $id, |
| 539 |
); |
| 540 |
$order = (($orderby == $id) && ($order == 'asc')) ? 'desc' : 'asc'; |
| 541 |
ob_start(); |
| 542 |
?> |
| 543 |
<th id="<?php echo $id; ?>" class="<?php echo implode(' ', $class); ?>"> |
| 544 |
<a href="<?php echo add_query_arg( array('orderby' => $id, 'order' => $order), $page_url ); ?>" |
| 545 |
title="<?php _e('Click to sort by this item', WDFMInstance(self::PLUGIN)->prefix); ?>"> |
| 546 |
<span><?php echo $text; ?></span><span class="sorting-indicator"></span> |
| 547 |
</a> |
| 548 |
</th> |
| 549 |
<?php |
| 550 |
return ob_get_clean(); |
| 551 |
} |
| 552 |
|
| 553 |
//Todo: remove this function. |
| 554 |
public static function search($search_by, $search_value, $form_id) { |
| 555 |
?> |
| 556 |
<div class="alignleft actions" style="clear:both;"> |
| 557 |
<script> |
| 558 |
function fm_search() { |
| 559 |
document.getElementById("page_number").value = "1"; |
| 560 |
document.getElementById("search_or_not").value = "search"; |
| 561 |
document.getElementById("<?php echo $form_id; ?>").submit(); |
| 562 |
} |
| 563 |
function fm_reset() { |
| 564 |
if (document.getElementById("search_value")) { |
| 565 |
document.getElementById("search_value").value = ""; |
| 566 |
} |
| 567 |
if (document.getElementById("search_select_value")) { |
| 568 |
document.getElementById("search_select_value").value = 0; |
| 569 |
} |
| 570 |
document.getElementById("<?php echo $form_id; ?>").submit(); |
| 571 |
} |
| 572 |
</script> |
| 573 |
<div class="fm-search"> |
| 574 |
<label for="search_value"><?php echo $search_by; ?>:</label> |
| 575 |
<input type="text" id="search_value" name="search_value" value="<?php echo esc_html($search_value); ?>"/> |
| 576 |
<button class="fm-icon search-icon" onclick="fm_search()"> |
| 577 |
</button> |
| 578 |
<button class="fm-icon reset-icon" onclick="fm_reset()"> |
| 579 |
</button> |
| 580 |
</div> |
| 581 |
</div> |
| 582 |
<?php |
| 583 |
} |
| 584 |
|
| 585 |
public static function search_select($search_by, $search_select_value, $playlists, $form_id) { |
| 586 |
?> |
| 587 |
<div class="alignleft actions" style="clear:both;"> |
| 588 |
<script> |
| 589 |
function fm_search_select() { |
| 590 |
document.getElementById("page_number").value = "1"; |
| 591 |
document.getElementById("search_or_not").value = "search"; |
| 592 |
document.getElementById("<?php echo $form_id; ?>").submit(); |
| 593 |
} |
| 594 |
</script> |
| 595 |
<div class="alignleft actions" > |
| 596 |
<label for="search_select_value" style="font-size:14px; width:50px; display:inline-block;"><?php echo $search_by; ?>:</label> |
| 597 |
<select id="search_select_value" name="search_select_value" onchange="fm_search_select();" style="float: none; width: 150px;"> |
| 598 |
<?php |
| 599 |
foreach ($playlists as $id => $playlist) { |
| 600 |
?> |
| 601 |
<option value="<?php echo $id; ?>" <?php echo (($search_select_value == $id) ? 'selected="selected"' : ''); ?>><?php echo $playlist; ?></option> |
| 602 |
<?php |
| 603 |
} |
| 604 |
?> |
| 605 |
</select> |
| 606 |
</div> |
| 607 |
</div> |
| 608 |
<?php |
| 609 |
} |
| 610 |
|
| 611 |
//Todo: remove this function. |
| 612 |
public static function html_page_nav($count_items, $page_number, $form_id, $items_per_page = 20) { |
| 613 |
$limit = 20; |
| 614 |
if ($count_items) { |
| 615 |
if ($count_items % $limit) { |
| 616 |
$items_county = ($count_items - $count_items % $limit) / $limit + 1; |
| 617 |
} |
| 618 |
else { |
| 619 |
$items_county = ($count_items - $count_items % $limit) / $limit; |
| 620 |
} |
| 621 |
} |
| 622 |
else { |
| 623 |
$items_county = 1; |
| 624 |
} |
| 625 |
?> |
| 626 |
<script type="text/javascript"> |
| 627 |
var items_county = <?php echo $items_county; ?>; |
| 628 |
function fm_page(x, y) { |
| 629 |
switch (y) { |
| 630 |
case 1: |
| 631 |
if (x >= items_county) { |
| 632 |
document.getElementById('page_number').value = items_county; |
| 633 |
} |
| 634 |
else { |
| 635 |
document.getElementById('page_number').value = x + 1; |
| 636 |
} |
| 637 |
break; |
| 638 |
case 2: |
| 639 |
document.getElementById('page_number').value = items_county; |
| 640 |
break; |
| 641 |
case -1: |
| 642 |
if (x == 1) { |
| 643 |
document.getElementById('page_number').value = 1; |
| 644 |
} |
| 645 |
else { |
| 646 |
document.getElementById('page_number').value = x - 1; |
| 647 |
} |
| 648 |
break; |
| 649 |
case -2: |
| 650 |
document.getElementById('page_number').value = 1; |
| 651 |
break; |
| 652 |
default: |
| 653 |
document.getElementById('page_number').value = 1; |
| 654 |
} |
| 655 |
|
| 656 |
jQuery('#pagination_clicked').val('1'); |
| 657 |
document.getElementById('<?php echo $form_id; ?>').submit(); |
| 658 |
} |
| 659 |
|
| 660 |
function check_enter_key(e) { |
| 661 |
var key_code = (e.keyCode ? e.keyCode : e.which); |
| 662 |
if (key_code == 13) { /*Enter keycode*/ |
| 663 |
if (jQuery('#current_page').val() >= items_county) { |
| 664 |
document.getElementById('page_number').value = items_county; |
| 665 |
} |
| 666 |
else { |
| 667 |
document.getElementById('page_number').value = jQuery('#current_page').val(); |
| 668 |
} |
| 669 |
jQuery('#pagination_clicked').val('1'); |
| 670 |
document.getElementById('<?php echo $form_id; ?>').submit(); |
| 671 |
} |
| 672 |
return true; |
| 673 |
} |
| 674 |
</script> |
| 675 |
<div class="tablenav-pages"> |
| 676 |
<span class="displaying-num"> |
| 677 |
<?php |
| 678 |
if ($count_items != 0) { |
| 679 |
echo $count_items; ?> item<?php echo (($count_items == 1) ? '' : 's'); |
| 680 |
} |
| 681 |
?> |
| 682 |
</span> |
| 683 |
<?php |
| 684 |
if ($count_items > $items_per_page) { |
| 685 |
$first_page = "first-page"; |
| 686 |
$prev_page = "prev-page"; |
| 687 |
$next_page = "next-page"; |
| 688 |
$last_page = "last-page"; |
| 689 |
if ($page_number == 1) { |
| 690 |
$first_page = "first-page disabled"; |
| 691 |
$prev_page = "prev-page disabled"; |
| 692 |
$next_page = "next-page"; |
| 693 |
$last_page = "last-page"; |
| 694 |
} |
| 695 |
if ($page_number >= $items_county) { |
| 696 |
$first_page = "first-page "; |
| 697 |
$prev_page = "prev-page"; |
| 698 |
$next_page = "next-page disabled"; |
| 699 |
$last_page = "last-page disabled"; |
| 700 |
} |
| 701 |
?> |
| 702 |
<span class="pagination-links"> |
| 703 |
<a class="<?php echo $first_page; ?>" title="Go to the first page" href="javascript:fm_page(<?php echo $page_number; ?>,-2);">«</a> |
| 704 |
<a class="<?php echo $prev_page; ?>" title="Go to the previous page" href="javascript:fm_page(<?php echo $page_number; ?>,-1);">‹</a> |
| 705 |
<span class="paging-input"> |
| 706 |
<span class="total-pages"> |
| 707 |
<input class="current_page" id="current_page" name="current_page" value="<?php echo $page_number; ?>" onkeypress="return check_enter_key(event)" title="Go to the page" type="text" size="1" /> |
| 708 |
</span> of |
| 709 |
<span class="total-pages"> |
| 710 |
<?php echo $items_county; ?> |
| 711 |
</span> |
| 712 |
</span> |
| 713 |
<a class="<?php echo $next_page ?>" title="Go to the next page" href="javascript:fm_page(<?php echo $page_number; ?>,1);">›</a> |
| 714 |
<a class="<?php echo $last_page ?>" title="Go to the last page" href="javascript:fm_page(<?php echo $page_number; ?>,2);">»</a> |
| 715 |
<?php |
| 716 |
} |
| 717 |
?> |
| 718 |
</span> |
| 719 |
</div> |
| 720 |
<input type="hidden" id="page_number" name="page_number" value="<?php echo ((isset($_POST['page_number'])) ? (int) $_POST['page_number'] : 1); ?>" /> |
| 721 |
<input type="hidden" id="search_or_not" name="search_or_not" value="<?php echo ((isset($_POST['search_or_not'])) ? esc_html($_POST['search_or_not']) : ''); ?>"/> |
| 722 |
<?php |
| 723 |
} |
| 724 |
|
| 725 |
public static function ajax_search($search_by, $search_value, $form_id) { |
| 726 |
?> |
| 727 |
<div class="alignleft actions" style="clear:both;"> |
| 728 |
<script> |
| 729 |
function fm_search() { |
| 730 |
document.getElementById("page_number").value = "1"; |
| 731 |
document.getElementById("search_or_not").value = "search"; |
| 732 |
fm_ajax_save('<?php echo $form_id; ?>'); |
| 733 |
} |
| 734 |
function fm_reset() { |
| 735 |
if (document.getElementById("search_value")) { |
| 736 |
document.getElementById("search_value").value = ""; |
| 737 |
} |
| 738 |
fm_ajax_save('<?php echo $form_id; ?>'); |
| 739 |
} |
| 740 |
</script> |
| 741 |
<div class="alignleft actions" style=""> |
| 742 |
<label for="search_value" style="font-size:14px; width:60px; display:inline-block;"><?php echo $search_by; ?>:</label> |
| 743 |
<input type="text" id="search_value" name="search_value" class="fm_search_value" value="<?php echo esc_html($search_value); ?>" style="width: 150px;<?php echo (get_bloginfo('version') > '3.7') ? ' height: 28px;' : ''; ?>" /> |
| 744 |
</div> |
| 745 |
<div class="alignleft actions"> |
| 746 |
<input type="button" value="Search" onclick="fm_search()" class="button-secondary action"> |
| 747 |
<input type="button" value="Reset" onclick="fm_reset()" class="button-secondary action"> |
| 748 |
</div> |
| 749 |
</div> |
| 750 |
<?php |
| 751 |
} |
| 752 |
|
| 753 |
public static function ajax_html_page_nav($count_items, $page_number, $form_id) { |
| 754 |
$limit = 20; |
| 755 |
if ($count_items) { |
| 756 |
if ($count_items % $limit) { |
| 757 |
$items_county = ($count_items - $count_items % $limit) / $limit + 1; |
| 758 |
} |
| 759 |
else { |
| 760 |
$items_county = ($count_items - $count_items % $limit) / $limit; |
| 761 |
} |
| 762 |
} |
| 763 |
else { |
| 764 |
$items_county = 1; |
| 765 |
} |
| 766 |
?> |
| 767 |
<script type="text/javascript"> |
| 768 |
var items_county = <?php echo $items_county; ?>; |
| 769 |
function fm_page(x, y) { |
| 770 |
switch (y) { |
| 771 |
case 1: |
| 772 |
if (x >= items_county) { |
| 773 |
document.getElementById('page_number').value = items_county; |
| 774 |
} |
| 775 |
else { |
| 776 |
document.getElementById('page_number').value = x + 1; |
| 777 |
} |
| 778 |
break; |
| 779 |
case 2: |
| 780 |
document.getElementById('page_number').value = items_county; |
| 781 |
break; |
| 782 |
case -1: |
| 783 |
if (x == 1) { |
| 784 |
document.getElementById('page_number').value = 1; |
| 785 |
} |
| 786 |
else { |
| 787 |
document.getElementById('page_number').value = x - 1; |
| 788 |
} |
| 789 |
break; |
| 790 |
case -2: |
| 791 |
document.getElementById('page_number').value = 1; |
| 792 |
break; |
| 793 |
default: |
| 794 |
document.getElementById('page_number').value = 1; |
| 795 |
} |
| 796 |
fm_ajax_save('<?php echo $form_id; ?>'); |
| 797 |
} |
| 798 |
function check_enter_key(e) { |
| 799 |
var key_code = (e.keyCode ? e.keyCode : e.which); |
| 800 |
if (key_code == 13) { /*Enter keycode*/ |
| 801 |
if (jQuery('#current_page').val() >= items_county) { |
| 802 |
document.getElementById('page_number').value = items_county; |
| 803 |
} |
| 804 |
else { |
| 805 |
document.getElementById('page_number').value = jQuery('#current_page').val(); |
| 806 |
} |
| 807 |
|
| 808 |
fm_ajax_save('<?php echo $form_id; ?>'); |
| 809 |
return false; |
| 810 |
} |
| 811 |
return true; |
| 812 |
} |
| 813 |
</script> |
| 814 |
<div id="tablenav-pages" class="tablenav-pages"> |
| 815 |
<span class="displaying-num"> |
| 816 |
<?php |
| 817 |
if ($count_items != 0) { |
| 818 |
echo $count_items; ?> item<?php echo (($count_items == 1) ? '' : 's'); |
| 819 |
} |
| 820 |
?> |
| 821 |
</span> |
| 822 |
<?php |
| 823 |
if ($count_items > $limit) { |
| 824 |
$first_page = "first-page"; |
| 825 |
$prev_page = "prev-page"; |
| 826 |
$next_page = "next-page"; |
| 827 |
$last_page = "last-page"; |
| 828 |
if ($page_number == 1) { |
| 829 |
$first_page = "first-page disabled"; |
| 830 |
$prev_page = "prev-page disabled"; |
| 831 |
$next_page = "next-page"; |
| 832 |
$last_page = "last-page"; |
| 833 |
} |
| 834 |
if ($page_number >= $items_county) { |
| 835 |
$first_page = "first-page "; |
| 836 |
$prev_page = "prev-page"; |
| 837 |
$next_page = "next-page disabled"; |
| 838 |
$last_page = "last-page disabled"; |
| 839 |
} |
| 840 |
?> |
| 841 |
<span class="pagination-links"> |
| 842 |
<a class="<?php echo $first_page; ?>" title="Go to the first page" onclick="fm_page(<?php echo $page_number; ?>,-2)">«</a> |
| 843 |
<a class="<?php echo $prev_page; ?>" title="Go to the previous page" onclick="fm_page(<?php echo $page_number; ?>,-1)">‹</a> |
| 844 |
<span class="paging-input"> |
| 845 |
<span class="total-pages"> |
| 846 |
<input class="current_page" id="current_page" name="current_page" value="<?php echo $page_number; ?>" onkeypress="return check_enter_key(event)" title="Go to the page" type="text" size="1" /> |
| 847 |
</span> of |
| 848 |
<span class="total-pages"> |
| 849 |
<?php echo $items_county; ?> |
| 850 |
</span> |
| 851 |
</span> |
| 852 |
<a class="<?php echo $next_page ?>" title="Go to the next page" onclick="fm_page(<?php echo $page_number; ?>,1)">›</a> |
| 853 |
<a class="<?php echo $last_page ?>" title="Go to the last page" onclick="fm_page(<?php echo $page_number; ?>,2)">»</a> |
| 854 |
<?php |
| 855 |
} |
| 856 |
?> |
| 857 |
</span> |
| 858 |
</div> |
| 859 |
<input type="hidden" id="page_number" name="page_number" value="<?php echo ((isset($_POST['page_number'])) ? (int) $_POST['page_number'] : 1); ?>" /> |
| 860 |
<input type="hidden" id="search_or_not" name="search_or_not" value="<?php echo ((isset($_POST['search_or_not'])) ? esc_html($_POST['search_or_not']) : ''); ?>"/> |
| 861 |
<?php |
| 862 |
} |
| 863 |
|
| 864 |
/** |
| 865 |
* FM Redirect. |
| 866 |
* |
| 867 |
* @param $url |
| 868 |
* @param bool $nonce |
| 869 |
*/ |
| 870 |
public static function fm_redirect( $url, $nonce = true ) { |
| 871 |
$url = html_entity_decode($url); |
| 872 |
if ( $nonce ) { |
| 873 |
$url = html_entity_decode(wp_nonce_url($url, WDFMInstance(self::PLUGIN)->nonce, WDFMInstance(self::PLUGIN)->nonce)); |
| 874 |
} |
| 875 |
?> |
| 876 |
<script> |
| 877 |
window.location = "<?php echo $url; ?>"; |
| 878 |
</script> |
| 879 |
<?php |
| 880 |
exit(); |
| 881 |
} |
| 882 |
|
| 883 |
public static function get_google_fonts() { |
| 884 |
$google_fonts = array( 'Open Sans' => 'Open Sans', 'Oswald' => 'Oswald', 'Droid Sans' => 'Droid Sans', 'Lato' => 'Lato', 'Open Sans Condensed' => 'Open Sans Condensed', 'PT Sans' => 'PT Sans', 'Ubuntu' => 'Ubuntu', 'PT Sans Narrow' => 'PT Sans Narrow', 'Yanone Kaffeesatz' => 'Yanone Kaffeesatz', 'Roboto Condensed' => 'Roboto Condensed', 'Source Sans Pro' => 'Source Sans Pro', 'Nunito' => 'Nunito', 'Francois One' => 'Francois One', 'Roboto' => 'Roboto', 'Raleway' => 'Raleway', 'Arimo' => 'Arimo', 'Cuprum' => 'Cuprum', 'Play' => 'Play', 'Dosis' => 'Dosis', 'Abel' => 'Abel', 'Droid Serif' => 'Droid Serif', 'Arvo' => 'Arvo', 'Lora' => 'Lora', 'Rokkitt' => 'Rokkitt', 'PT Serif' => 'PT Serif', 'Bitter' => 'Bitter', 'Merriweather' => 'Merriweather', 'Vollkorn' => 'Vollkorn', 'Cantata One' => 'Cantata One', 'Kreon' => 'Kreon', 'Josefin Slab' => 'Josefin Slab', 'Playfair Display' => 'Playfair Display', 'Bree Serif' => 'Bree Serif', 'Crimson Text' => 'Crimson Text', 'Old Standard TT' => 'Old Standard TT', 'Sanchez' => 'Sanchez', 'Crete Round' => 'Crete Round', 'Cardo' => 'Cardo', 'Noticia Text' => 'Noticia Text', 'Judson' => 'Judson', 'Lobster' => 'Lobster', 'Unkempt' => 'Unkempt', 'Changa One' => 'Changa One', 'Special Elite' => 'Special Elite', 'Chewy' => 'Chewy', 'Comfortaa' => 'Comfortaa', 'Boogaloo' => 'Boogaloo', 'Fredoka One' => 'Fredoka One', 'Luckiest Guy' => 'Luckiest Guy', 'Cherry Cream Soda' => 'Cherry Cream Soda', 'Lobster Two' => 'Lobster Two', 'Righteous' => 'Righteous', 'Squada One' => 'Squada One', 'Black Ops One' => 'Black Ops One', 'Happy Monkey' => 'Happy Monkey', 'Passion One' => 'Passion One', 'Nova Square' => 'Nova Square', 'Metamorphous' => 'Metamorphous', 'Poiret One' => 'Poiret One', 'Bevan' => 'Bevan', 'Shadows Into Light' => 'Shadows Into Light', 'The Girl Next Door' => 'The Girl Next Door', 'Coming Soon' => 'Coming Soon', 'Dancing Script' => 'Dancing Script', 'Pacifico' => 'Pacifico', 'Crafty Girls' => 'Crafty Girls', 'Calligraffitti' => 'Calligraffitti', 'Rock Salt' => 'Rock Salt', 'Amatic SC' => 'Amatic SC', 'Leckerli One' => 'Leckerli One', 'Tangerine' => 'Tangerine', 'Reenie Beanie' => 'Reenie Beanie', 'Satisfy' => 'Satisfy', 'Gloria Hallelujah' => 'Gloria Hallelujah', 'Permanent Marker' => 'Permanent Marker', 'Covered By Your Grace' => 'Covered By Your Grace', 'Walter Turncoat' => 'Walter Turncoat', 'Patrick Hand' => 'Patrick Hand', 'Schoolbell' => 'Schoolbell', 'Indie Flower' => 'Indie Flower' ); |
| 885 |
return $google_fonts; |
| 886 |
} |
| 887 |
|
| 888 |
public static function cleanData( &$str ) { |
| 889 |
$str = preg_replace("/\t/", "\\t", $str); |
| 890 |
$str = preg_replace("/\r?\n/", "\\n", $str); |
| 891 |
if ( strstr($str, '"') ) { |
| 892 |
$str = '"' . str_replace('"', '""', $str) . '"'; |
| 893 |
} |
| 894 |
$str = ltrim($str, '=+-@'); |
| 895 |
} |
| 896 |
|
| 897 |
/** |
| 898 |
* Get display options. |
| 899 |
* |
| 900 |
* @param $id |
| 901 |
* |
| 902 |
* @return array|null|object|stdClass|void |
| 903 |
*/ |
| 904 |
public static function display_options( $id ) { |
| 905 |
global $wpdb; |
| 906 |
$row = $wpdb->get_row('SELECT * FROM ' . $wpdb->prefix . 'formmaker_display_options as display WHERE form_id = ' . (int) $id); |
| 907 |
if ( !$row ) { |
| 908 |
$row = new stdClass(); |
| 909 |
$row->form_id = $id; |
| 910 |
$row->type = 'embedded'; |
| 911 |
$row->scrollbox_loading_delay = 0; |
| 912 |
$row->popover_animate_effect = ''; |
| 913 |
$row->popover_loading_delay = 0; |
| 914 |
$row->popover_frequency = 0; |
| 915 |
$row->topbar_position = 1; |
| 916 |
$row->topbar_remain_top = 1; |
| 917 |
$row->topbar_closing = 1; |
| 918 |
$row->topbar_hide_duration = 0; |
| 919 |
$row->scrollbox_position = 1; |
| 920 |
$row->scrollbox_trigger_point = 20; |
| 921 |
$row->scrollbox_hide_duration = 0; |
| 922 |
$row->scrollbox_auto_hide = 1; |
| 923 |
$row->hide_mobile = 0; |
| 924 |
$row->scrollbox_closing = 1; |
| 925 |
$row->scrollbox_minimize = 1; |
| 926 |
$row->scrollbox_minimize_text = ''; |
| 927 |
$row->display_on = 'home,post,page'; |
| 928 |
$row->posts_include = ''; |
| 929 |
$row->pages_include = ''; |
| 930 |
$row->display_on_categories = 'select_all_categories'; |
| 931 |
$row->current_categories = 'select_all_categories'; |
| 932 |
$row->show_for_admin = 0; |
| 933 |
} |
| 934 |
|
| 935 |
return $row; |
| 936 |
} |
| 937 |
|
| 938 |
/** |
| 939 |
* Create js file. |
| 940 |
* |
| 941 |
* @param $form_id |
| 942 |
* @param bool $force_rewrite |
| 943 |
*/ |
| 944 |
public static function create_js( $form_id, $force_rewrite = FALSE ) { |
| 945 |
$wp_upload_dir = wp_upload_dir(); |
| 946 |
$frontend_dir = '/form-maker-frontend/'; |
| 947 |
if ( !is_dir($wp_upload_dir['basedir'] . $frontend_dir) ) { |
| 948 |
mkdir($wp_upload_dir['basedir'] . $frontend_dir); |
| 949 |
file_put_contents($wp_upload_dir['basedir'] . $frontend_dir . 'index.html', self::forbidden_template()); |
| 950 |
} |
| 951 |
if ( !is_dir($wp_upload_dir['basedir'] . $frontend_dir . 'js') ) { |
| 952 |
mkdir($wp_upload_dir['basedir'] . $frontend_dir . 'js'); |
| 953 |
file_put_contents($wp_upload_dir['basedir'] . $frontend_dir . 'js/index.html', self::forbidden_template()); |
| 954 |
} |
| 955 |
$frontend_js = $wp_upload_dir['basedir'] . $frontend_dir . 'js/fm-script-' . $form_id . '.js'; |
| 956 |
if ( !$force_rewrite && file_exists($frontend_js) ) { |
| 957 |
return; |
| 958 |
} |
| 959 |
global $wpdb; |
| 960 |
$row = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'formmaker WHERE id="%d"', $form_id)); |
| 961 |
if ( !$row ) { |
| 962 |
return; |
| 963 |
} |
| 964 |
|
| 965 |
clearstatcache(); |
| 966 |
$jsfile = fopen($frontend_js, "w"); |
| 967 |
$pattern = '/\/\/(.+)(\r\n|\r|\n)/'; |
| 968 |
|
| 969 |
$row_display = self::display_options($form_id); |
| 970 |
$row->javascript = str_replace('function before_reset()', 'function before_reset' . $form_id . '()', $row->javascript); |
| 971 |
$row->javascript = str_replace('function before_load()', 'function before_load' . $form_id . '()', $row->javascript); |
| 972 |
$row->javascript = str_replace('function before_submit()', 'function before_submit' . $form_id . '()', $row->javascript); |
| 973 |
$row->javascript = str_replace('function after_submit()', 'function after_submit' . $form_id . '()', $row->javascript); |
| 974 |
$check_js = ''; |
| 975 |
$onload_js = ''; |
| 976 |
$onsubmit_js = ''; |
| 977 |
$form_currency = '$'; |
| 978 |
if ( $row->payment_currency ) { |
| 979 |
$form_currency = $row->payment_currency; |
| 980 |
} |
| 981 |
$form_currency = apply_filters('fm_form_currency', $form_currency, $form_id); |
| 982 |
$form_currency = self::replace_currency_code( $form_currency ); |
| 983 |
$form_paypal_tax = 0; |
| 984 |
if ( $row->paypal_mode && $row->paypal_mode == 1 ) { |
| 985 |
$form_paypal_tax = $row->tax; |
| 986 |
} |
| 987 |
if ( $row->paypal_mode && $row->paypal_mode == 2 ) { |
| 988 |
$stripe_data = apply_filters('fm_addon_stripe_get_data_init', array('form_id' => $form_id)); |
| 989 |
$form_paypal_tax = $stripe_data->stripe_tax; |
| 990 |
} |
| 991 |
$is_type = array(); |
| 992 |
$id1s = array(); |
| 993 |
$types = array(); |
| 994 |
$labels = array(); |
| 995 |
$paramss = array(); |
| 996 |
$fields = explode('*:*new_field*:*', $row->form_fields); |
| 997 |
$fields = array_slice($fields, 0, count($fields) - 1); |
| 998 |
foreach ( $fields as $field ) { |
| 999 |
$temp = explode('*:*id*:*', $field); |
| 1000 |
array_push($id1s, $temp[0]); |
| 1001 |
$temp = explode('*:*type*:*', $temp[1]); |
| 1002 |
array_push($types, $temp[0]); |
| 1003 |
$temp = explode('*:*w_field_label*:*', $temp[1]); |
| 1004 |
array_push($labels, $temp[0]); |
| 1005 |
array_push($paramss, $temp[1]); |
| 1006 |
} |
| 1007 |
$labels_and_ids = array_combine($id1s, $types); |
| 1008 |
$show_hide = array(); |
| 1009 |
$field_label = array(); |
| 1010 |
$all_any = array(); |
| 1011 |
$condition_params = array(); |
| 1012 |
$type_and_id = array(); |
| 1013 |
$condition_js = ''; |
| 1014 |
if ( $row->condition != "" ) { |
| 1015 |
$conditions = explode('*:*new_condition*:*', $row->condition); |
| 1016 |
$conditions = array_slice($conditions, 0, count($conditions) - 1); |
| 1017 |
$count_of_conditions = count($conditions); |
| 1018 |
foreach ( $conditions as $condition ) { |
| 1019 |
$temp = explode('*:*show_hide*:*', $condition); |
| 1020 |
array_push($show_hide, $temp[0]); |
| 1021 |
$temp = explode('*:*field_label*:*', $temp[1]); |
| 1022 |
array_push($field_label, $temp[0]); |
| 1023 |
$temp = explode('*:*all_any*:*', $temp[1]); |
| 1024 |
array_push($all_any, $temp[0]); |
| 1025 |
array_push($condition_params, $temp[1]); |
| 1026 |
} |
| 1027 |
foreach ( $id1s as $id1s_key => $id1 ) { |
| 1028 |
$type_and_id[$id1] = $types[$id1s_key]; |
| 1029 |
} |
| 1030 |
for ( $k = 0; $k < $count_of_conditions; $k++ ) { |
| 1031 |
if ( $show_hide[$k] ) { |
| 1032 |
$display = 'removeAttr("style")'; |
| 1033 |
$display_none = 'css("display", "none")'; |
| 1034 |
} |
| 1035 |
else { |
| 1036 |
$display = 'css("display", "none")'; |
| 1037 |
$display_none = 'removeAttr("style")'; |
| 1038 |
} |
| 1039 |
if ( $all_any[$k] == "and" ) { |
| 1040 |
$or_and = '&&'; |
| 1041 |
} |
| 1042 |
else { |
| 1043 |
$or_and = '||'; |
| 1044 |
} |
| 1045 |
if ( $condition_params[$k] ) { |
| 1046 |
$cond_params = explode('*:*next_condition*:*', $condition_params[$k]); |
| 1047 |
$cond_params = array_slice($cond_params, 0, count($cond_params) - 1); |
| 1048 |
for ( $l = 0; $l < count($cond_params); $l++ ) { |
| 1049 |
$params_value = explode('***', $cond_params[$l]); |
| 1050 |
if ( !isset($type_and_id[$params_value[0]]) ) { |
| 1051 |
unset($cond_params[$l]); |
| 1052 |
} |
| 1053 |
} |
| 1054 |
$cond_params = array_values($cond_params); |
| 1055 |
$if = ''; |
| 1056 |
$keyup = ''; |
| 1057 |
$change = ''; |
| 1058 |
$click = ''; |
| 1059 |
$blur = ''; |
| 1060 |
for ( $m = 0; $m < count($cond_params); $m++ ) { |
| 1061 |
$params_value = explode('***', wp_specialchars_decode($cond_params[$m], 'single')); |
| 1062 |
switch ( $type_and_id[$params_value[0]] ) { |
| 1063 |
case "type_text": |
| 1064 |
case "type_star_rating": |
| 1065 |
case "type_password": |
| 1066 |
case "type_textarea": |
| 1067 |
case "type_number": |
| 1068 |
case "type_submitter_mail": |
| 1069 |
case "type_spinner": |
| 1070 |
case "type_paypal_price_new": |
| 1071 |
case "type_date_new": |
| 1072 |
case "type_phone_new": |
| 1073 |
if ( $params_value[1] == "%" || $params_value[1] == "!%" ) { |
| 1074 |
$like_or_not = ($params_value[1] == "%" ? ">" : "=="); |
| 1075 |
$if .= ' jQuery("#wdform_' . $params_value[0] . '_element' . $form_id . '").val().indexOf("' . $params_value[2] . '")' . $like_or_not . '-1 '; |
| 1076 |
} |
| 1077 |
else { |
| 1078 |
if ( $params_value[1] == "=" || $params_value[1] == "!" ) { |
| 1079 |
$params_value[2] = ""; |
| 1080 |
$params_value[1] = $params_value[1] . "="; |
| 1081 |
} |
| 1082 |
if ( $type_and_id[$params_value[0]] == "type_star_rating" ) { |
| 1083 |
$if .= ' jQuery("#wdform_' . $params_value[0] . '_selected_star_amount' . $form_id . '").val()' . $params_value[1] . '"' . $params_value[2] . '" '; |
| 1084 |
} |
| 1085 |
else { |
| 1086 |
$if .= ' jQuery("#wdform_' . $params_value[0] . '_element' . $form_id . '").val()' . $params_value[1] . '"' . $params_value[2] . '" '; |
| 1087 |
} |
| 1088 |
} |
| 1089 |
$keyup .= '#wdform_' . $params_value[0] . '_element' . $form_id . ', '; |
| 1090 |
if ( $type_and_id[$params_value[0]] == "type_date_new" ) { |
| 1091 |
$change .= '#wdform_' . $params_value[0] . '_element' . $form_id . ', '; |
| 1092 |
} |
| 1093 |
if ( $type_and_id[$params_value[0]] == "type_spinner" ) { |
| 1094 |
$click .= '#wdform_' . $params_value[0] . '_element' . $form_id . ' ~ a, '; |
| 1095 |
} |
| 1096 |
if ( $type_and_id[$params_value[0]] == "type_star_rating" ) { |
| 1097 |
$change .= '#wdform_' . $params_value[0] . '_selected_star_amount' . $form_id . ', '; |
| 1098 |
} |
| 1099 |
if ( $type_and_id[$params_value[0]] == "type_phone_new" ) { |
| 1100 |
$blur = '#wdform_' . $params_value[0] . '_element' . $form_id . ', '; |
| 1101 |
} |
| 1102 |
break; |
| 1103 |
case "type_name": |
| 1104 |
if ( $params_value[1] == "%" || $params_value[1] == "!%" ) { |
| 1105 |
$extended0 = ''; |
| 1106 |
$extended1 = ''; |
| 1107 |
$extended2 = ''; |
| 1108 |
$extended3 = ''; |
| 1109 |
$normal0 = ''; |
| 1110 |
$normal1 = ''; |
| 1111 |
$like_or_not = ($params_value[1] == "%" ? ">" : "=="); |
| 1112 |
$name_fields = explode(' ', $params_value[2]); |
| 1113 |
if ( $name_fields[0] != '' ) { |
| 1114 |
$extended0 = 'jQuery("#wdform_' . $params_value[0] . '_element_title' . $form_id . '").val().indexOf("' . $name_fields[0] . '")' . $like_or_not . '-1 '; |
| 1115 |
$normal0 = 'jQuery("#wdform_' . $params_value[0] . '_element_first' . $form_id . '").val().indexOf("' . $name_fields[0] . '")' . $like_or_not . '-1 '; |
| 1116 |
} |
| 1117 |
if ( isset($name_fields[1]) && $name_fields[1] != '' ) { |
| 1118 |
$extended1 = 'jQuery("#wdform_' . $params_value[0] . '_element_first' . $form_id . '").val().indexOf("' . $name_fields[1] . '")' . $like_or_not . '-1 '; |
| 1119 |
$normal1 = 'jQuery("#wdform_' . $params_value[0] . '_element_last' . $form_id . '").val().indexOf("' . $name_fields[1] . '")' . $like_or_not . '-1 '; |
| 1120 |
} |
| 1121 |
if ( isset($name_fields[2]) && $name_fields[2] != '' ) { |
| 1122 |
$extended2 = 'jQuery("#wdform_' . $params_value[0] . '_element_last' . $form_id . '").val().indexOf("' . $name_fields[2] . '")' . $like_or_not . '-1 '; |
| 1123 |
} |
| 1124 |
if ( isset($name_fields[3]) && $name_fields[3] != '' ) { |
| 1125 |
$extended3 = 'jQuery("#wdform_' . $params_value[0] . '_element_middle' . $form_id . '").val().indexOf("' . $name_fields[3] . '")' . $like_or_not . '-1 '; |
| 1126 |
} |
| 1127 |
if ( isset($name_fields[3]) ) { |
| 1128 |
$extended = ''; |
| 1129 |
$normal = ''; |
| 1130 |
if ( $extended0 ) { |
| 1131 |
$extended = $extended0; |
| 1132 |
if ( $extended1 ) { |
| 1133 |
$extended .= ' && ' . $extended1; |
| 1134 |
if ( $extended2 ) { |
| 1135 |
$extended .= ' && ' . $extended2; |
| 1136 |
} |
| 1137 |
if ( $extended3 ) { |
| 1138 |
$extended .= ' && ' . $extended3; |
| 1139 |
} |
| 1140 |
} |
| 1141 |
else { |
| 1142 |
if ( $extended2 ) { |
| 1143 |
$extended .= ' && ' . $extended2; |
| 1144 |
} |
| 1145 |
if ( $extended3 ) { |
| 1146 |
$extended .= ' && ' . $extended3; |
| 1147 |
} |
| 1148 |
} |
| 1149 |
} |
| 1150 |
else { |
| 1151 |
if ( $extended1 ) { |
| 1152 |
$extended = $extended1; |
| 1153 |
if ( $extended2 ) { |
| 1154 |
$extended .= ' && ' . $extended2; |
| 1155 |
} |
| 1156 |
if ( $extended3 ) { |
| 1157 |
$extended .= ' && ' . $extended3; |
| 1158 |
} |
| 1159 |
} |
| 1160 |
else { |
| 1161 |
if ( $extended2 ) { |
| 1162 |
$extended = $extended2; |
| 1163 |
if ( $extended3 ) { |
| 1164 |
$extended .= ' && ' . $extended3; |
| 1165 |
} |
| 1166 |
} |
| 1167 |
else { |
| 1168 |
if ( $extended3 ) { |
| 1169 |
$extended = $extended3; |
| 1170 |
} |
| 1171 |
} |
| 1172 |
} |
| 1173 |
} |
| 1174 |
if ( $normal0 ) { |
| 1175 |
$normal = $normal0; |
| 1176 |
if ( $normal1 ) { |
| 1177 |
$normal .= ' && ' . $normal1; |
| 1178 |
} |
| 1179 |
} |
| 1180 |
else { |
| 1181 |
if ( $normal1 ) { |
| 1182 |
$normal = $normal1; |
| 1183 |
} |
| 1184 |
} |
| 1185 |
} |
| 1186 |
else { |
| 1187 |
if ( isset($name_fields[2]) ) { |
| 1188 |
$extended = ""; |
| 1189 |
$normal = ""; |
| 1190 |
if ( $extended0 ) { |
| 1191 |
$extended = $extended0; |
| 1192 |
if ( $extended1 ) { |
| 1193 |
$extended .= ' && ' . $extended1; |
| 1194 |
} |
| 1195 |
if ( $extended2 ) { |
| 1196 |
$extended .= ' && ' . $extended2; |
| 1197 |
} |
| 1198 |
} |
| 1199 |
else { |
| 1200 |
if ( $extended1 ) { |
| 1201 |
$extended = $extended1; |
| 1202 |
if ( $extended2 ) { |
| 1203 |
$extended .= ' && ' . $extended2; |
| 1204 |
} |
| 1205 |
} |
| 1206 |
else { |
| 1207 |
if ( $extended2 ) { |
| 1208 |
$extended = $extended2; |
| 1209 |
} |
| 1210 |
} |
| 1211 |
} |
| 1212 |
if ( $normal0 ) { |
| 1213 |
$normal = $normal0; |
| 1214 |
if ( $normal1 ) { |
| 1215 |
$normal .= ' && ' . $normal1; |
| 1216 |
} |
| 1217 |
} |
| 1218 |
else { |
| 1219 |
if ( $normal1 ) { |
| 1220 |
$normal = $normal1; |
| 1221 |
} |
| 1222 |
} |
| 1223 |
} |
| 1224 |
else { |
| 1225 |
if ( isset($name_fields[1]) ) { |
| 1226 |
$extended = ''; |
| 1227 |
$normal = ''; |
| 1228 |
if ( $extended0 ) { |
| 1229 |
if ( $extended1 ) { |
| 1230 |
$extended = $extended0 . ' && ' . $extended1; |
| 1231 |
} |
| 1232 |
else { |
| 1233 |
$extended = $extended0; |
| 1234 |
} |
| 1235 |
} |
| 1236 |
else { |
| 1237 |
if ( $extended1 ) { |
| 1238 |
$extended = $extended1; |
| 1239 |
} |
| 1240 |
} |
| 1241 |
if ( $normal0 ) { |
| 1242 |
if ( $normal1 ) { |
| 1243 |
$normal = $normal0 . ' && ' . $normal1; |
| 1244 |
} |
| 1245 |
else { |
| 1246 |
$normal = $normal0; |
| 1247 |
} |
| 1248 |
} |
| 1249 |
else { |
| 1250 |
if ( $normal1 ) { |
| 1251 |
$normal = $normal1; |
| 1252 |
} |
| 1253 |
} |
| 1254 |
} |
| 1255 |
else { |
| 1256 |
$extended = $extended0; |
| 1257 |
$normal = $normal0; |
| 1258 |
} |
| 1259 |
} |
| 1260 |
} |
| 1261 |
if ( $extended != "" && $normal != "" ) { |
| 1262 |
$if .= ' ((jQuery("#wdform_' . $params_value[0] . '_element_title' . $form_id . '").length != 0 || jQuery("#wdform_' . $params_value[0] . '_element_middle' . $form_id . '").length != 0) ? ' . $extended . ' : ' . $normal . ') '; |
| 1263 |
} |
| 1264 |
else { |
| 1265 |
$if .= ' true'; |
| 1266 |
} |
| 1267 |
} |
| 1268 |
else { |
| 1269 |
if ( $params_value[1] == "=" || $params_value[1] == "!" ) { |
| 1270 |
$name_and_or = $params_value[1] == "=" ? "&&" : "||"; |
| 1271 |
$name_empty_or_not = $params_value[1] . "="; |
| 1272 |
$extended = ' (jQuery("#wdform_' . $params_value[0] . '_element_title' . $form_id . '").val()' . $name_empty_or_not . '"" ' . $name_and_or . ' jQuery("#wdform_' . $params_value[0] . '_element_first' . $form_id . '").val()' . $name_empty_or_not . '"" ' . $name_and_or . ' jQuery("#wdform_' . $params_value[0] . '_element_last' . $form_id . '").val()' . $name_empty_or_not . '"" ' . $name_and_or . ' jQuery("#wdform_' . $params_value[0] . '_element_middle' . $form_id . '").val()' . $name_empty_or_not . '"") '; |
| 1273 |
$normal = ' (jQuery("#wdform_' . $params_value[0] . '_element_first' . $form_id . '").val()' . $name_empty_or_not . '"" ' . $name_and_or . ' jQuery("#wdform_' . $params_value[0] . '_element_last' . $form_id . '").val()' . $name_empty_or_not . '"") '; |
| 1274 |
$if .= ' ((jQuery("#wdform_' . $params_value[0] . '_element_title' . $form_id . '").length != 0 || jQuery("#wdform_' . $params_value[0] . '_element_middle' . $form_id . '").length != 0) ? ' . $extended . ' : ' . $normal . ') '; |
| 1275 |
} |
| 1276 |
else { |
| 1277 |
$extended0 = ''; |
| 1278 |
$extended1 = ''; |
| 1279 |
$extended2 = ''; |
| 1280 |
$extended3 = ''; |
| 1281 |
$normal0 = ''; |
| 1282 |
$normal1 = ''; |
| 1283 |
$name_fields = explode(' ', $params_value[2]); |
| 1284 |
if ( $name_fields[0] != '' ) { |
| 1285 |
$extended0 = 'jQuery("#wdform_' . $params_value[0] . '_element_title' . $form_id . '").val()' . $params_value[1] . '"' . $name_fields[0] . '"'; |
| 1286 |
$normal0 = 'jQuery("#wdform_' . $params_value[0] . '_element_first' . $form_id . '").val()' . $params_value[1] . '"' . $name_fields[0] . '"'; |
| 1287 |
} |
| 1288 |
if ( isset($name_fields[1]) && $name_fields[1] != '' ) { |
| 1289 |
$extended1 = 'jQuery("#wdform_' . $params_value[0] . '_element_first' . $form_id . '").val()' . $params_value[1] . '"' . $name_fields[1] . '"'; |
| 1290 |
$normal1 = 'jQuery("#wdform_' . $params_value[0] . '_element_last' . $form_id . '").val()' . $params_value[1] . '"' . $name_fields[1] . '"'; |
| 1291 |
} |
| 1292 |
if ( isset($name_fields[2]) && $name_fields[2] != '' ) { |
| 1293 |
$extended2 = 'jQuery("#wdform_' . $params_value[0] . '_element_last' . $form_id . '").val()' . $params_value[1] . '"' . $name_fields[2] . '"'; |
| 1294 |
} |
| 1295 |
if ( isset($name_fields[3]) && $name_fields[3] != '' ) { |
| 1296 |
$extended3 = 'jQuery("#wdform_' . $params_value[0] . '_element_middle' . $form_id . '").val()' . $params_value[1] . '"' . $name_fields[3] . '"'; |
| 1297 |
} |
| 1298 |
if ( isset($name_fields[3]) ) { |
| 1299 |
$extended = ''; |
| 1300 |
$normal = ''; |
| 1301 |
if ( $extended0 ) { |
| 1302 |
$extended = $extended0; |
| 1303 |
if ( $extended1 ) { |
| 1304 |
$extended .= ' && ' . $extended1; |
| 1305 |
if ( $extended2 ) { |
| 1306 |
$extended .= ' && ' . $extended2; |
| 1307 |
} |
| 1308 |
if ( $extended3 ) { |
| 1309 |
$extended .= ' && ' . $extended3; |
| 1310 |
} |
| 1311 |
} |
| 1312 |
else { |
| 1313 |
if ( $extended2 ) { |
| 1314 |
$extended .= ' && ' . $extended2; |
| 1315 |
} |
| 1316 |
if ( $extended3 ) { |
| 1317 |
$extended .= ' && ' . $extended3; |
| 1318 |
} |
| 1319 |
} |
| 1320 |
} |
| 1321 |
else { |
| 1322 |
if ( $extended1 ) { |
| 1323 |
$extended = $extended1; |
| 1324 |
if ( $extended2 ) { |
| 1325 |
$extended .= ' && ' . $extended2; |
| 1326 |
} |
| 1327 |
if ( $extended3 ) { |
| 1328 |
$extended .= ' && ' . $extended3; |
| 1329 |
} |
| 1330 |
} |
| 1331 |
else { |
| 1332 |
if ( $extended2 ) { |
| 1333 |
$extended = $extended2; |
| 1334 |
if ( $extended3 ) { |
| 1335 |
$extended .= ' && ' . $extended3; |
| 1336 |
} |
| 1337 |
} |
| 1338 |
else { |
| 1339 |
if ( $extended3 ) { |
| 1340 |
$extended = $extended3; |
| 1341 |
} |
| 1342 |
} |
| 1343 |
} |
| 1344 |
} |
| 1345 |
if ( $normal0 ) { |
| 1346 |
$normal = $normal0; |
| 1347 |
if ( $normal1 ) { |
| 1348 |
$normal .= ' && ' . $normal1; |
| 1349 |
} |
| 1350 |
} |
| 1351 |
else { |
| 1352 |
if ( $normal1 ) { |
| 1353 |
$normal = $normal1; |
| 1354 |
} |
| 1355 |
} |
| 1356 |
} |
| 1357 |
else { |
| 1358 |
if ( isset($name_fields[2]) ) { |
| 1359 |
$extended = ""; |
| 1360 |
$normal = ""; |
| 1361 |
if ( $extended0 ) { |
| 1362 |
$extended = $extended0; |
| 1363 |
if ( $extended1 ) { |
| 1364 |
$extended .= ' && ' . $extended1; |
| 1365 |
} |
| 1366 |
if ( $extended2 ) { |
| 1367 |
$extended .= ' && ' . $extended2; |
| 1368 |
} |
| 1369 |
} |
| 1370 |
else { |
| 1371 |
if ( $extended1 ) { |
| 1372 |
$extended = $extended1; |
| 1373 |
if ( $extended2 ) { |
| 1374 |
$extended .= ' && ' . $extended2; |
| 1375 |
} |
| 1376 |
} |
| 1377 |
else { |
| 1378 |
if ( $extended2 ) { |
| 1379 |
$extended = $extended2; |
| 1380 |
} |
| 1381 |
} |
| 1382 |
} |
| 1383 |
if ( $normal0 ) { |
| 1384 |
$normal = $normal0; |
| 1385 |
if ( $normal1 ) { |
| 1386 |
$normal .= ' && ' . $normal1; |
| 1387 |
} |
| 1388 |
} |
| 1389 |
else { |
| 1390 |
if ( $normal1 ) { |
| 1391 |
$normal = $normal1; |
| 1392 |
} |
| 1393 |
} |
| 1394 |
} |
| 1395 |
else { |
| 1396 |
if ( isset($name_fields[1]) ) { |
| 1397 |
$extended = ''; |
| 1398 |
$normal = ''; |
| 1399 |
if ( $extended0 ) { |
| 1400 |
if ( $extended1 ) { |
| 1401 |
$extended = $extended0 . ' && ' . $extended1; |
| 1402 |
} |
| 1403 |
else { |
| 1404 |
$extended = $extended0; |
| 1405 |
} |
| 1406 |
} |
| 1407 |
else { |
| 1408 |
if ( $extended1 ) { |
| 1409 |
$extended = $extended1; |
| 1410 |
} |
| 1411 |
} |
| 1412 |
if ( $normal0 ) { |
| 1413 |
if ( $normal1 ) { |
| 1414 |
$normal = $normal0 . ' && ' . $normal1; |
| 1415 |
} |
| 1416 |
else { |
| 1417 |
$normal = $normal0; |
| 1418 |
} |
| 1419 |
} |
| 1420 |
else { |
| 1421 |
if ( $normal1 ) { |
| 1422 |
$normal = $normal1; |
| 1423 |
} |
| 1424 |
} |
| 1425 |
} |
| 1426 |
else { |
| 1427 |
$extended = $extended0; |
| 1428 |
$normal = $normal0; |
| 1429 |
} |
| 1430 |
} |
| 1431 |
} |
| 1432 |
if ( $extended != "" && $normal != "" ) { |
| 1433 |
$if .= ' ((jQuery("#wdform_' . $params_value[0] . '_element_title' . $form_id . '").length != 0 || jQuery("#wdform_' . $params_value[0] . '_element_middle' . $form_id . '").length != 0) ? ' . $extended . ' : ' . $normal . ') '; |
| 1434 |
} |
| 1435 |
else { |
| 1436 |
$if .= ' true'; |
| 1437 |
} |
| 1438 |
} |
| 1439 |
} |
| 1440 |
$keyup .= '#wdform_' . $params_value[0] . '_element_title' . $form_id . ', #wdform_' . $params_value[0] . '_element_first' . $form_id . ', #wdform_' . $params_value[0] . '_element_last' . $form_id . ', #wdform_' . $params_value[0] . '_element_middle' . $form_id . ', '; |
| 1441 |
break; |
| 1442 |
case "type_phone": |
| 1443 |
if ( $params_value[1] == "==" || $params_value[1] == "!=" ) { |
| 1444 |
$phone_fields = explode(' ', $params_value[2]); |
| 1445 |
if ( isset($phone_fields[1]) ) { |
| 1446 |
if ( $phone_fields[0] != '' && $phone_fields[1] != '' ) { |
| 1447 |
$if .= ' (jQuery("#wdform_' . $params_value[0] . '_element_first' . $form_id . '").val()' . $params_value[1] . '"' . $phone_fields[0] . '" && jQuery("#wdform_' . $params_value[0] . '_element_last' . $form_id . '").val()' . $params_value[1] . '"' . $phone_fields[1] . '") '; |
| 1448 |
} |
| 1449 |
else { |
| 1450 |
if ( $phone_fields[0] == '' ) { |
| 1451 |
$if .= ' (jQuery("#wdform_' . $params_value[0] . '_element_last' . $form_id . '").val()' . $params_value[1] . '"' . $phone_fields[1] . '") '; |
| 1452 |
} |
| 1453 |
else { |
| 1454 |
if ( $phone_fields[1] == '' ) { |
| 1455 |
$if .= ' (jQuery("#wdform_' . $params_value[0] . '_element_first' . $form_id . '").val()' . $params_value[1] . '"' . $phone_fields[1] . '") '; |
| 1456 |
} |
| 1457 |
} |
| 1458 |
} |
| 1459 |
} |
| 1460 |
else { |
| 1461 |
$if .= ' jQuery("#wdform_' . $params_value[0] . '_element_first' . $form_id . '").val()' . $params_value[1] . '"' . $params_value[2] . '" '; |
| 1462 |
} |
| 1463 |
} |
| 1464 |
if ( $params_value[1] == "%" || $params_value[1] == "!%" ) { |
| 1465 |
$like_or_not = ($params_value[1] == "%" ? ">" : "=="); |
| 1466 |
$phone_fields = explode(' ', $params_value[2]); |
| 1467 |
if ( isset($phone_fields[1]) ) { |
| 1468 |
if ( $phone_fields[0] != '' && $phone_fields[1] != '' ) { |
| 1469 |
$if .= ' (jQuery("#wdform_' . $params_value[0] . '_element_first' . $form_id . '").val().indexOf("' . $phone_fields[0] . '")' . $like_or_not . '-1 && jQuery("#wdform_' . $params_value[0] . '_element_last' . $form_id . '").val().indexOf("' . $phone_fields[1] . '")' . $like_or_not . '-1)'; |
| 1470 |
} |
| 1471 |
else { |
| 1472 |
if ( $phone_fields[0] == '' ) { |
| 1473 |
$if .= ' (jQuery("#wdform_' . $params_value[0] . '_element_last' . $form_id . '").val().indexOf("' . $phone_fields[1] . '")' . $like_or_not . '-1) '; |
| 1474 |
} |
| 1475 |
else { |
| 1476 |
if ( $phone_fields[1] == '' ) { |
| 1477 |
$if .= ' (jQuery("#wdform_' . $params_value[0] . '_element_first' . $form_id . '").val().indexOf("' . $phone_fields[0] . '")' . $like_or_not . '-1) '; |
| 1478 |
} |
| 1479 |
} |
| 1480 |
} |
| 1481 |
} |
| 1482 |
else { |
| 1483 |
$if .= ' (jQuery("#wdform_' . $params_value[0] . '_element_first' . $form_id . '").val().indexOf("' . $phone_fields[0] . '")' . $like_or_not . '-1) '; |
| 1484 |
} |
| 1485 |
} |
| 1486 |
if ( $params_value[1] == "=" || $params_value[1] == "!" ) { |
| 1487 |
$params_value[2] = ""; |
| 1488 |
$and_or_phone = ($params_value[1] == "=" ? "&&" : "||"); |
| 1489 |
$params_value[1] = $params_value[1] . "="; |
| 1490 |
$if .= ' (jQuery("#wdform_' . $params_value[0] . '_element_first' . $form_id . '").val()' . $params_value[1] . '"' . $params_value[2] . '" ' . $and_or_phone . ' jQuery("#wdform_' . $params_value[0] . '_element_last' . $form_id . '").val()' . $params_value[1] . '"' . $params_value[2] . '") '; |
| 1491 |
} |
| 1492 |
$keyup .= '#wdform_' . $params_value[0] . '_element_first' . $form_id . ', #wdform_' . $params_value[0] . '_element_last' . $form_id . ', '; |
| 1493 |
break; |
| 1494 |
case "type_paypal_price": |
| 1495 |
if ( $params_value[1] == "==" || $params_value[1] == "!=" ) { |
| 1496 |
$if .= ' (jQuery("#wdform_' . $params_value[0] . '_td_name_cents").attr("style") == "display: none;" ? jQuery("#wdform_' . $params_value[0] . '_element_dollars' . $form_id . '").val()' . $params_value[1] . '"' . $params_value[2] . '" : parseFloat(jQuery("#wdform_' . $params_value[0] . '_element_dollars' . $form_id . '").val()+"."+jQuery("#wdform_' . $params_value[0] . '_element_cents' . $form_id . '").val())' . $params_value[1] . 'parseFloat("' . str_replace('.0', '.', $params_value[2]) . '"))'; |
| 1497 |
} |
| 1498 |
if ( $params_value[1] == "%" || $params_value[1] == "!%" ) { |
| 1499 |
$like_or_not = ($params_value[1] == "%" ? ">" : "=="); |
| 1500 |
$if .= ' (jQuery("#wdform_' . $params_value[0] . '_td_name_cents").attr("style") == "display: none;" ? jQuery("#wdform_' . $params_value[0] . '_element_dollars' . $form_id . '").val().indexOf("' . $params_value[2] . '")' . $like_or_not . '-1 : (jQuery("#wdform_' . $params_value[0] . '_element_dollars' . $form_id . '").val()+"."+jQuery("#wdform_' . $params_value[0] . '_element_cents' . $form_id . '").val()).indexOf("' . str_replace('.0', '.', $params_value[2]) . '")' . $like_or_not . '-1) '; |
| 1501 |
} |
| 1502 |
if ( $params_value[1] == "=" || $params_value[1] == "!" ) { |
| 1503 |
$params_value[2] = ""; |
| 1504 |
$and_or_price = ($params_value[1] == "=" ? "&&" : "||"); |
| 1505 |
$params_value[1] = $params_value[1] . "="; |
| 1506 |
$if .= ' (jQuery("#wdform_' . $params_value[0] . '_td_name_cents").attr("style") == "display: none;" ? jQuery("#wdform_' . $params_value[0] . '_element_dollars' . $form_id . '").val()' . $params_value[1] . '"' . $params_value[2] . '" : (jQuery("#wdform_' . $params_value[0] . '_element_dollars' . $form_id . '").val()' . $params_value[1] . '"' . $params_value[2] . '" ' . $and_or_price . ' jQuery("#wdform_' . $params_value[0] . '_element_cents' . $form_id . '").val()' . $params_value[1] . '"' . $params_value[2] . '"))'; |
| 1507 |
} |
| 1508 |
$keyup .= '#wdform_' . $params_value[0] . '_element_dollars' . $form_id . ', #wdform_' . $params_value[0] . '_element_cents' . $form_id . ', '; |
| 1509 |
break; |
| 1510 |
case "type_own_select": |
| 1511 |
if ( $params_value[1] == "%" || $params_value[1] == "!%" ) { |
| 1512 |
$like_or_not = ($params_value[1] == "%" ? ">" : "=="); |
| 1513 |
$if .= ' jQuery("#wdform_' . $params_value[0] . '_element' . $form_id . '").val().indexOf("' . $params_value[2] . '")' . $like_or_not . '-1 '; |
| 1514 |
} |
| 1515 |
else { |
| 1516 |
if ( $params_value[1] == "=" || $params_value[1] == "!" ) { |
| 1517 |
$params_value[2] = ""; |
| 1518 |
$params_value[1] = $params_value[1] . "="; |
| 1519 |
} |
| 1520 |
$if .= ' jQuery("#wdform_' . $params_value[0] . '_element' . $form_id . '").val()' . $params_value[1] . '"' . $params_value[2] . '" '; |
| 1521 |
} |
| 1522 |
$change .= '#wdform_' . $params_value[0] . '_element' . $form_id . ', '; |
| 1523 |
break; |
| 1524 |
case "type_paypal_select": |
| 1525 |
if ( $params_value[1] == "%" || $params_value[1] == "!%" ) { |
| 1526 |
$like_or_not = ($params_value[1] == "%" ? ">" : "=="); |
| 1527 |
$if .= ' jQuery("#wdform_' . $params_value[0] . '_element' . $form_id . '").val().indexOf("' . $params_value[2] . '")' . $like_or_not . '-1 '; |
| 1528 |
} |
| 1529 |
else { |
| 1530 |
if ( $params_value[1] == "=" || $params_value[1] == "!" ) { |
| 1531 |
$params_value[2] = ""; |
| 1532 |
$params_value[1] = $params_value[1] . "="; |
| 1533 |
$if .= ' jQuery("#wdform_' . $params_value[0] . '_element' . $form_id . '").val()' . $params_value[1] . '"' . $params_value[2] . '"'; |
| 1534 |
} |
| 1535 |
else { |
| 1536 |
if ( strpos($params_value[2], '*:*value*:*') > -1 ) { |
| 1537 |
$and_or = $params_value[1] == "==" ? '&&' : '||'; |
| 1538 |
$choise_and_value = explode("*:*value*:*", $params_value[2]); |
| 1539 |
$params_value[2] = $choise_and_value[1]; |
| 1540 |
$params_label = $choise_and_value[0]; |
| 1541 |
$if .= ' jQuery("#wdform_' . $params_value[0] . '_element' . $form_id . '").val()' . $params_value[1] . '"' . $params_value[2] . '" ' . $and_or . ' jQuery("div[wdid=' . $params_value[0] . '] select option:selected").text()' . $params_value[1] . '"' . $params_label . '" '; |
| 1542 |
} |
| 1543 |
else { |
| 1544 |
$if .= ' jQuery("#wdform_' . $params_value[0] . '_element' . $form_id . '").val()' . $params_value[1] . '"' . $params_value[2] . '" '; |
| 1545 |
} |
| 1546 |
} |
| 1547 |
} |
| 1548 |
$change .= '#wdform_' . $params_value[0] . '_element' . $form_id . ', '; |
| 1549 |
break; |
| 1550 |
case "type_address": |
| 1551 |
if ( $params_value[1] == "%" || $params_value[1] == "!%" ) { |
| 1552 |
$like_or_not = ($params_value[1] == "%" ? ">" : "=="); |
| 1553 |
$if .= ' jQuery("#wdform_' . $params_value[0] . '_country' . $form_id . '").val().indexOf("' . $params_value[2] . '")' . $like_or_not . '-1 '; |
| 1554 |
} |
| 1555 |
else { |
| 1556 |
if ( $params_value[1] == "=" || $params_value[1] == "!" ) { |
| 1557 |
$params_value[2] = ""; |
| 1558 |
$params_value[1] = $params_value[1] . "="; |
| 1559 |
} |
| 1560 |
$if .= ' jQuery("#wdform_' . $params_value[0] . '_country' . $form_id . '").val()' . $params_value[1] . '"' . $params_value[2] . '" '; |
| 1561 |
} |
| 1562 |
$change .= '#wdform_' . $params_value[0] . '_country' . $form_id . ', '; |
| 1563 |
break; |
| 1564 |
case "type_country": |
| 1565 |
if ( $params_value[1] == "%" || $params_value[1] == "!%" ) { |
| 1566 |
$like_or_not = ($params_value[1] == "%" ? ">" : "=="); |
| 1567 |
$if .= ' wdformjQuery("#wdform_' . $params_value[0] . '_element' . $form_id . '").val().indexOf("' . $params_value[2] . '")' . $like_or_not . '-1 '; |
| 1568 |
} |
| 1569 |
else { |
| 1570 |
if ( $params_value[1] == "=" || $params_value[1] == "!" ) { |
| 1571 |
$params_value[2] = ""; |
| 1572 |
$params_value[1] = $params_value[1] . "="; |
| 1573 |
} |
| 1574 |
$if .= ' wdformjQuery("#wdform_' . $params_value[0] . '_element' . $form_id . '").val()' . $params_value[1] . '"' . $params_value[2] . '" '; |
| 1575 |
} |
| 1576 |
$change .= '#wdform_' . $params_value[0] . '_element' . $form_id . ', '; |
| 1577 |
break; |
| 1578 |
case "type_radio": |
| 1579 |
case "type_paypal_radio": |
| 1580 |
case "type_paypal_shipping": |
| 1581 |
if ( $params_value[1] == "==" || $params_value[1] == "!=" ) { |
| 1582 |
if ( strpos($params_value[2], '*:*value*:*') > -1 ) { |
| 1583 |
$and_or = $params_value[1] == "==" ? '&&' : '||'; |
| 1584 |
$choise_and_value = explode("*:*value*:*", $params_value[2]); |
| 1585 |
$params_value[2] = $choise_and_value[1]; |
| 1586 |
$params_label = $choise_and_value[0]; |
| 1587 |
$if .= ' jQuery("input[name^=\'wdform_' . $params_value[0] . '_element' . $form_id . '\']:checked").val()' . $params_value[1] . '"' . $params_value[2] . '" ' . $and_or . ' jQuery("input[name^=\'wdform_' . $params_value[0] . '_element' . $form_id . '\']:checked").attr("title")' . $params_value[1] . '"' . $params_label . '" '; |
| 1588 |
} |
| 1589 |
else { |
| 1590 |
$if .= ' jQuery("input[name^=\'wdform_' . $params_value[0] . '_element' . $form_id . '\']:checked").val()' . $params_value[1] . '"' . $params_value[2] . '" '; |
| 1591 |
} |
| 1592 |
$click .= 'div[wdid=' . $params_value[0] . '] input[type=\'radio\'], '; |
| 1593 |
} |
| 1594 |
if ( $params_value[1] == "%" || $params_value[1] == "!%" ) { |
| 1595 |
$click .= 'div[wdid=' . $params_value[0] . '] input[type=\'radio\'], '; |
| 1596 |
$like_or_not = ($params_value[1] == "%" ? ">" : "=="); |
| 1597 |
$if .= ' (jQuery("input[name^=\'wdform_' . $params_value[0] . '_element' . $form_id . '\']:checked").val() ? (jQuery("input[name^=\'wdform_' . $params_value[0] . '_element' . $form_id . '\']:checked").attr("other") ? false : (jQuery("input[name^=\'wdform_' . $params_value[0] . '_element' . $form_id . '\']:checked").val().indexOf("' . $params_value[2] . '")' . $like_or_not . '-1 )) : false) '; |
| 1598 |
} |
| 1599 |
if ( $params_value[1] == "=" || $params_value[1] == "!" ) { |
| 1600 |
$ckecked_or_no = ($params_value[1] == "=" ? "!" : ""); |
| 1601 |
$if .= ' ' . $ckecked_or_no . 'jQuery("input[name^=\'wdform_' . $params_value[0] . '_element' . $form_id . '\']:checked").val()'; |
| 1602 |
$click .= 'div[wdid=' . $params_value[0] . '] input[type=\'radio\'], '; |
| 1603 |
} |
| 1604 |
break; |
| 1605 |
case "type_checkbox": |
| 1606 |
case "type_paypal_checkbox": |
| 1607 |
if ( $params_value[1] == "==" || $params_value[1] == "!=" ) { |
| 1608 |
if ( $params_value[2] ) { |
| 1609 |
$choises = explode('@@@', $params_value[2]); |
| 1610 |
$choises = array_slice($choises, 0, count($choises) - 1); |
| 1611 |
if ( $params_value[1] == "!=" ) { |
| 1612 |
$is = "!"; |
| 1613 |
} |
| 1614 |
else { |
| 1615 |
$is = ""; |
| 1616 |
} |
| 1617 |
foreach ( $choises as $key1 => $choise ) { |
| 1618 |
if ( $type_and_id[$params_value[0]] == "type_paypal_checkbox" ) { |
| 1619 |
$choise_and_value = explode("*:*value*:*", $choise); |
| 1620 |
$if .= ' ' . $is . '(jQuery("#form' . $form_id . ' div[wdid=' . $params_value[0] . '] input[value=\"' . $choise_and_value[1] . '\"]").is(":checked") && jQuery("div[wdid=' . $params_value[0] . '] input[title=\"' . $choise_and_value[0] . '\"]"))'; |
| 1621 |
} |
| 1622 |
else { |
| 1623 |
$if .= ' ' . $is . 'jQuery("#form' . $form_id . ' div[wdid=' . $params_value[0] . '] input[value=\"' . $choise . '\"]").is(":checked") '; |
| 1624 |
} |
| 1625 |
if ( $key1 != count($choises) - 1 ) { |
| 1626 |
$if .= '&&'; |
| 1627 |
} |
| 1628 |
} |
| 1629 |
$click .= 'div[wdid=' . $params_value[0] . '] input[type=\'checkbox\'], '; |
| 1630 |
} |
| 1631 |
else { |
| 1632 |
if ( $or_and == '&&' ) { |
| 1633 |
$if .= ' true'; |
| 1634 |
} |
| 1635 |
else { |
| 1636 |
$if .= ' false'; |
| 1637 |
} |
| 1638 |
} |
| 1639 |
} |
| 1640 |
if ( $params_value[1] == "%" || $params_value[1] == "!%" ) { |
| 1641 |
$like_or_not = ($params_value[1] == "%" ? ">" : "=="); |
| 1642 |
if ( $params_value[2] ) { |
| 1643 |
$choises = explode('@@@', $params_value[2]); |
| 1644 |
$choises = array_slice($choises, 0, count($choises) - 1); |
| 1645 |
if ( $type_and_id[$params_value[0]] == "type_paypal_checkbox" ) { |
| 1646 |
foreach ( $choises as $key1 => $choise ) { |
| 1647 |
$choise_and_value = explode("*:*value*:*", $choise); |
| 1648 |
$if .= ' jQuery("div[wdid=' . $params_value[0] . '] input[type=\"checkbox\"]:checked").serialize().indexOf("' . $choise_and_value[1] . '")' . $like_or_not . '-1 '; |
| 1649 |
if ( $key1 != count($choises) - 1 ) { |
| 1650 |
$if .= '&&'; |
| 1651 |
} |
| 1652 |
} |
| 1653 |
} |
| 1654 |
else { |
| 1655 |
foreach ( $choises as $key1 => $choise ) { |
| 1656 |
$if .= ' jQuery("div[wdid=' . $params_value[0] . '] input[type=\"checkbox\"]:checked").serialize().indexOf("' . str_replace(" ", "+", $choise) . '")' . $like_or_not . '-1 '; |
| 1657 |
if ( $key1 != count($choises) - 1 ) { |
| 1658 |
$if .= '&&'; |
| 1659 |
} |
| 1660 |
} |
| 1661 |
} |
| 1662 |
$click .= 'div[wdid=' . $params_value[0] . '] input[type=\'checkbox\'], '; |
| 1663 |
} |
| 1664 |
else { |
| 1665 |
if ( $or_and == '&&' ) { |
| 1666 |
$if .= ' true'; |
| 1667 |
} |
| 1668 |
else { |
| 1669 |
$if .= ' false'; |
| 1670 |
} |
| 1671 |
} |
| 1672 |
} |
| 1673 |
if ( $params_value[1] == "=" || $params_value[1] == "!" ) { |
| 1674 |
$ckecked_or_no = ($params_value[1] == "=" ? "==" : ">"); |
| 1675 |
$if .= ' jQuery("div[wdid=' . $params_value[0] . '] input[type=\"checkbox\"]:checked").length' . $ckecked_or_no . '0 '; |
| 1676 |
$click .= 'div[wdid=' . $params_value[0] . '] input[type=\'checkbox\'], '; |
| 1677 |
} |
| 1678 |
break; |
| 1679 |
} |
| 1680 |
if ( $m != count($cond_params) - 1 ) { |
| 1681 |
$params_value_next = explode('***', $cond_params[$m + 1]); |
| 1682 |
if ( isset($type_and_id[$params_value_next[0]]) ) { |
| 1683 |
$if .= $or_and; |
| 1684 |
} |
| 1685 |
} |
| 1686 |
} |
| 1687 |
if ( $if ) { |
| 1688 |
$condition_js .= ' |
| 1689 |
if(' . $if . ') { |
| 1690 |
jQuery("#form' . $form_id . ' div[wdid=' . $field_label[$k] . ']").' . $display . '; |
| 1691 |
} |
| 1692 |
else { |
| 1693 |
jQuery("#form' . $form_id . ' div[wdid=' . $field_label[$k] . ']").' . $display_none . '; |
| 1694 |
}'; |
| 1695 |
} |
| 1696 |
if ( $keyup ) { |
| 1697 |
$condition_js .= ' |
| 1698 |
jQuery("' . substr($keyup, 0, -2) . '").keyup(function() { |
| 1699 |
if(' . $if . ') { |
| 1700 |
jQuery("#form' . $form_id . ' div[wdid=' . $field_label[$k] . ']").' . $display . '; |
| 1701 |
} |
| 1702 |
else { |
| 1703 |
jQuery("#form' . $form_id . ' div[wdid=' . $field_label[$k] . ']").' . $display_none . '; |
| 1704 |
} |
| 1705 |
set_total_value(' . $form_id . '); |
| 1706 |
});'; |
| 1707 |
} |
| 1708 |
if ( $change ) { |
| 1709 |
$condition_js .= ' |
| 1710 |
jQuery("' . substr($change, 0, -2) . '").change(function() { |
| 1711 |
if(' . $if . ') { |
| 1712 |
jQuery("#form' . $form_id . ' div[wdid=' . $field_label[$k] . ']").' . $display . '; |
| 1713 |
} |
| 1714 |
else { |
| 1715 |
jQuery("#form' . $form_id . ' div[wdid=' . $field_label[$k] . ']").' . $display_none . '; |
| 1716 |
} |
| 1717 |
set_total_value(' . $form_id . '); |
| 1718 |
});'; |
| 1719 |
} |
| 1720 |
if ( $blur ) { |
| 1721 |
$condition_js .= ' |
| 1722 |
jQuery("' . substr($blur, 0, -2) . '").blur(function() { |
| 1723 |
if(' . $if . ') |
| 1724 |
jQuery("#form' . $form_id . ' div[wdid=' . $field_label[$k] . ']").' . $display . '; |
| 1725 |
else |
| 1726 |
jQuery("#form' . $form_id . ' div[wdid=' . $field_label[$k] . ']").' . $display_none . '; |
| 1727 |
set_total_value(' . $form_id . '); |
| 1728 |
});'; |
| 1729 |
} |
| 1730 |
if ( $click ) { |
| 1731 |
$condition_js .= ' |
| 1732 |
jQuery("' . substr($click, 0, -2) . '").click(function() { |
| 1733 |
if(' . $if . ') { |
| 1734 |
jQuery("#form' . $form_id . ' div[wdid=' . $field_label[$k] . ']").' . $display . '; |
| 1735 |
} |
| 1736 |
else { |
| 1737 |
jQuery("#form' . $form_id . ' div[wdid=' . $field_label[$k] . ']").' . $display_none . '; |
| 1738 |
} |
| 1739 |
set_total_value(' . $form_id . '); |
| 1740 |
});'; |
| 1741 |
} |
| 1742 |
} |
| 1743 |
} |
| 1744 |
} |
| 1745 |
$form = $row->form_front; |
| 1746 |
$req_fields = array(); |
| 1747 |
$check_regExp_all = array(); |
| 1748 |
$check_paypal_price_min_max = array(); |
| 1749 |
$file_upload_check = array(); |
| 1750 |
$inputIds = array(); |
| 1751 |
$spinner_check = array(); |
| 1752 |
foreach ( $id1s as $id1s_key => $id1 ) { |
| 1753 |
$label = $labels[$id1s_key]; |
| 1754 |
$type = $types[$id1s_key]; |
| 1755 |
$params = $paramss[$id1s_key]; |
| 1756 |
$id_type = $id1 . '|' . $type; |
| 1757 |
if ( strpos($form, '%' . $id1 . ' - ' . $label . '%') || strpos($form, '%' . $id1 . ' -' . $label . '%') ) { |
| 1758 |
$required = FALSE; |
| 1759 |
$param = array(); |
| 1760 |
$param['attributes'] = ''; |
| 1761 |
$is_type[$type] = TRUE; |
| 1762 |
switch ( $type ) { |
| 1763 |
case 'type_send_copy': { |
| 1764 |
$params_names = array( 'w_field_label_size', 'w_field_label_pos', 'w_first_val', 'w_required' ); |
| 1765 |
$temp = $params; |
| 1766 |
if ( strpos($temp, 'w_hide_label') > -1 ) { |
| 1767 |
$params_names = array( |
| 1768 |
'w_field_label_size', |
| 1769 |
'w_field_label_pos', |
| 1770 |
'w_hide_label', |
| 1771 |
'w_first_val', |
| 1772 |
'w_required', |
| 1773 |
); |
| 1774 |
} |
| 1775 |
foreach ( $params_names as $params_name ) { |
| 1776 |
$temp = explode('*:*' . $params_name . '*:*', $temp); |
| 1777 |
$param[$params_name] = $temp[0]; |
| 1778 |
$temp = $temp[1]; |
| 1779 |
} |
| 1780 |
$required = ($param['w_required'] == "yes" ? TRUE : FALSE); |
| 1781 |
$onsubmit_js .= 'if(!jQuery("#wdform_' . $id1 . '_element' . $form_id . '").is(":checked")) { |
| 1782 |
jQuery("<input type=\"hidden\" name=\"wdform_send_copy_' . $form_id . '\" value=\"1\" />").appendTo("#form' . $form_id . '");}'; |
| 1783 |
if ( $required ) { |
| 1784 |
array_push($req_fields, $id1); |
| 1785 |
} |
| 1786 |
break; |
| 1787 |
} |
| 1788 |
case 'type_text': { |
| 1789 |
$params_names = array( |
| 1790 |
'w_field_label_size', |
| 1791 |
'w_field_label_pos', |
| 1792 |
'w_size', |
| 1793 |
'w_first_val', |
| 1794 |
'w_title', |
| 1795 |
'w_required', |
| 1796 |
'w_unique', |
| 1797 |
); |
| 1798 |
$temp = $params; |
| 1799 |
if ( strpos($temp, 'w_regExp_status') > -1 ) { |
| 1800 |
$params_names = array( |
| 1801 |
'w_field_label_size', |
| 1802 |
'w_field_label_pos', |
| 1803 |
'w_size', |
| 1804 |
'w_first_val', |
| 1805 |
'w_title', |
| 1806 |
'w_required', |
| 1807 |
'w_regExp_status', |
| 1808 |
'w_regExp_value', |
| 1809 |
'w_regExp_common', |
| 1810 |
'w_regExp_arg', |
| 1811 |
'w_regExp_alert', |
| 1812 |
'w_unique', |
| 1813 |
); |
| 1814 |
} |
| 1815 |
if ( strpos($temp, 'w_readonly') > -1 ) { |
| 1816 |
$params_names = array( |
| 1817 |
'w_field_label_size', |
| 1818 |
'w_field_label_pos', |
| 1819 |
'w_size', |
| 1820 |
'w_first_val', |
| 1821 |
'w_title', |
| 1822 |
'w_required', |
| 1823 |
'w_regExp_status', |
| 1824 |
'w_regExp_value', |
| 1825 |
'w_regExp_common', |
| 1826 |
'w_regExp_arg', |
| 1827 |
'w_regExp_alert', |
| 1828 |
'w_unique', |
| 1829 |
'w_readonly', |
| 1830 |
); |
| 1831 |
} |
| 1832 |
if ( strpos($temp, 'w_hide_label') > -1 ) { |
| 1833 |
$params_names = array( |
| 1834 |
'w_field_label_size', |
| 1835 |
'w_field_label_pos', |
| 1836 |
'w_hide_label', |
| 1837 |
'w_size', |
| 1838 |
'w_first_val', |
| 1839 |
'w_title', |
| 1840 |
'w_required', |
| 1841 |
'w_regExp_status', |
| 1842 |
'w_regExp_value', |
| 1843 |
'w_regExp_common', |
| 1844 |
'w_regExp_arg', |
| 1845 |
'w_regExp_alert', |
| 1846 |
'w_unique', |
| 1847 |
'w_readonly', |
| 1848 |
); |
| 1849 |
} |
| 1850 |
foreach ( $params_names as $params_name ) { |
| 1851 |
$temp = explode('*:*' . $params_name . '*:*', $temp); |
| 1852 |
$param[$params_name] = $temp[0]; |
| 1853 |
$temp = $temp[1]; |
| 1854 |
} |
| 1855 |
$required = ($param['w_required'] == "yes" ? TRUE : FALSE); |
| 1856 |
$param['w_regExp_status'] = (isset($param['w_regExp_status']) ? $param['w_regExp_status'] : "no"); |
| 1857 |
$check_regExp = ''; |
| 1858 |
if ( $required ) { |
| 1859 |
array_push($req_fields, $id1); |
| 1860 |
} |
| 1861 |
if ( $param['w_regExp_status'] == 'yes' ) { |
| 1862 |
$check_regExp_all[$id1] = array( |
| 1863 |
$param["w_regExp_value"], |
| 1864 |
$param["w_regExp_arg"], |
| 1865 |
$param["w_regExp_alert"], |
| 1866 |
); |
| 1867 |
} |
| 1868 |
break; |
| 1869 |
} |
| 1870 |
case 'type_number': { |
| 1871 |
$params_names = array( |
| 1872 |
'w_field_label_size', |
| 1873 |
'w_field_label_pos', |
| 1874 |
'w_size', |
| 1875 |
'w_first_val', |
| 1876 |
'w_title', |
| 1877 |
'w_required', |
| 1878 |
'w_unique', |
| 1879 |
'w_class', |
| 1880 |
); |
| 1881 |
$temp = $params; |
| 1882 |
foreach ( $params_names as $params_name ) { |
| 1883 |
$temp = explode('*:*' . $params_name . '*:*', $temp); |
| 1884 |
$param[$params_name] = $temp[0]; |
| 1885 |
$temp = $temp[1]; |
| 1886 |
} |
| 1887 |
$required = ($param['w_required'] == "yes" ? TRUE : FALSE); |
| 1888 |
if ( $required ) { |
| 1889 |
array_push($req_fields, $id1); |
| 1890 |
} |
| 1891 |
break; |
| 1892 |
} |
| 1893 |
case 'type_password': { |
| 1894 |
$params_names = array( |
| 1895 |
'w_field_label_size', |
| 1896 |
'w_field_label_pos', |
| 1897 |
'w_size', |
| 1898 |
'w_required', |
| 1899 |
'w_unique', |
| 1900 |
'w_class', |
| 1901 |
); |
| 1902 |
$temp = $params; |
| 1903 |
if ( strpos($temp, 'w_hide_label') > -1 ) { |
| 1904 |
$params_names = array( |
| 1905 |
'w_field_label_size', |
| 1906 |
'w_field_label_pos', |
| 1907 |
'w_hide_label', |
| 1908 |
'w_size', |
| 1909 |
'w_required', |
| 1910 |
'w_unique', |
| 1911 |
'w_class', |
| 1912 |
); |
| 1913 |
} |
| 1914 |
if ( strpos($temp, 'w_verification') > -1 ) { |
| 1915 |
$params_names = array( |
| 1916 |
'w_field_label_size', |
| 1917 |
'w_field_label_pos', |
| 1918 |
'w_hide_label', |
| 1919 |
'w_size', |
| 1920 |
'w_required', |
| 1921 |
'w_unique', |
| 1922 |
'w_class', |
| 1923 |
'w_verification', |
| 1924 |
'w_verification_label', |
| 1925 |
); |
| 1926 |
} |
| 1927 |
foreach ( $params_names as $params_name ) { |
| 1928 |
$temp = explode('*:*' . $params_name . '*:*', $temp); |
| 1929 |
$param[$params_name] = $temp[0]; |
| 1930 |
$temp = $temp[1]; |
| 1931 |
} |
| 1932 |
$required = ($param['w_required'] == "yes" ? TRUE : FALSE); |
| 1933 |
if ( $required ) { |
| 1934 |
array_push($req_fields, $id1); |
| 1935 |
} |
| 1936 |
break; |
| 1937 |
} |
| 1938 |
case 'type_textarea': { |
| 1939 |
$params_names = array( |
| 1940 |
'w_field_label_size', |
| 1941 |
'w_field_label_pos', |
| 1942 |
'w_size_w', |
| 1943 |
'w_size_h', |
| 1944 |
'w_first_val', |
| 1945 |
'w_title', |
| 1946 |
'w_required', |
| 1947 |
'w_unique', |
| 1948 |
'w_class', |
| 1949 |
); |
| 1950 |
$temp = $params; |
| 1951 |
if ( strpos($temp, 'w_hide_label') > -1 ) { |
| 1952 |
$params_names = array( |
| 1953 |
'w_field_label_size', |
| 1954 |
'w_field_label_pos', |
| 1955 |
'w_hide_label', |
| 1956 |
'w_size_w', |
| 1957 |
'w_size_h', |
| 1958 |
'w_first_val', |
| 1959 |
'w_title', |
| 1960 |
'w_required', |
| 1961 |
'w_unique', |
| 1962 |
'w_class', |
| 1963 |
); |
| 1964 |
} |
| 1965 |
foreach ( $params_names as $params_name ) { |
| 1966 |
$temp = explode('*:*' . $params_name . '*:*', $temp); |
| 1967 |
$param[$params_name] = $temp[0]; |
| 1968 |
$temp = $temp[1]; |
| 1969 |
} |
| 1970 |
$required = ($param['w_required'] == "yes" ? TRUE : FALSE); |
| 1971 |
if ( $required ) { |
| 1972 |
array_push($req_fields, $id1); |
| 1973 |
} |
| 1974 |
break; |
| 1975 |
} |
| 1976 |
case 'type_phone': { |
| 1977 |
$params_names = array( |
| 1978 |
'w_field_label_size', |
| 1979 |
'w_field_label_pos', |
| 1980 |
'w_size', |
| 1981 |
'w_first_val', |
| 1982 |
'w_title', |
| 1983 |
'w_mini_labels', |
| 1984 |
'w_required', |
| 1985 |
'w_unique', |
| 1986 |
'w_class', |
| 1987 |
); |
| 1988 |
$temp = $params; |
| 1989 |
if ( strpos($temp, 'w_hide_label') > -1 ) { |
| 1990 |
$params_names = array( |
| 1991 |
'w_field_label_size', |
| 1992 |
'w_field_label_pos', |
| 1993 |
'w_hide_label', |
| 1994 |
'w_size', |
| 1995 |
'w_first_val', |
| 1996 |
'w_title', |
| 1997 |
'w_mini_labels', |
| 1998 |
'w_required', |
| 1999 |
'w_unique', |
| 2000 |
'w_class', |
| 2001 |
); |
| 2002 |
} |
| 2003 |
foreach ( $params_names as $params_name ) { |
| 2004 |
$temp = explode('*:*' . $params_name . '*:*', $temp); |
| 2005 |
$param[$params_name] = $temp[0]; |
| 2006 |
$temp = $temp[1]; |
| 2007 |
} |
| 2008 |
$required = ($param['w_required'] == "yes" ? TRUE : FALSE); |
| 2009 |
if ( $required ) { |
| 2010 |
array_push($req_fields, $id1); |
| 2011 |
} |
| 2012 |
break; |
| 2013 |
} |
| 2014 |
case 'type_phone_new': { |
| 2015 |
$params_names = array( |
| 2016 |
'w_field_label_size', |
| 2017 |
'w_field_label_pos', |
| 2018 |
'w_hide_label', |
| 2019 |
'w_size', |
| 2020 |
'w_first_val', |
| 2021 |
'w_top_country', |
| 2022 |
'w_required', |
| 2023 |
'w_unique', |
| 2024 |
'w_class', |
| 2025 |
); |
| 2026 |
$temp = $params; |
| 2027 |
foreach ( $params_names as $params_name ) { |
| 2028 |
$temp = explode('*:*' . $params_name . '*:*', $temp); |
| 2029 |
$param[$params_name] = $temp[0]; |
| 2030 |
$temp = $temp[1]; |
| 2031 |
} |
| 2032 |
$required = ($param['w_required'] == "yes" ? TRUE : FALSE); |
| 2033 |
if ( $required ) { |
| 2034 |
array_push($req_fields, $id1); |
| 2035 |
} |
| 2036 |
$onload_js .= ' |
| 2037 |
jQuery("#wdform_' . $id1 . '_element' . $form_id . '").intlTelInput({ |
| 2038 |
nationalMode: false, |
| 2039 |
preferredCountries: [ "' . $param["w_top_country"] . '" ], |
| 2040 |
customPlaceholder: "Phone", |
| 2041 |
}); |
| 2042 |
'; |
| 2043 |
break; |
| 2044 |
} |
| 2045 |
case 'type_name': { |
| 2046 |
$params_names = array( |
| 2047 |
'w_field_label_size', |
| 2048 |
'w_field_label_pos', |
| 2049 |
'w_first_val', |
| 2050 |
'w_title', |
| 2051 |
'w_mini_labels', |
| 2052 |
'w_size', |
| 2053 |
'w_name_format', |
| 2054 |
'w_required', |
| 2055 |
'w_unique', |
| 2056 |
'w_class', |
| 2057 |
); |
| 2058 |
$temp = $params; |
| 2059 |
if ( strpos($temp, 'w_name_fields') > -1 ) { |
| 2060 |
$params_names = array( |
| 2061 |
'w_field_label_size', |
| 2062 |
'w_field_label_pos', |
| 2063 |
'w_first_val', |
| 2064 |
'w_title', |
| 2065 |
'w_mini_labels', |
| 2066 |
'w_size', |
| 2067 |
'w_name_format', |
| 2068 |
'w_required', |
| 2069 |
'w_unique', |
| 2070 |
'w_class', |
| 2071 |
'w_name_fields', |
| 2072 |
); |
| 2073 |
} |
| 2074 |
if ( strpos($temp, 'w_autofill') > -1 ) { |
| 2075 |
$params_names = array( |
| 2076 |
'w_field_label_size', |
| 2077 |
'w_field_label_pos', |
| 2078 |
'w_first_val', |
| 2079 |
'w_title', |
| 2080 |
'w_mini_labels', |
| 2081 |
'w_size', |
| 2082 |
'w_name_format', |
| 2083 |
'w_required', |
| 2084 |
'w_unique', |
| 2085 |
'w_class', |
| 2086 |
'w_name_fields', |
| 2087 |
'w_autofill', |
| 2088 |
); |
| 2089 |
} |
| 2090 |
if ( strpos($temp, 'w_hide_label') > -1 ) { |
| 2091 |
$params_names = array( |
| 2092 |
'w_field_label_size', |
| 2093 |
'w_field_label_pos', |
| 2094 |
'w_hide_label', |
| 2095 |
'w_first_val', |
| 2096 |
'w_title', |
| 2097 |
'w_mini_labels', |
| 2098 |
'w_size', |
| 2099 |
'w_name_format', |
| 2100 |
'w_required', |
| 2101 |
'w_unique', |
| 2102 |
'w_class', |
| 2103 |
'w_name_fields', |
| 2104 |
'w_autofill', |
| 2105 |
); |
| 2106 |
} |
| 2107 |
foreach ( $params_names as $params_name ) { |
| 2108 |
$temp = explode('*:*' . $params_name . '*:*', $temp); |
| 2109 |
$param[$params_name] = $temp[0]; |
| 2110 |
$temp = $temp[1]; |
| 2111 |
} |
| 2112 |
$required = ($param['w_required'] == "yes" ? TRUE : FALSE); |
| 2113 |
if ( $required ) { |
| 2114 |
array_push($req_fields, $id1); |
| 2115 |
} |
| 2116 |
break; |
| 2117 |
} |
| 2118 |
case 'type_address': { |
| 2119 |
$w_states = self::get_states(); |
| 2120 |
$w_provinces = self::get_provinces_canada(); |
| 2121 |
$w_state_options = ''; |
| 2122 |
foreach ( $w_states as $w_state ) { |
| 2123 |
$w_state_options .= '<option value="' . $w_state . '">' . $w_state . '</option>'; |
| 2124 |
} |
| 2125 |
$w_provinces_options = ''; |
| 2126 |
foreach ( $w_provinces as $w_province ) { |
| 2127 |
$w_provinces_options .= '<option value="' . $w_province . '">' . $w_province . '</option>'; |
| 2128 |
} |
| 2129 |
$params_names = array( |
| 2130 |
'w_field_label_size', |
| 2131 |
'w_field_label_pos', |
| 2132 |
'w_size', |
| 2133 |
'w_mini_labels', |
| 2134 |
'w_disabled_fields', |
| 2135 |
'w_required', |
| 2136 |
'w_class', |
| 2137 |
); |
| 2138 |
$temp = $params; |
| 2139 |
if ( strpos($temp, 'w_hide_label') > -1 ) { |
| 2140 |
$params_names = array( |
| 2141 |
'w_field_label_size', |
| 2142 |
'w_field_label_pos', |
| 2143 |
'w_hide_label', |
| 2144 |
'w_size', |
| 2145 |
'w_mini_labels', |
| 2146 |
'w_disabled_fields', |
| 2147 |
'w_required', |
| 2148 |
'w_class', |
| 2149 |
); |
| 2150 |
} |
| 2151 |
foreach ( $params_names as $params_name ) { |
| 2152 |
$temp = explode('*:*' . $params_name . '*:*', $temp); |
| 2153 |
$param[$params_name] = $temp[0]; |
| 2154 |
$temp = $temp[1]; |
| 2155 |
} |
| 2156 |
$required = ($param['w_required'] == "yes" ? TRUE : FALSE); |
| 2157 |
if ( $required ) { |
| 2158 |
array_push($req_fields, $id1); |
| 2159 |
} |
| 2160 |
$post = isset($_POST['wdform_' . ($id1 + 5) . '_country' . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . ($id1 + 5) . '_country' . $form_id])) : NULL; |
| 2161 |
if ( isset($post) ) { |
| 2162 |
$onload_js .= ' |
| 2163 |
jQuery("#wdform_' . $id1 . '_country' . $form_id . '").val("' . (isset($_POST['wdform_' . ($id1 + 5) . "_country" . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . ($id1 + 5) . "_country" . $form_id])) : '') . '");'; |
| 2164 |
} |
| 2165 |
if ( isset($w_disabled_fields[6]) && $w_disabled_fields[6] == 'yes' ) { |
| 2166 |
$onload_js .= ' |
| 2167 |
jQuery("#wdform_' . $id1 . '_country' . $form_id . '").change(function() { |
| 2168 |
if( jQuery(this).val() == "United States" ) { |
| 2169 |
jQuery("#wdform_' . $id1 . '_state' . $form_id . '").parent().append("<select type=\"text\" id=\"wdform_' . $id1 . '_state' . $form_id . '\" name=\"wdform_' . ($id1 + 3) . '_state' . $form_id . '\" style=\"width: 100%;\" ' . $param['attributes'] . '>' . addslashes($w_state_options) . '</select><label class=\"mini_label\" id=\"' . $id1 . '_mini_label_state\">' . $w_mini_labels[3] . '</label>"); |
| 2170 |
jQuery("#wdform_' . $id1 . '_state' . $form_id . '").parent().children("input:first, label:first").remove(); |
| 2171 |
} |
| 2172 |
else if ( jQuery(this).val() == "Canada" ) { |
| 2173 |
jQuery("#wdform_' . $id1 . '_state' . $form_id . '").parent().append("<select type=\"text\" id=\"wdform_' . $id1 . '_state' . $form_id . '\" name=\"wdform_' . ($id1 + 3) . '_state' . $form_id . '\" style=\"width: 100%;\" ' . $param['attributes'] . '>' . addslashes($w_provinces_options) . '</select><label class=\"mini_label\" id=\"' . $id1 . '_mini_label_state\">' . $w_mini_labels[3] . '</label>"); |
| 2174 |
jQuery("#wdform_' . $id1 . '_state' . $form_id . '").parent().children("input:first, label:first").remove(); |
| 2175 |
} |
| 2176 |
else { |
| 2177 |
if(jQuery("#wdform_' . $id1 . '_state' . $form_id . '").prop("tagName") == "SELECT") { |
| 2178 |
jQuery("#wdform_' . $id1 . '_state' . $form_id . '").parent().append("<input type=\"text\" id=\"wdform_' . $id1 . '_state' . $form_id . '\" name=\"wdform_' . ($id1 + 3) . '_state' . $form_id . '\" value=\"' . (isset($_POST['wdform_' . ($id1 + 3) . '_state' . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . ($id1 + 3) . '_state' . $form_id])) : "") . '\" style=\"width: 100%;\" ' . $param['attributes'] . '><label class=\"mini_label\">' . $w_mini_labels[3] . '</label>"); |
| 2179 |
jQuery("#wdform_' . $id1 . '_state' . $form_id . '").parent().children("select:first, label:first").remove(); |
| 2180 |
} |
| 2181 |
} |
| 2182 |
});'; |
| 2183 |
} |
| 2184 |
break; |
| 2185 |
} |
| 2186 |
case 'type_submitter_mail': { |
| 2187 |
$params_names = array( |
| 2188 |
'w_field_label_size', |
| 2189 |
'w_field_label_pos', |
| 2190 |
'w_size', |
| 2191 |
'w_first_val', |
| 2192 |
'w_title', |
| 2193 |
'w_required', |
| 2194 |
'w_unique', |
| 2195 |
'w_class', |
| 2196 |
); |
| 2197 |
$temp = $params; |
| 2198 |
if ( strpos($temp, 'w_autofill') > -1 ) { |
| 2199 |
$params_names = array( |
| 2200 |
'w_field_label_size', |
| 2201 |
'w_field_label_pos', |
| 2202 |
'w_size', |
| 2203 |
'w_first_val', |
| 2204 |
'w_title', |
| 2205 |
'w_required', |
| 2206 |
'w_unique', |
| 2207 |
'w_class', |
| 2208 |
'w_autofill', |
| 2209 |
); |
| 2210 |
} |
| 2211 |
if ( strpos($temp, 'w_hide_label') > -1 ) { |
| 2212 |
$params_names = array( |
| 2213 |
'w_field_label_size', |
| 2214 |
'w_field_label_pos', |
| 2215 |
'w_hide_label', |
| 2216 |
'w_size', |
| 2217 |
'w_first_val', |
| 2218 |
'w_title', |
| 2219 |
'w_required', |
| 2220 |
'w_unique', |
| 2221 |
'w_class', |
| 2222 |
'w_autofill', |
| 2223 |
); |
| 2224 |
} |
| 2225 |
if ( strpos($temp, 'w_verification') > -1 ) { |
| 2226 |
$params_names = array( |
| 2227 |
'w_field_label_size', |
| 2228 |
'w_field_label_pos', |
| 2229 |
'w_hide_label', |
| 2230 |
'w_size', |
| 2231 |
'w_first_val', |
| 2232 |
'w_title', |
| 2233 |
'w_required', |
| 2234 |
'w_unique', |
| 2235 |
'w_class', |
| 2236 |
'w_verification', |
| 2237 |
'w_verification_label', |
| 2238 |
'w_verification_placeholder', |
| 2239 |
'w_autofill', |
| 2240 |
); |
| 2241 |
} |
| 2242 |
foreach ( $params_names as $params_name ) { |
| 2243 |
$temp = explode('*:*' . $params_name . '*:*', $temp); |
| 2244 |
$param[$params_name] = $temp[0]; |
| 2245 |
$temp = $temp[1]; |
| 2246 |
} |
| 2247 |
$required = ($param['w_required'] == "yes" ? TRUE : FALSE); |
| 2248 |
if ( $required ) { |
| 2249 |
array_push($req_fields, $id1); |
| 2250 |
} |
| 2251 |
break; |
| 2252 |
} |
| 2253 |
case 'type_checkbox': { |
| 2254 |
$params_names = array( |
| 2255 |
'w_field_label_size', |
| 2256 |
'w_field_label_pos', |
| 2257 |
'w_flow', |
| 2258 |
'w_choices', |
| 2259 |
'w_choices_checked', |
| 2260 |
'w_rowcol', |
| 2261 |
'w_required', |
| 2262 |
'w_randomize', |
| 2263 |
'w_allow_other', |
| 2264 |
'w_allow_other_num', |
| 2265 |
'w_class', |
| 2266 |
); |
| 2267 |
$temp = $params; |
| 2268 |
if ( strpos($temp, 'w_field_option_pos') > -1 ) { |
| 2269 |
$params_names = array( |
| 2270 |
'w_field_label_size', |
| 2271 |
'w_field_label_pos', |
| 2272 |
'w_field_option_pos', |
| 2273 |
'w_flow', |
| 2274 |
'w_choices', |
| 2275 |
'w_choices_checked', |
| 2276 |
'w_rowcol', |
| 2277 |
'w_required', |
| 2278 |
'w_randomize', |
| 2279 |
'w_allow_other', |
| 2280 |
'w_allow_other_num', |
| 2281 |
'w_value_disabled', |
| 2282 |
'w_choices_value', |
| 2283 |
'w_choices_params', |
| 2284 |
'w_class', |
| 2285 |
); |
| 2286 |
} |
| 2287 |
if ( strpos($temp, 'w_hide_label') > -1 ) { |
| 2288 |
$params_names = array( |
| 2289 |
'w_field_label_size', |
| 2290 |
'w_field_label_pos', |
| 2291 |
'w_field_option_pos', |
| 2292 |
'w_hide_label', |
| 2293 |
'w_flow', |
| 2294 |
'w_choices', |
| 2295 |
'w_choices_checked', |
| 2296 |
'w_rowcol', |
| 2297 |
'w_required', |
| 2298 |
'w_randomize', |
| 2299 |
'w_allow_other', |
| 2300 |
'w_allow_other_num', |
| 2301 |
'w_value_disabled', |
| 2302 |
'w_choices_value', |
| 2303 |
'w_choices_params', |
| 2304 |
'w_class', |
| 2305 |
); |
| 2306 |
} |
| 2307 |
|
| 2308 |
foreach ( $params_names as $params_name ) { |
| 2309 |
$temp = explode('*:*' . $params_name . '*:*', $temp); |
| 2310 |
$param[$params_name] = $temp[0]; |
| 2311 |
$temp = $temp[1]; |
| 2312 |
} |
| 2313 |
|
| 2314 |
if ( isset($param['w_choices_value']) ) { |
| 2315 |
$param['w_choices_value'] = explode('***', $param['w_choices_value']); |
| 2316 |
$param['w_choices_params'] = explode('***', $param['w_choices_params']); |
| 2317 |
} |
| 2318 |
|
| 2319 |
foreach ( $param['w_choices_params'] as $choices ) { |
| 2320 |
if ( !empty($choices) ) { |
| 2321 |
preg_match_all('/{\d+}/', $choices, $matches); |
| 2322 |
if ( !empty($matches[0][0]) ) { |
| 2323 |
$inputIds[$id_type][] = str_replace( array('{','}'), array('',''), $matches[0][0] ); |
| 2324 |
} |
| 2325 |
} |
| 2326 |
} |
| 2327 |
|
| 2328 |
$required = ($param['w_required'] == "yes" ? TRUE : FALSE); |
| 2329 |
$post_value = isset($_POST["counter" . $form_id]) ? esc_html($_POST["counter" . $form_id]) : NULL; |
| 2330 |
$is_other = FALSE; |
| 2331 |
if ( isset($post_value) ) { |
| 2332 |
if ( $param['w_allow_other'] == "yes" ) { |
| 2333 |
$is_other = FALSE; |
| 2334 |
$other_element = isset($_POST['wdform_' . $id1 . "_other_input" . $form_id]) ? esc_html($_POST['wdform_' . $id1 . "_other_input" . $form_id]) : NULL; |
| 2335 |
if ( isset($other_element) ) { |
| 2336 |
$is_other = TRUE; |
| 2337 |
} |
| 2338 |
} |
| 2339 |
} |
| 2340 |
else { |
| 2341 |
$is_other = ($param['w_allow_other'] == "yes" && $param['w_choices_checked'][$param['w_allow_other_num']] == 'true'); |
| 2342 |
} |
| 2343 |
if ( $required ) { |
| 2344 |
array_push($req_fields, $id1); |
| 2345 |
} |
| 2346 |
if ( $is_other ) { |
| 2347 |
$onload_js .= 'show_other_input("wdform_' . $id1 . '","' . $form_id . '"); jQuery("#wdform_' . $id1 . '_other_input' . $form_id . '").val("' . (isset($_POST['wdform_' . $id1 . "_other_input" . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . "_other_input" . $form_id])) : '') . '");'; |
| 2348 |
} |
| 2349 |
if ( $param['w_randomize'] == 'yes' ) { |
| 2350 |
$onload_js .= 'jQuery("#form' . $form_id . ' div[wdid=' . $id1 . '] .wdform-element-section> div").shuffle();'; |
| 2351 |
} |
| 2352 |
$onsubmit_js .= ' |
| 2353 |
jQuery("<input type=\"hidden\" name=\"wdform_' . $id1 . '_allow_other' . $form_id . '\" value=\"' . $param['w_allow_other'] . '\" />").appendTo("#form' . $form_id . '"); |
| 2354 |
jQuery("<input type=\"hidden\" name=\"wdform_' . $id1 . '_allow_other_num' . $form_id . '\" value=\"' . $param['w_allow_other_num'] . '\" />").appendTo("#form' . $form_id . '");'; |
| 2355 |
break; |
| 2356 |
} |
| 2357 |
case 'type_radio': { |
| 2358 |
$params_names = array( |
| 2359 |
'w_field_label_size', |
| 2360 |
'w_field_label_pos', |
| 2361 |
'w_flow', |
| 2362 |
'w_choices', |
| 2363 |
'w_choices_checked', |
| 2364 |
'w_rowcol', |
| 2365 |
'w_required', |
| 2366 |
'w_randomize', |
| 2367 |
'w_allow_other', |
| 2368 |
'w_allow_other_num', |
| 2369 |
'w_class', |
| 2370 |
); |
| 2371 |
$temp = $params; |
| 2372 |
if ( strpos($temp, 'w_field_option_pos') > -1 ) { |
| 2373 |
$params_names = array( |
| 2374 |
'w_field_label_size', |
| 2375 |
'w_field_label_pos', |
| 2376 |
'w_field_option_pos', |
| 2377 |
'w_flow', |
| 2378 |
'w_choices', |
| 2379 |
'w_choices_checked', |
| 2380 |
'w_rowcol', |
| 2381 |
'w_required', |
| 2382 |
'w_randomize', |
| 2383 |
'w_allow_other', |
| 2384 |
'w_allow_other_num', |
| 2385 |
'w_value_disabled', |
| 2386 |
'w_choices_value', |
| 2387 |
'w_choices_params', |
| 2388 |
'w_class', |
| 2389 |
); |
| 2390 |
} |
| 2391 |
if ( strpos($temp, 'w_hide_label') > -1 ) { |
| 2392 |
$params_names = array( |
| 2393 |
'w_field_label_size', |
| 2394 |
'w_field_label_pos', |
| 2395 |
'w_field_option_pos', |
| 2396 |
'w_hide_label', |
| 2397 |
'w_flow', |
| 2398 |
'w_choices', |
| 2399 |
'w_choices_checked', |
| 2400 |
'w_rowcol', |
| 2401 |
'w_required', |
| 2402 |
'w_randomize', |
| 2403 |
'w_allow_other', |
| 2404 |
'w_allow_other_num', |
| 2405 |
'w_value_disabled', |
| 2406 |
'w_choices_value', |
| 2407 |
'w_choices_params', |
| 2408 |
'w_class', |
| 2409 |
); |
| 2410 |
} |
| 2411 |
foreach ( $params_names as $params_name ) { |
| 2412 |
$temp = explode('*:*' . $params_name . '*:*', $temp); |
| 2413 |
$param[$params_name] = $temp[0]; |
| 2414 |
$temp = $temp[1]; |
| 2415 |
} |
| 2416 |
|
| 2417 |
if ( isset($param['w_choices_value']) ) { |
| 2418 |
$param['w_choices_value'] = explode('***', $param['w_choices_value']); |
| 2419 |
$param['w_choices_params'] = explode('***', $param['w_choices_params']); |
| 2420 |
} |
| 2421 |
|
| 2422 |
foreach ( $param['w_choices_params'] as $choices ) { |
| 2423 |
if ( !empty($choices) ) { |
| 2424 |
preg_match_all('/{\d+}/', $choices, $matches); |
| 2425 |
if ( !empty($matches[0][0]) ) { |
| 2426 |
$inputIds[$id_type][] = str_replace( array('{','}'), array('',''), $matches[0][0] ); |
| 2427 |
} |
| 2428 |
} |
| 2429 |
} |
| 2430 |
|
| 2431 |
$required = ($param['w_required'] == "yes" ? TRUE : FALSE); |
| 2432 |
$post_value = isset($_POST["counter" . $form_id]) ? esc_html($_POST["counter" . $form_id]) : NULL; |
| 2433 |
$is_other = FALSE; |
| 2434 |
if ( isset($post_value) ) { |
| 2435 |
if ( $param['w_allow_other'] == "yes" ) { |
| 2436 |
$is_other = FALSE; |
| 2437 |
$other_element = isset($_POST['wdform_' . $id1 . "_other_input" . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . "_other_input" . $form_id])) : ""; |
| 2438 |
if ( isset($other_element) ) { |
| 2439 |
$is_other = TRUE; |
| 2440 |
} |
| 2441 |
} |
| 2442 |
} |
| 2443 |
else { |
| 2444 |
$is_other = ($param['w_allow_other'] == "yes" && $param['w_choices_checked'][$param['w_allow_other_num']] == 'true'); |
| 2445 |
} |
| 2446 |
if ( $required ) { |
| 2447 |
array_push($req_fields, $id1); |
| 2448 |
} |
| 2449 |
if ( $is_other ) { |
| 2450 |
$onload_js .= ' |
| 2451 |
show_other_input("wdform_' . $id1 . '","' . $form_id . '"); jQuery("#wdform_' . $id1 . '_other_input' . $form_id . '").val("' . (isset($_POST['wdform_' . $id1 . "_other_input" . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . "_other_input" . $form_id])) : '') . '");'; |
| 2452 |
} |
| 2453 |
if ( $param['w_randomize'] == 'yes' ) { |
| 2454 |
$onload_js .= ' |
| 2455 |
jQuery("#form' . $form_id . ' div[wdid=' . $id1 . '] .wdform-element-section> div").shuffle();'; |
| 2456 |
} |
| 2457 |
$onsubmit_js .= ' |
| 2458 |
jQuery("<input type=\"hidden\" name=\"wdform_' . $id1 . '_allow_other' . $form_id . '\" value=\"' . $param['w_allow_other'] . '\" />").appendTo("#form' . $form_id . '"); |
| 2459 |
jQuery("<input type=\"hidden\" name=\"wdform_' . $id1 . '_allow_other_num' . $form_id . '\" value=\"' . $param['w_allow_other_num'] . '\" />").appendTo("#form' . $form_id . '");'; |
| 2460 |
break; |
| 2461 |
} |
| 2462 |
case 'type_own_select': { |
| 2463 |
$params_names = array( |
| 2464 |
'w_field_label_size', |
| 2465 |
'w_field_label_pos', |
| 2466 |
'w_size', |
| 2467 |
'w_choices', |
| 2468 |
'w_choices_checked', |
| 2469 |
'w_choices_disabled', |
| 2470 |
'w_required', |
| 2471 |
'w_class', |
| 2472 |
); |
| 2473 |
$temp = $params; |
| 2474 |
if ( strpos($temp, 'w_choices_value') > -1 ) { |
| 2475 |
$params_names = array( |
| 2476 |
'w_field_label_size', |
| 2477 |
'w_field_label_pos', |
| 2478 |
'w_size', |
| 2479 |
'w_choices', |
| 2480 |
'w_choices_checked', |
| 2481 |
'w_choices_disabled', |
| 2482 |
'w_required', |
| 2483 |
'w_value_disabled', |
| 2484 |
'w_choices_value', |
| 2485 |
'w_choices_params', |
| 2486 |
'w_class', |
| 2487 |
); |
| 2488 |
} |
| 2489 |
if ( strpos($temp, 'w_hide_label') > -1 ) { |
| 2490 |
$params_names = array( |
| 2491 |
'w_field_label_size', |
| 2492 |
'w_field_label_pos', |
| 2493 |
'w_hide_label', |
| 2494 |
'w_size', |
| 2495 |
'w_choices', |
| 2496 |
'w_choices_checked', |
| 2497 |
'w_choices_disabled', |
| 2498 |
'w_required', |
| 2499 |
'w_value_disabled', |
| 2500 |
'w_choices_value', |
| 2501 |
'w_choices_params', |
| 2502 |
'w_class', |
| 2503 |
); |
| 2504 |
} |
| 2505 |
foreach ( $params_names as $params_name ) { |
| 2506 |
$temp = explode('*:*' . $params_name . '*:*', $temp); |
| 2507 |
$param[$params_name] = $temp[0]; |
| 2508 |
$temp = $temp[1]; |
| 2509 |
} |
| 2510 |
|
| 2511 |
if ( isset($param['w_choices_value']) ) { |
| 2512 |
$param['w_choices_value'] = explode('***', $param['w_choices_value']); |
| 2513 |
$param['w_choices_params'] = explode('***', $param['w_choices_params']); |
| 2514 |
} |
| 2515 |
|
| 2516 |
foreach ( $param['w_choices_params'] as $choices ) { |
| 2517 |
if ( !empty($choices) ) { |
| 2518 |
preg_match_all('/{\d+}/', $choices, $matches); |
| 2519 |
if ( !empty($matches[0][0]) ) { |
| 2520 |
$inputIds[$id_type][] = str_replace( array('{','}'), array('',''), $matches[0][0] ); |
| 2521 |
} |
| 2522 |
} |
| 2523 |
} |
| 2524 |
$required = ($param['w_required'] == "yes" ? TRUE : FALSE); |
| 2525 |
if ( $required ) { |
| 2526 |
array_push($req_fields, $id1); |
| 2527 |
} |
| 2528 |
break; |
| 2529 |
} |
| 2530 |
case 'type_country': { |
| 2531 |
$params_names = array( |
| 2532 |
'w_field_label_size', |
| 2533 |
'w_field_label_pos', |
| 2534 |
'w_size', |
| 2535 |
'w_countries', |
| 2536 |
'w_required', |
| 2537 |
'w_class', |
| 2538 |
); |
| 2539 |
$temp = $params; |
| 2540 |
if ( strpos($temp, 'w_hide_label') > -1 ) { |
| 2541 |
$params_names = array( |
| 2542 |
'w_field_label_size', |
| 2543 |
'w_field_label_pos', |
| 2544 |
'w_hide_label', |
| 2545 |
'w_size', |
| 2546 |
'w_countries', |
| 2547 |
'w_required', |
| 2548 |
'w_class', |
| 2549 |
); |
| 2550 |
} |
| 2551 |
foreach ( $params_names as $params_name ) { |
| 2552 |
$temp = explode('*:*' . $params_name . '*:*', $temp); |
| 2553 |
$param[$params_name] = $temp[0]; |
| 2554 |
$temp = $temp[1]; |
| 2555 |
} |
| 2556 |
$required = ($param['w_required'] == "yes" ? TRUE : FALSE); |
| 2557 |
if ( $required ) { |
| 2558 |
array_push($req_fields, $id1); |
| 2559 |
} |
| 2560 |
break; |
| 2561 |
} |
| 2562 |
case 'type_time': { |
| 2563 |
$params_names = array( |
| 2564 |
'w_field_label_size', |
| 2565 |
'w_field_label_pos', |
| 2566 |
'w_time_type', |
| 2567 |
'w_am_pm', |
| 2568 |
'w_sec', |
| 2569 |
'w_hh', |
| 2570 |
'w_mm', |
| 2571 |
'w_ss', |
| 2572 |
'w_mini_labels', |
| 2573 |
'w_required', |
| 2574 |
'w_class', |
| 2575 |
); |
| 2576 |
$temp = $params; |
| 2577 |
if ( strpos($temp, 'w_hide_label') > -1 ) { |
| 2578 |
$params_names = array( |
| 2579 |
'w_field_label_size', |
| 2580 |
'w_field_label_pos', |
| 2581 |
'w_hide_label', |
| 2582 |
'w_time_type', |
| 2583 |
'w_am_pm', |
| 2584 |
'w_sec', |
| 2585 |
'w_hh', |
| 2586 |
'w_mm', |
| 2587 |
'w_ss', |
| 2588 |
'w_mini_labels', |
| 2589 |
'w_required', |
| 2590 |
'w_class', |
| 2591 |
); |
| 2592 |
} |
| 2593 |
foreach ( $params_names as $params_name ) { |
| 2594 |
$temp = explode('*:*' . $params_name . '*:*', $temp); |
| 2595 |
$param[$params_name] = $temp[0]; |
| 2596 |
$temp = $temp[1]; |
| 2597 |
} |
| 2598 |
$required = ($param['w_required'] == "yes" ? TRUE : FALSE); |
| 2599 |
if ( $required ) { |
| 2600 |
array_push($req_fields, $id1); |
| 2601 |
} |
| 2602 |
break; |
| 2603 |
} |
| 2604 |
case 'type_date': { |
| 2605 |
$params_names = array( |
| 2606 |
'w_field_label_size', |
| 2607 |
'w_field_label_pos', |
| 2608 |
'w_date', |
| 2609 |
'w_required', |
| 2610 |
'w_class', |
| 2611 |
'w_format', |
| 2612 |
'w_but_val', |
| 2613 |
); |
| 2614 |
$temp = $params; |
| 2615 |
if ( strpos($temp, 'w_disable_past_days') > -1 ) { |
| 2616 |
$params_names = array( |
| 2617 |
'w_field_label_size', |
| 2618 |
'w_field_label_pos', |
| 2619 |
'w_date', |
| 2620 |
'w_required', |
| 2621 |
'w_class', |
| 2622 |
'w_format', |
| 2623 |
'w_but_val', |
| 2624 |
'w_disable_past_days', |
| 2625 |
); |
| 2626 |
} |
| 2627 |
foreach ( $params_names as $params_name ) { |
| 2628 |
$temp = explode('*:*' . $params_name . '*:*', $temp); |
| 2629 |
$param[$params_name] = $temp[0]; |
| 2630 |
$temp = $temp[1]; |
| 2631 |
} |
| 2632 |
$required = ($param['w_required'] == "yes" ? TRUE : FALSE); |
| 2633 |
$param['w_disable_past_days'] = isset($param['w_disable_past_days']) ? $param['w_disable_past_days'] : 'no'; |
| 2634 |
$disable_past_days = $param['w_disable_past_days'] == 'yes' ? 'true' : 'false'; |
| 2635 |
if ( $required ) { |
| 2636 |
array_push($req_fields, $id1); |
| 2637 |
} |
| 2638 |
if ( $disable_past_days == 'true' ) { |
| 2639 |
$check_js .= ' |
| 2640 |
if( Date.parse(jQuery("#wdform_' . $id1 . '_element' . $form_id . '").val() + " 23:59:59") < fm_currentDate.getTime() ) { |
| 2641 |
alert("' . __('You cannot select former dates. Choose a date starting from the current one.', WDFMInstance(self::PLUGIN)->prefix) . '"); |
| 2642 |
return false; |
| 2643 |
}'; |
| 2644 |
} |
| 2645 |
$date_format= str_replace('%', '', $param['w_format']); |
| 2646 |
|
| 2647 |
$onsubmit_js .= ' |
| 2648 |
jQuery("<input type=\"hidden\" name=\"wdform_' . $id1 . '_date_format' . $form_id . '\" value=\"' . $date_format . '\" />").appendTo("#form' . $form_id . '");'; |
| 2649 |
break; |
| 2650 |
} |
| 2651 |
case 'type_date_new': { |
| 2652 |
$params_names = array( |
| 2653 |
'w_field_label_size', |
| 2654 |
'w_field_label_pos', |
| 2655 |
'w_size', |
| 2656 |
'w_date', |
| 2657 |
'w_required', |
| 2658 |
'w_show_image', |
| 2659 |
'w_class', |
| 2660 |
'w_format', |
| 2661 |
'w_start_day', |
| 2662 |
'w_default_date', |
| 2663 |
'w_min_date', |
| 2664 |
'w_max_date', |
| 2665 |
'w_invalid_dates', |
| 2666 |
'w_show_days', |
| 2667 |
'w_hide_time', |
| 2668 |
'w_but_val', |
| 2669 |
'w_disable_past_days', |
| 2670 |
); |
| 2671 |
$temp = $params; |
| 2672 |
if ( strpos($temp, 'w_hide_label') > -1 ) { |
| 2673 |
$params_names = array( |
| 2674 |
'w_field_label_size', |
| 2675 |
'w_field_label_pos', |
| 2676 |
'w_hide_label', |
| 2677 |
'w_size', |
| 2678 |
'w_date', |
| 2679 |
'w_required', |
| 2680 |
'w_show_image', |
| 2681 |
'w_class', |
| 2682 |
'w_format', |
| 2683 |
'w_start_day', |
| 2684 |
'w_default_date', |
| 2685 |
'w_min_date', |
| 2686 |
'w_max_date', |
| 2687 |
'w_invalid_dates', |
| 2688 |
'w_show_days', |
| 2689 |
'w_hide_time', |
| 2690 |
'w_but_val', |
| 2691 |
'w_disable_past_days', |
| 2692 |
); |
| 2693 |
} |
| 2694 |
foreach ( $params_names as $params_name ) { |
| 2695 |
$temp = explode('*:*' . $params_name . '*:*', $temp); |
| 2696 |
$param[$params_name] = $temp[0]; |
| 2697 |
$temp = $temp[1]; |
| 2698 |
} |
| 2699 |
$required = ($param['w_required'] == "yes" ? TRUE : FALSE); |
| 2700 |
$default_date = (isset($_POST['wdform_' . $id1 . "_element" . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . "_element" . $form_id])) : $param['w_default_date']); |
| 2701 |
$w_show_week_days = explode('***', $param['w_show_days']); |
| 2702 |
$w_hide_sunday = $w_show_week_days[0] == 'yes' ? '' : ' && day != 0'; |
| 2703 |
$w_hide_monday = $w_show_week_days[1] == 'yes' ? '' : ' && day != 1'; |
| 2704 |
$w_hide_tuesday = $w_show_week_days[2] == 'yes' ? '' : ' && day != 2'; |
| 2705 |
$w_hide_wednesday = $w_show_week_days[3] == 'yes' ? '' : ' && day != 3'; |
| 2706 |
$w_hide_thursday = $w_show_week_days[4] == 'yes' ? '' : ' && day != 4'; |
| 2707 |
$w_hide_friday = $w_show_week_days[5] == 'yes' ? '' : ' && day != 5'; |
| 2708 |
$w_hide_saturday = $w_show_week_days[6] == 'yes' ? '' : '&& day != 6'; |
| 2709 |
if ( $required ) { |
| 2710 |
array_push($req_fields, $id1); |
| 2711 |
} |
| 2712 |
$onload_js .= ' |
| 2713 |
jQuery("#button_calendar_' . $id1 . ', #fm-calendar-' . $id1 . '").click(function() { |
| 2714 |
jQuery("#wdform_' . $id1 . '_element' . $form_id . '").datepicker("show"); |
| 2715 |
}); |
| 2716 |
jQuery("#wdform_' . $id1 . '_element' . $form_id . '").datepicker({ |
| 2717 |
dateFormat: format_date, |
| 2718 |
minDate: "' . $param['w_min_date'] . '", |
| 2719 |
maxDate: "' . $param['w_max_date'] . '", |
| 2720 |
changeMonth: true, |
| 2721 |
changeYear: true, |
| 2722 |
yearRange: "-100:+50", |
| 2723 |
showOtherMonths: true, |
| 2724 |
selectOtherMonths: true, |
| 2725 |
firstDay: "' . $param['w_start_day'] . '", |
| 2726 |
beforeShow: function(input, inst) { |
| 2727 |
jQuery("#ui-datepicker-div").addClass("fm_datepicker"); |
| 2728 |
}, |
| 2729 |
beforeShowDay: function(date) { |
| 2730 |
var invalid_dates = "' . $param["w_invalid_dates"] . '"; |
| 2731 |
var invalid_dates_finish = []; |
| 2732 |
var invalid_dates_start = invalid_dates.split(","); |
| 2733 |
var invalid_date_range =[]; |
| 2734 |
for(var i = 0; i < invalid_dates_start.length; i++ ) { |
| 2735 |
invalid_dates_start[i] = invalid_dates_start[i].trim(); |
| 2736 |
if(invalid_dates_start[i].length < 11 || invalid_dates_start[i].indexOf("-") == -1){ |
| 2737 |
invalid_dates_finish.push(invalid_dates_start[i]); |
| 2738 |
} |
| 2739 |
else{ |
| 2740 |
if(invalid_dates_start[i].indexOf("-") > 4) { |
| 2741 |
invalid_date_range.push(invalid_dates_start[i].split("-")); |
| 2742 |
} |
| 2743 |
else { |
| 2744 |
var invalid_date_array = invalid_dates_start[i].split("-"); |
| 2745 |
var start_invalid_day = invalid_date_array[0] + "-" + invalid_date_array[1] + "-" + invalid_date_array[2]; |
| 2746 |
var end_invalid_day = invalid_date_array[3] + "-" + invalid_date_array[4] + "-" + invalid_date_array[5]; |
| 2747 |
invalid_date_range.push([start_invalid_day, end_invalid_day]); |
| 2748 |
} |
| 2749 |
} |
| 2750 |
} |
| 2751 |
jQuery.each(invalid_date_range, function( index, value ) { |
| 2752 |
for(var d = new Date(value[0]); d <= new Date(value[1]); d.setDate(d.getDate() + 1)) { |
| 2753 |
invalid_dates_finish.push(jQuery.datepicker.formatDate(format_date, d)); |
| 2754 |
} |
| 2755 |
}); |
| 2756 |
var string_days = jQuery.datepicker.formatDate(format_date, date); |
| 2757 |
var day = date.getDay(); |
| 2758 |
return [ invalid_dates_finish.indexOf(string_days) == -1 ' . $w_hide_sunday . $w_hide_monday . $w_hide_tuesday . $w_hide_wednesday . $w_hide_thursday . $w_hide_friday . $w_hide_saturday . ']; |
| 2759 |
} |
| 2760 |
}); |
| 2761 |
var default_date; |
| 2762 |
var date_value = jQuery("#wdform_' . $id1 . '_element' . $form_id . '").val(); |
| 2763 |
(date_value != "") ? default_date = date_value : default_date = "' . $default_date . '"; |
| 2764 |
var format_date = "' . $param['w_format'] . '"; |
| 2765 |
jQuery("#wdform_' . $id1 . '_element' . $form_id . '").datepicker("option", "dateFormat", format_date); |
| 2766 |
if(default_date == "today") { |
| 2767 |
jQuery("#wdform_' . $id1 . '_element' . $form_id . '").datepicker("setDate", new Date()); |
| 2768 |
} |
| 2769 |
else if (default_date.indexOf("d") == -1 && default_date.indexOf("m") == -1 && default_date.indexOf("y") == -1 && default_date.indexOf("w") == -1) { |
| 2770 |
jQuery("#wdform_' . $id1 . '_element' . $form_id . '").datepicker("setDate", default_date); |
| 2771 |
} |
| 2772 |
else { |
| 2773 |
jQuery("#wdform_' . $id1 . '_element' . $form_id . '").datepicker("setDate", default_date); |
| 2774 |
}'; |
| 2775 |
break; |
| 2776 |
} |
| 2777 |
case 'type_date_range': { |
| 2778 |
$params_names = array( |
| 2779 |
'w_field_label_size', |
| 2780 |
'w_field_label_pos', |
| 2781 |
'w_size', |
| 2782 |
'w_date', |
| 2783 |
'w_required', |
| 2784 |
'w_show_image', |
| 2785 |
'w_class', |
| 2786 |
'w_format', |
| 2787 |
'w_start_day', |
| 2788 |
'w_default_date_start', |
| 2789 |
'w_default_date_end', |
| 2790 |
'w_min_date', |
| 2791 |
'w_max_date', |
| 2792 |
'w_invalid_dates', |
| 2793 |
'w_show_days', |
| 2794 |
'w_hide_time', |
| 2795 |
'w_but_val', |
| 2796 |
'w_disable_past_days', |
| 2797 |
); |
| 2798 |
$temp = $params; |
| 2799 |
if ( strpos($temp, 'w_hide_label') > -1 ) { |
| 2800 |
$params_names = array( |
| 2801 |
'w_field_label_size', |
| 2802 |
'w_field_label_pos', |
| 2803 |
'w_hide_label', |
| 2804 |
'w_size', |
| 2805 |
'w_date', |
| 2806 |
'w_required', |
| 2807 |
'w_show_image', |
| 2808 |
'w_class', |
| 2809 |
'w_format', |
| 2810 |
'w_start_day', |
| 2811 |
'w_default_date_start', |
| 2812 |
'w_default_date_end', |
| 2813 |
'w_min_date', |
| 2814 |
'w_max_date', |
| 2815 |
'w_invalid_dates', |
| 2816 |
'w_show_days', |
| 2817 |
'w_hide_time', |
| 2818 |
'w_but_val', |
| 2819 |
'w_disable_past_days', |
| 2820 |
); |
| 2821 |
} |
| 2822 |
foreach ( $params_names as $params_name ) { |
| 2823 |
$temp = explode('*:*' . $params_name . '*:*', $temp); |
| 2824 |
$param[$params_name] = $temp[0]; |
| 2825 |
$temp = $temp[1]; |
| 2826 |
} |
| 2827 |
$required = ($param['w_required'] == "yes" ? TRUE : FALSE); |
| 2828 |
if ( $param['w_default_date_start'] == 'today' ) { |
| 2829 |
$default_date_start = 'new Date()'; |
| 2830 |
} |
| 2831 |
else { |
| 2832 |
$default_date_start = $param['w_default_date_start']; |
| 2833 |
} |
| 2834 |
$w_show_week_days = explode('***', $param['w_show_days']); |
| 2835 |
$w_hide_sunday = $w_show_week_days[0] == 'yes' ? '' : ' && day != 0'; |
| 2836 |
$w_hide_monday = $w_show_week_days[1] == 'yes' ? '' : ' && day != 1'; |
| 2837 |
$w_hide_tuesday = $w_show_week_days[2] == 'yes' ? '' : ' && day != 2'; |
| 2838 |
$w_hide_wednesday = $w_show_week_days[3] == 'yes' ? '' : ' && day != 3'; |
| 2839 |
$w_hide_thursday = $w_show_week_days[4] == 'yes' ? '' : ' && day != 4'; |
| 2840 |
$w_hide_friday = $w_show_week_days[5] == 'yes' ? '' : ' && day != 5'; |
| 2841 |
$w_hide_saturday = $w_show_week_days[6] == 'yes' ? '' : '&& day != 6'; |
| 2842 |
if ( $required ) { |
| 2843 |
array_push($req_fields, $id1); |
| 2844 |
} |
| 2845 |
$onload_js .= ' |
| 2846 |
jQuery("#button_calendar_' . $id1 . '0").click(function() { |
| 2847 |
jQuery("#wdform_' . $id1 . '_element' . $form_id . '0").datepicker("show"); |
| 2848 |
}); |
| 2849 |
jQuery("#button_calendar_' . $id1 . '1").click(function() { |
| 2850 |
jQuery("#wdform_' . $id1 . '_element' . $form_id . '1").datepicker("show"); |
| 2851 |
}); |
| 2852 |
jQuery("input[id^=\'wdform_' . $id1 . '_element' . $form_id . '\']").datepicker({ |
| 2853 |
dateFormat: "mm/dd/yy", |
| 2854 |
minDate: "' . $param['w_min_date'] . '", |
| 2855 |
maxDate: "' . $param['w_max_date'] . '", |
| 2856 |
changeMonth: true, |
| 2857 |
changeYear: true, |
| 2858 |
yearRange: "-100:+50", |
| 2859 |
showOtherMonths: true, |
| 2860 |
selectOtherMonths: true, |
| 2861 |
firstDay: "' . $param['w_start_day'] . '", |
| 2862 |
beforeShow: function(input, inst) { |
| 2863 |
jQuery("#ui-datepicker-div").addClass("fm_datepicker"); |
| 2864 |
}, |
| 2865 |
beforeShowDay: function(date){ |
| 2866 |
var invalid_dates = "' . $param["w_invalid_dates"] . '"; |
| 2867 |
var invalid_dates_finish = []; |
| 2868 |
var invalid_dates_start = invalid_dates.split(","); |
| 2869 |
var invalid_date_range =[]; |
| 2870 |
for(var i = 0; i < invalid_dates_start.length; i++ ){ |
| 2871 |
invalid_dates_start[i] = invalid_dates_start[i].trim(); |
| 2872 |
if(invalid_dates_start[i].length < 11 || invalid_dates_start[i].indexOf("-") == -1) { |
| 2873 |
invalid_dates_finish.push(invalid_dates_start[i]); |
| 2874 |
} |
| 2875 |
else { |
| 2876 |
if(invalid_dates_start[i].indexOf("-") > 4) { |
| 2877 |
invalid_date_range.push(invalid_dates_start[i].split("-")); |
| 2878 |
} |
| 2879 |
else { |
| 2880 |
var invalid_date_array = invalid_dates_start[i].split("-"); |
| 2881 |
var start_invalid_day = invalid_date_array[0] + "-" + invalid_date_array[1] + "-" + invalid_date_array[2]; |
| 2882 |
var end_invalid_day = invalid_date_array[3] + "-" + invalid_date_array[4] + "-" + invalid_date_array[5]; |
| 2883 |
invalid_date_range.push([start_invalid_day, end_invalid_day]); |
| 2884 |
} |
| 2885 |
} |
| 2886 |
} |
| 2887 |
jQuery.each(invalid_date_range, function( index, value ) { |
| 2888 |
for(var d = new Date(value[0]); d <= new Date(value[1]); d.setDate(d.getDate() + 1)) { |
| 2889 |
invalid_dates_finish.push(jQuery.datepicker.formatDate("mm/dd/yy", d)); |
| 2890 |
} |
| 2891 |
}); |
| 2892 |
var string_days = jQuery.datepicker.formatDate("mm/dd/yy", date); |
| 2893 |
var day = date.getDay(); |
| 2894 |
return [ invalid_dates_finish.indexOf(string_days) == -1 ' . $w_hide_sunday . $w_hide_monday . $w_hide_tuesday . $w_hide_wednesday . $w_hide_thursday . $w_hide_friday . $w_hide_saturday . ']; |
| 2895 |
} |
| 2896 |
}); |
| 2897 |
var default_date_start; |
| 2898 |
var date_start_value = jQuery("#wdform_' . $id1 . '_element' . $form_id . '0").val(); |
| 2899 |
(date_start_value != "") ? default_date_start = date_start_value : default_date_start = "' . $param['w_default_date_start'] . '"; |
| 2900 |
var format_date = "' . $param['w_format'] . '"; |
| 2901 |
jQuery("#wdform_' . $id1 . '_element' . $form_id . '").datepicker("option", "dateFormat", format_date); |
| 2902 |
if(default_date_start =="today") { |
| 2903 |
jQuery("#wdform_' . $id1 . '_element' . $form_id . '0").datepicker("setDate", new Date()); |
| 2904 |
jQuery("#wdform_' . $id1 . '_element' . $form_id . '1").datepicker("option", "minDate", new Date()); |
| 2905 |
} |
| 2906 |
else if(default_date_start.indexOf("d") == -1 && default_date_start.indexOf("m") == -1 && default_date_start.indexOf("y") == -1 && default_date_start.indexOf("w") == -1) { |
| 2907 |
if(default_date_start !== "") { |
| 2908 |
default_date_start = jQuery.datepicker.formatDate(format_date, new Date(default_date_start)); |
| 2909 |
jQuery("#wdform_' . $id1 . '_element' . $form_id . '0").datepicker("setDate", default_date_start); |
| 2910 |
jQuery("#wdform_' . $id1 . '_element' . $form_id . '1").datepicker("option", "minDate", default_date_start); |
| 2911 |
} |
| 2912 |
else { |
| 2913 |
jQuery("#wdform_' . $id1 . '_element' . $form_id . '0").datepicker("setDate", default_date_start); |
| 2914 |
} |
| 2915 |
} |
| 2916 |
else { |
| 2917 |
jQuery("#wdform_' . $id1 . '_element' . $form_id . '0").datepicker("setDate", default_date_start); |
| 2918 |
jQuery("#wdform_' . $id1 . '_element' . $form_id . '1").datepicker("option", "minDate", default_date_start); |
| 2919 |
} |
| 2920 |
var default_date_end; |
| 2921 |
var date_end_value = jQuery("#wdform_' . $id1 . '_element' . $form_id . '1").val(); |
| 2922 |
(date_end_value != "") ? default_date_end = date_end_value : default_date_end = "' . $param['w_default_date_end'] . '"; |
| 2923 |
var format_date = "' . $param['w_format'] . '"; |
| 2924 |
jQuery("#wdform_' . $id1 . '_element' . $form_id . '0").datepicker("option", "dateFormat", format_date); |
| 2925 |
jQuery("#wdform_' . $id1 . '_element' . $form_id . '1").datepicker("option", "dateFormat", format_date); |
| 2926 |
if(default_date_end =="today") { |
| 2927 |
jQuery("#wdform_' . $id1 . '_element' . $form_id . '1").datepicker("setDate", new Date()); |
| 2928 |
jQuery("#wdform_' . $id1 . '_element' . $form_id . '0").datepicker("option", "maxDate", new Date()); |
| 2929 |
} |
| 2930 |
else if(default_date_end.indexOf("d") == -1 && default_date_end.indexOf("m") == -1 && default_date_end.indexOf("y") == -1 && default_date_end.indexOf("w") == -1) { |
| 2931 |
if(default_date_end !== "") { |
| 2932 |
default_date_end = jQuery.datepicker.formatDate(format_date, new Date(default_date_end)); |
| 2933 |
jQuery("#wdform_' . $id1 . '_element' . $form_id . '1").datepicker("setDate", default_date_end); |
| 2934 |
jQuery("#wdform_' . $id1 . '_element' . $form_id . '0").datepicker("option", "maxDate", default_date_end); |
| 2935 |
} |
| 2936 |
else { |
| 2937 |
jQuery("#wdform_' . $id1 . '_element' . $form_id . '1").datepicker("setDate", default_date_end); |
| 2938 |
} |
| 2939 |
} |
| 2940 |
else { |
| 2941 |
jQuery("#wdform_' . $id1 . '_element' . $form_id . '1").datepicker("setDate", default_date_end); |
| 2942 |
jQuery("#wdform_' . $id1 . '_element' . $form_id . '0").datepicker("option", "maxDate", default_date_end); |
| 2943 |
}'; |
| 2944 |
break; |
| 2945 |
} |
| 2946 |
case 'type_date_fields': { |
| 2947 |
$params_names = array( |
| 2948 |
'w_field_label_size', |
| 2949 |
'w_field_label_pos', |
| 2950 |
'w_day', |
| 2951 |
'w_month', |
| 2952 |
'w_year', |
| 2953 |
'w_day_type', |
| 2954 |
'w_month_type', |
| 2955 |
'w_year_type', |
| 2956 |
'w_day_label', |
| 2957 |
'w_month_label', |
| 2958 |
'w_year_label', |
| 2959 |
'w_day_size', |
| 2960 |
'w_month_size', |
| 2961 |
'w_year_size', |
| 2962 |
'w_required', |
| 2963 |
'w_class', |
| 2964 |
'w_from', |
| 2965 |
'w_to', |
| 2966 |
'w_divider', |
| 2967 |
); |
| 2968 |
$temp = $params; |
| 2969 |
if ( strpos($temp, 'w_hide_label') > -1 ) { |
| 2970 |
$params_names = array( |
| 2971 |
'w_field_label_size', |
| 2972 |
'w_field_label_pos', |
| 2973 |
'w_hide_label', |
| 2974 |
'w_day', |
| 2975 |
'w_month', |
| 2976 |
'w_year', |
| 2977 |
'w_day_type', |
| 2978 |
'w_month_type', |
| 2979 |
'w_year_type', |
| 2980 |
'w_day_label', |
| 2981 |
'w_month_label', |
| 2982 |
'w_year_label', |
| 2983 |
'w_day_size', |
| 2984 |
'w_month_size', |
| 2985 |
'w_year_size', |
| 2986 |
'w_required', |
| 2987 |
'w_class', |
| 2988 |
'w_from', |
| 2989 |
'w_to', |
| 2990 |
'w_divider', |
| 2991 |
); |
| 2992 |
} |
| 2993 |
foreach ( $params_names as $params_name ) { |
| 2994 |
$temp = explode('*:*' . $params_name . '*:*', $temp); |
| 2995 |
$param[$params_name] = $temp[0]; |
| 2996 |
$temp = $temp[1]; |
| 2997 |
} |
| 2998 |
$required = ($param['w_required'] == "yes" ? TRUE : FALSE); |
| 2999 |
if ( $param['w_day_type'] != "SELECT" ) { |
| 3000 |
$w_day_type = '<input type="text" value="' . $param['w_day'] . '" id="wdform_' . $id1 . '_day' . $form_id . '" name="wdform_' . $id1 . '_day' . $form_id . '" style="width: ' . $param['w_day_size'] . 'px;" ' . $param['attributes'] . '>'; |
| 3001 |
$onload_js .= ' |
| 3002 |
jQuery("#wdform_' . $id1 . '_day' . $form_id . '").blur(function() {if (jQuery(this).val() == "0") jQuery(this).val(""); else add_0(this)});'; |
| 3003 |
} |
| 3004 |
if ( $param['w_month_type'] != "SELECT" ) { |
| 3005 |
$onload_js .= ' |
| 3006 |
jQuery("#wdform_' . $id1 . '_month' . $form_id . '").blur(function() {if (jQuery(this).val() == "0") jQuery(this).val(""); else add_0(this)});'; |
| 3007 |
} |
| 3008 |
if ( $required ) { |
| 3009 |
array_push($req_fields, $id1); |
| 3010 |
} |
| 3011 |
break; |
| 3012 |
} |
| 3013 |
case 'type_file_upload': { |
| 3014 |
$params_names = array( |
| 3015 |
'w_field_label_size', |
| 3016 |
'w_field_label_pos', |
| 3017 |
'w_destination', |
| 3018 |
'w_extension', |
| 3019 |
'w_max_size', |
| 3020 |
'w_required', |
| 3021 |
'w_multiple', |
| 3022 |
'w_class', |
| 3023 |
); |
| 3024 |
$temp = $params; |
| 3025 |
if ( strpos($temp, 'w_hide_label') > -1 ) { |
| 3026 |
$params_names = array( |
| 3027 |
'w_field_label_size', |
| 3028 |
'w_field_label_pos', |
| 3029 |
'w_hide_label', |
| 3030 |
'w_destination', |
| 3031 |
'w_extension', |
| 3032 |
'w_max_size', |
| 3033 |
'w_required', |
| 3034 |
'w_multiple', |
| 3035 |
'w_class', |
| 3036 |
); |
| 3037 |
} |
| 3038 |
foreach ( $params_names as $params_name ) { |
| 3039 |
$temp = explode('*:*' . $params_name . '*:*', $temp); |
| 3040 |
$param[$params_name] = $temp[0]; |
| 3041 |
if ( isset($temp[1]) ) { |
| 3042 |
$temp = $temp[1]; |
| 3043 |
} |
| 3044 |
else { |
| 3045 |
$temp = ''; |
| 3046 |
} |
| 3047 |
} |
| 3048 |
$required = ($param['w_required'] == "yes" ? TRUE : FALSE); |
| 3049 |
if ( $required ) { |
| 3050 |
array_push($req_fields, $id1); |
| 3051 |
} |
| 3052 |
$file_upload_check[$id1] = $param['w_extension']; |
| 3053 |
if ( WDFMInstance(self::PLUGIN)->is_demo ) { |
| 3054 |
$onsubmit_js .= 'alert( "You can\'t upload file in demo.");'; |
| 3055 |
} |
| 3056 |
break; |
| 3057 |
} |
| 3058 |
case 'type_captcha': { |
| 3059 |
$params_names = array( 'w_field_label_size', 'w_field_label_pos', 'w_digit', 'w_class' ); |
| 3060 |
$temp = $params; |
| 3061 |
if ( strpos($temp, 'w_hide_label') > -1 ) { |
| 3062 |
$params_names = array( 'w_field_label_size', 'w_field_label_pos', 'w_hide_label', 'w_digit', 'w_class' ); |
| 3063 |
} |
| 3064 |
foreach ( $params_names as $params_name ) { |
| 3065 |
$temp = explode('*:*' . $params_name . '*:*', $temp); |
| 3066 |
$param[$params_name] = $temp[0]; |
| 3067 |
$temp = $temp[1]; |
| 3068 |
} |
| 3069 |
$onload_js .= ' |
| 3070 |
jQuery("#wd_captcha' . $form_id . '").click(function() {captcha_refresh("wd_captcha","' . $form_id . '")});'; |
| 3071 |
$onload_js .= ' |
| 3072 |
jQuery("#_element_refresh' . $form_id . '").click(function() {captcha_refresh("wd_captcha","' . $form_id . '")});'; |
| 3073 |
array_push($req_fields, $id1); |
| 3074 |
$onload_js .= ' |
| 3075 |
captcha_refresh("wd_captcha", "' . $form_id . '");'; |
| 3076 |
break; |
| 3077 |
} |
| 3078 |
case 'type_arithmetic_captcha': { |
| 3079 |
$params_names = array( |
| 3080 |
'w_field_label_size', |
| 3081 |
'w_field_label_pos', |
| 3082 |
'w_count', |
| 3083 |
'w_operations', |
| 3084 |
'w_class', |
| 3085 |
'w_input_size', |
| 3086 |
); |
| 3087 |
$temp = $params; |
| 3088 |
if ( strpos($temp, 'w_hide_label') > -1 ) { |
| 3089 |
$params_names = array( |
| 3090 |
'w_field_label_size', |
| 3091 |
'w_field_label_pos', |
| 3092 |
'w_hide_label', |
| 3093 |
'w_count', |
| 3094 |
'w_operations', |
| 3095 |
'w_class', |
| 3096 |
'w_input_size', |
| 3097 |
); |
| 3098 |
} |
| 3099 |
foreach ( $params_names as $params_name ) { |
| 3100 |
$temp = explode('*:*' . $params_name . '*:*', $temp); |
| 3101 |
$param[$params_name] = $temp[0]; |
| 3102 |
$temp = $temp[1]; |
| 3103 |
} |
| 3104 |
$onload_js .= ' |
| 3105 |
jQuery("#wd_arithmetic_captcha' . $form_id . '").click(function() { captcha_refresh("wd_arithmetic_captcha","' . $form_id . '") });'; |
| 3106 |
$onload_js .= ' |
| 3107 |
jQuery("#_element_refresh' . $form_id . '").click(function() {captcha_refresh("wd_arithmetic_captcha","' . $form_id . '")});'; |
| 3108 |
array_push($req_fields, $id1); |
| 3109 |
$onload_js .= ' |
| 3110 |
captcha_refresh("wd_arithmetic_captcha", "' . $form_id . '");'; |
| 3111 |
break; |
| 3112 |
} |
| 3113 |
case 'type_mark_map': { |
| 3114 |
$params_names = array( |
| 3115 |
'w_field_label_size', |
| 3116 |
'w_field_label_pos', |
| 3117 |
'w_center_x', |
| 3118 |
'w_center_y', |
| 3119 |
'w_long', |
| 3120 |
'w_lat', |
| 3121 |
'w_zoom', |
| 3122 |
'w_width', |
| 3123 |
'w_height', |
| 3124 |
'w_info', |
| 3125 |
'w_class', |
| 3126 |
); |
| 3127 |
$temp = $params; |
| 3128 |
if ( strpos($temp, 'w_hide_label') > -1 ) { |
| 3129 |
$params_names = array( |
| 3130 |
'w_field_label_size', |
| 3131 |
'w_field_label_pos', |
| 3132 |
'w_hide_label', |
| 3133 |
'w_center_x', |
| 3134 |
'w_center_y', |
| 3135 |
'w_long', |
| 3136 |
'w_lat', |
| 3137 |
'w_zoom', |
| 3138 |
'w_width', |
| 3139 |
'w_height', |
| 3140 |
'w_info', |
| 3141 |
'w_class', |
| 3142 |
); |
| 3143 |
} |
| 3144 |
foreach ( $params_names as $params_name ) { |
| 3145 |
$temp = explode('*:*' . $params_name . '*:*', $temp); |
| 3146 |
$param[$params_name] = $temp[0]; |
| 3147 |
$temp = $temp[1]; |
| 3148 |
} |
| 3149 |
$onload_js .= ' |
| 3150 |
if_gmap_init("wdform_' . $id1 . '", ' . $form_id . ');'; |
| 3151 |
$onload_js .= ' |
| 3152 |
add_marker_on_map("wdform_' . $id1 . '", 0, "' . $param['w_long'] . '", "' . $param['w_lat'] . '", "' . str_replace(array( |
| 3153 |
"\r\n", |
| 3154 |
"\n", |
| 3155 |
"\r", |
| 3156 |
), '<br />', $param['w_info']) . '", ' . $form_id . ',true);'; |
| 3157 |
break; |
| 3158 |
} |
| 3159 |
case 'type_map': { |
| 3160 |
$params_names = array( |
| 3161 |
'w_center_x', |
| 3162 |
'w_center_y', |
| 3163 |
'w_long', |
| 3164 |
'w_lat', |
| 3165 |
'w_zoom', |
| 3166 |
'w_width', |
| 3167 |
'w_height', |
| 3168 |
'w_info', |
| 3169 |
'w_class', |
| 3170 |
); |
| 3171 |
$temp = $params; |
| 3172 |
foreach ( $params_names as $params_name ) { |
| 3173 |
$temp = explode('*:*' . $params_name . '*:*', $temp); |
| 3174 |
$param[$params_name] = $temp[0]; |
| 3175 |
$temp = $temp[1]; |
| 3176 |
} |
| 3177 |
$param['w_long'] = explode('***', $param['w_long']); |
| 3178 |
$param['w_lat'] = explode('***', $param['w_lat']); |
| 3179 |
$param['w_info'] = explode('***', $param['w_info']); |
| 3180 |
foreach ( $param['w_long'] as $key => $w_long ) { |
| 3181 |
$onload_js .= ' |
| 3182 |
add_marker_on_map("wdform_' . $id1 . '",' . $key . ', "' . $w_long . '", "' . $param['w_lat'][$key] . '", "' . str_replace(array( |
| 3183 |
"\r\n", |
| 3184 |
"\n", |
| 3185 |
"\r", |
| 3186 |
), '<br />', $param['w_info'][$key]) . '", ' . $form_id . ',false);'; |
| 3187 |
} |
| 3188 |
break; |
| 3189 |
} |
| 3190 |
case 'type_paypal_price': { |
| 3191 |
$params_names = array( |
| 3192 |
'w_field_label_size', |
| 3193 |
'w_field_label_pos', |
| 3194 |
'w_first_val', |
| 3195 |
'w_title', |
| 3196 |
'w_mini_labels', |
| 3197 |
'w_size', |
| 3198 |
'w_required', |
| 3199 |
'w_hide_cents', |
| 3200 |
'w_class', |
| 3201 |
'w_range_min', |
| 3202 |
'w_range_max', |
| 3203 |
); |
| 3204 |
$temp = $params; |
| 3205 |
foreach ( $params_names as $params_name ) { |
| 3206 |
$temp = explode('*:*' . $params_name . '*:*', $temp); |
| 3207 |
$param[$params_name] = $temp[0]; |
| 3208 |
$temp = $temp[1]; |
| 3209 |
} |
| 3210 |
$required = ($param['w_required'] == "yes" ? TRUE : FALSE); |
| 3211 |
$onload_js .= ' |
| 3212 |
jQuery("#wdform_' . $id1 . '_element_cents' . $form_id . '").blur(function() {add_0(this)});'; |
| 3213 |
$onload_js .= ' |
| 3214 |
jQuery("#wdform_' . $id1 . '_element_cents' . $form_id . '").keypress(function(event) {return check_isnum_interval(event,this,0,99)});'; |
| 3215 |
if ( $required ) { |
| 3216 |
$check_js .= ' |
| 3217 |
if(x.find(jQuery("div[wdid=' . $id1 . ']")).length != 0 && x.find(jQuery("div[wdid=' . $id1 . ']")).css("display") != "none") { |
| 3218 |
if(jQuery("#wdform_' . $id1 . '_element_dollars' . $form_id . '").val() == "' . $w_title[0] . '" || jQuery("#wdform_' . $id1 . '_element_dollars' . $form_id . '").val() == "") { |
| 3219 |
alert("' . addslashes($label . ' ' . __('field is required.', WDFMInstance(self::PLUGIN)->prefix)) . '"); |
| 3220 |
old_bg=x.find(jQuery("div[wdid=' . $id1 . ']")).css("background-color"); |
| 3221 |
x.find(jQuery("div[wdid=' . $id1 . ']")).effect( "shake", {}, 500 ).css("background-color","#FF8F8B").animate({backgroundColor: old_bg}, {duration: 500, queue: false }); |
| 3222 |
jQuery("#wdform_' . $id1 . '_element_dollars' . $form_id . '").focus(); |
| 3223 |
return false; |
| 3224 |
} |
| 3225 |
}'; |
| 3226 |
} |
| 3227 |
$check_js .= ' |
| 3228 |
if(x.find(jQuery("div[wdid=' . $id1 . ']")).length != 0 && x.find(jQuery("div[wdid=' . $id1 . ']")).css("display") != "none") { |
| 3229 |
dollars=0; |
| 3230 |
cents=0; |
| 3231 |
if(jQuery("#wdform_' . $id1 . '_element_dollars' . $form_id . '").val() != "' . $w_title[0] . '" || jQuery("#wdform_' . $id1 . '_element_dollars' . $form_id . '").val()) { |
| 3232 |
dollars =jQuery("#wdform_' . $id1 . '_element_dollars' . $form_id . '").val(); |
| 3233 |
} |
| 3234 |
if(jQuery("#wdform_' . $id1 . '_element_cents' . $form_id . '").val() != "' . $w_title[1] . '" || jQuery("#wdform_' . $id1 . '_element_cents' . $form_id . '").val()) { |
| 3235 |
cents =jQuery("#wdform_' . $id1 . '_element_cents' . $form_id . '").val(); |
| 3236 |
} |
| 3237 |
var price=dollars+"."+cents; |
| 3238 |
if(isNaN(price)) { |
| 3239 |
alert("Invalid value of number field"); |
| 3240 |
old_bg=x.find(jQuery("div[wdid=' . $id1 . ']")).css("background-color"); |
| 3241 |
x.find(jQuery("div[wdid=' . $id1 . ']")).effect( "shake", {}, 500 ).css("background-color","#FF8F8B").animate({backgroundColor: old_bg}, {duration: 500, queue: false }); |
| 3242 |
jQuery("#wdform_' . $id1 . '_element_dollars' . $form_id . '").focus(); |
| 3243 |
return false; |
| 3244 |
} |
| 3245 |
var range_min=' . ($param['w_range_min'] ? $param['w_range_min'] : 0) . '; |
| 3246 |
var range_max=' . ($param['w_range_max'] ? $param['w_range_max'] : -1) . '; |
| 3247 |
if(' . ($required ? 'true' : 'false') . ' || jQuery("#wdform_' . $id1 . '_element_dollars' . $form_id . '").val() != "' . $w_title[0] . '" || jQuery("#wdform_' . $id1 . '_element_cents' . $form_id . '").val() != "' . $w_title[1] . '") { |
| 3248 |
if((range_max!=-1 && parseFloat(price)>range_max) || parseFloat(price)<range_min) { |
| 3249 |
alert("' . addslashes((__('The', WDFMInstance(self::PLUGIN)->prefix)) . $label . (__('value must be between', WDFMInstance(self::PLUGIN)->prefix)) . ($param['w_range_min'] ? $param['w_range_min'] : 0) . '-' . ($param['w_range_max'] ? $param['w_range_max'] : "any")) . '"); |
| 3250 |
old_bg=x.find(jQuery("div[wdid=' . $id1 . ']")).css("background-color"); |
| 3251 |
x.find(jQuery("div[wdid=' . $id1 . ']")).effect( "shake", {}, 500 ).css("background-color","#FF8F8B").animate({backgroundColor: old_bg}, {duration: 500, queue: false }); |
| 3252 |
jQuery("#wdform_' . $id1 . '_element_dollars' . $form_id . '").focus(); |
| 3253 |
return false; |
| 3254 |
} |
| 3255 |
} |
| 3256 |
}'; |
| 3257 |
break; |
| 3258 |
} |
| 3259 |
case 'type_paypal_price_new': { |
| 3260 |
$params_names = array( |
| 3261 |
'w_field_label_size', |
| 3262 |
'w_field_label_pos', |
| 3263 |
'w_first_val', |
| 3264 |
'w_title', |
| 3265 |
'w_size', |
| 3266 |
'w_required', |
| 3267 |
'w_class', |
| 3268 |
'w_range_min', |
| 3269 |
'w_range_max', |
| 3270 |
'w_readonly', |
| 3271 |
'w_currency', |
| 3272 |
); |
| 3273 |
$temp = $params; |
| 3274 |
if ( strpos($temp, 'w_hide_label') > -1 ) { |
| 3275 |
$params_names = array( |
| 3276 |
'w_field_label_size', |
| 3277 |
'w_field_label_pos', |
| 3278 |
'w_hide_label', |
| 3279 |
'w_first_val', |
| 3280 |
'w_title', |
| 3281 |
'w_size', |
| 3282 |
'w_required', |
| 3283 |
'w_class', |
| 3284 |
'w_range_min', |
| 3285 |
'w_range_max', |
| 3286 |
'w_readonly', |
| 3287 |
'w_currency', |
| 3288 |
); |
| 3289 |
} |
| 3290 |
foreach ( $params_names as $params_name ) { |
| 3291 |
$temp = explode('*:*' . $params_name . '*:*', $temp); |
| 3292 |
$param[$params_name] = $temp[0]; |
| 3293 |
$temp = $temp[1]; |
| 3294 |
} |
| 3295 |
$required = ($param['w_required'] == "yes" ? TRUE : FALSE); |
| 3296 |
if ( $required ) { |
| 3297 |
array_push($req_fields, $id1); |
| 3298 |
} |
| 3299 |
$check_paypal_price_min_max[$id1] = array( |
| 3300 |
$label, |
| 3301 |
$param['w_title'], |
| 3302 |
$required, |
| 3303 |
$param['w_range_min'], |
| 3304 |
$param['w_range_max'], |
| 3305 |
); |
| 3306 |
break; |
| 3307 |
} |
| 3308 |
case 'type_paypal_select': { |
| 3309 |
$params_names = array( |
| 3310 |
'w_field_label_size', |
| 3311 |
'w_field_label_pos', |
| 3312 |
'w_size', |
| 3313 |
'w_choices', |
| 3314 |
'w_choices_price', |
| 3315 |
'w_choices_checked', |
| 3316 |
'w_choices_disabled', |
| 3317 |
'w_required', |
| 3318 |
'w_quantity', |
| 3319 |
'w_quantity_value', |
| 3320 |
'w_class', |
| 3321 |
'w_property', |
| 3322 |
'w_property_values', |
| 3323 |
); |
| 3324 |
$temp = $params; |
| 3325 |
if ( strpos($temp, 'w_choices_params') > -1 ) { |
| 3326 |
$params_names = array( |
| 3327 |
'w_field_label_size', |
| 3328 |
'w_field_label_pos', |
| 3329 |
'w_size', |
| 3330 |
'w_choices', |
| 3331 |
'w_choices_price', |
| 3332 |
'w_choices_checked', |
| 3333 |
'w_choices_disabled', |
| 3334 |
'w_required', |
| 3335 |
'w_quantity', |
| 3336 |
'w_quantity_value', |
| 3337 |
'w_choices_params', |
| 3338 |
'w_class', |
| 3339 |
'w_property', |
| 3340 |
'w_property_values', |
| 3341 |
); |
| 3342 |
} |
| 3343 |
if ( strpos($temp, 'w_hide_label') > -1 ) { |
| 3344 |
$params_names = array( |
| 3345 |
'w_field_label_size', |
| 3346 |
'w_field_label_pos', |
| 3347 |
'w_hide_label', |
| 3348 |
'w_size', |
| 3349 |
'w_choices', |
| 3350 |
'w_choices_price', |
| 3351 |
'w_choices_checked', |
| 3352 |
'w_choices_disabled', |
| 3353 |
'w_required', |
| 3354 |
'w_quantity', |
| 3355 |
'w_quantity_value', |
| 3356 |
'w_choices_params', |
| 3357 |
'w_class', |
| 3358 |
'w_property', |
| 3359 |
'w_property_values', |
| 3360 |
); |
| 3361 |
} |
| 3362 |
foreach ( $params_names as $params_name ) { |
| 3363 |
$temp = explode('*:*' . $params_name . '*:*', $temp); |
| 3364 |
$param[$params_name] = $temp[0]; |
| 3365 |
$temp = $temp[1]; |
| 3366 |
} |
| 3367 |
|
| 3368 |
if ( isset($param['w_choices_params']) ) { |
| 3369 |
$w_choices_params = explode('***', $param['w_choices_params']); |
| 3370 |
foreach ( $w_choices_params as $choices ) { |
| 3371 |
if ( !empty($choices) ) { |
| 3372 |
preg_match_all('/{\d+}/', $choices, $matches); |
| 3373 |
if ( !empty($matches[0][0]) ) { |
| 3374 |
$inputIds[$id_type][] = str_replace( array('{','}'), array('',''), $matches[0][0] ); |
| 3375 |
} |
| 3376 |
} |
| 3377 |
} |
| 3378 |
} |
| 3379 |
|
| 3380 |
$required = ($param['w_required'] == "yes" ? TRUE : FALSE); |
| 3381 |
$param['w_property'] = explode('***', $param['w_property']); |
| 3382 |
if ( $required ) { |
| 3383 |
array_push($req_fields, $id1); |
| 3384 |
} |
| 3385 |
$onsubmit_js .= 'jQuery("<input type=\"hidden\" name=\"wdform_' . $id1 . '_element_label' . $form_id . '\" />").val(jQuery("#wdform_' . $id1 . '_element' . $form_id . ' option:selected").text()).appendTo("#form' . $form_id . '");'; |
| 3386 |
$onsubmit_js .= 'jQuery("<input type=\"hidden\" name=\"wdform_' . $id1 . '_element_quantity_label' . $form_id . '\" />").val("' . (__("Quantity", WDFMInstance(self::PLUGIN)->prefix)) . '").appendTo("#form' . $form_id . '");'; |
| 3387 |
foreach ( $param['w_property'] as $key => $property ) { |
| 3388 |
$onsubmit_js .= 'jQuery("<input type=\"hidden\" name=\"wdform_' . $id1 . '_element_property_label' . $form_id . $key . '\" />").val("' . $property . '").appendTo("#form' . $form_id . '");'; |
| 3389 |
} |
| 3390 |
break; |
| 3391 |
} |
| 3392 |
case 'type_paypal_checkbox': { |
| 3393 |
$params_names = array( |
| 3394 |
'w_field_label_size', |
| 3395 |
'w_field_label_pos', |
| 3396 |
'w_flow', |
| 3397 |
'w_choices', |
| 3398 |
'w_choices_price', |
| 3399 |
'w_choices_checked', |
| 3400 |
'w_required', |
| 3401 |
'w_randomize', |
| 3402 |
'w_allow_other', |
| 3403 |
'w_allow_other_num', |
| 3404 |
'w_class', |
| 3405 |
'w_property', |
| 3406 |
'w_property_values', |
| 3407 |
'w_quantity', |
| 3408 |
'w_quantity_value', |
| 3409 |
); |
| 3410 |
$temp = $params; |
| 3411 |
if ( strpos($temp, 'w_field_option_pos') > -1 ) { |
| 3412 |
$params_names = array( |
| 3413 |
'w_field_label_size', |
| 3414 |
'w_field_label_pos', |
| 3415 |
'w_field_option_pos', |
| 3416 |
'w_flow', |
| 3417 |
'w_choices', |
| 3418 |
'w_choices_price', |
| 3419 |
'w_choices_checked', |
| 3420 |
'w_required', |
| 3421 |
'w_randomize', |
| 3422 |
'w_allow_other', |
| 3423 |
'w_allow_other_num', |
| 3424 |
'w_choices_params', |
| 3425 |
'w_class', |
| 3426 |
'w_property', |
| 3427 |
'w_property_values', |
| 3428 |
'w_quantity', |
| 3429 |
'w_quantity_value', |
| 3430 |
); |
| 3431 |
} |
| 3432 |
if ( strpos($temp, 'w_hide_label') > -1 ) { |
| 3433 |
$params_names = array( |
| 3434 |
'w_field_label_size', |
| 3435 |
'w_field_label_pos', |
| 3436 |
'w_field_option_pos', |
| 3437 |
'w_hide_label', |
| 3438 |
'w_flow', |
| 3439 |
'w_choices', |
| 3440 |
'w_choices_price', |
| 3441 |
'w_choices_checked', |
| 3442 |
'w_required', |
| 3443 |
'w_randomize', |
| 3444 |
'w_allow_other', |
| 3445 |
'w_allow_other_num', |
| 3446 |
'w_choices_params', |
| 3447 |
'w_class', |
| 3448 |
'w_property', |
| 3449 |
'w_property_values', |
| 3450 |
'w_quantity', |
| 3451 |
'w_quantity_value', |
| 3452 |
); |
| 3453 |
} |
| 3454 |
foreach ( $params_names as $params_name ) { |
| 3455 |
$temp = explode('*:*' . $params_name . '*:*', $temp); |
| 3456 |
$param[$params_name] = $temp[0]; |
| 3457 |
$temp = $temp[1]; |
| 3458 |
} |
| 3459 |
|
| 3460 |
$required = ($param['w_required'] == "yes" ? TRUE : FALSE); |
| 3461 |
$param['w_property'] = explode('***', $param['w_property']); |
| 3462 |
if ( $required ) { |
| 3463 |
array_push($req_fields, $id1); |
| 3464 |
} |
| 3465 |
$onsubmit_js .= 'jQuery("<input type=\"hidden\" name=\"wdform_' . $id1 . '_element_label' . $form_id . '\" />").val((jQuery("#wdform_' . $id1 . '_element' . $form_id . ' input:checked").length != 0) ? jQuery("#wdform_' . $id1 . '_element' . $form_id . ' input:checked").attr("id").replace("element", "elementlabel_") : "").appendTo("#form' . $form_id . '");'; |
| 3466 |
$onsubmit_js .= 'jQuery("<input type=\"hidden\" name=\"wdform_' . $id1 . '_element_quantity_label' . $form_id . '\" />").val("' . (__("Quantity", WDFMInstance(self::PLUGIN)->prefix)) . '").appendTo("#form' . $form_id . '");'; |
| 3467 |
foreach ( $param['w_property'] as $key => $property ) { |
| 3468 |
$onsubmit_js .= 'jQuery("<input type=\"hidden\" name=\"wdform_' . $id1 . '_element_property_label' . $form_id . $key . '\" />").val("' . $property . '").appendTo("#form' . $form_id . '");'; |
| 3469 |
} |
| 3470 |
break; |
| 3471 |
} |
| 3472 |
case 'type_paypal_radio': { |
| 3473 |
$params_names = array( |
| 3474 |
'w_field_label_size', |
| 3475 |
'w_field_label_pos', |
| 3476 |
'w_flow', |
| 3477 |
'w_choices', |
| 3478 |
'w_choices_price', |
| 3479 |
'w_choices_checked', |
| 3480 |
'w_required', |
| 3481 |
'w_randomize', |
| 3482 |
'w_allow_other', |
| 3483 |
'w_allow_other_num', |
| 3484 |
'w_class', |
| 3485 |
'w_property', |
| 3486 |
'w_property_values', |
| 3487 |
'w_quantity', |
| 3488 |
'w_quantity_value', |
| 3489 |
); |
| 3490 |
$temp = $params; |
| 3491 |
if ( strpos($temp, 'w_field_option_pos') > -1 ) { |
| 3492 |
$params_names = array( |
| 3493 |
'w_field_label_size', |
| 3494 |
'w_field_label_pos', |
| 3495 |
'w_field_option_pos', |
| 3496 |
'w_flow', |
| 3497 |
'w_choices', |
| 3498 |
'w_choices_price', |
| 3499 |
'w_choices_checked', |
| 3500 |
'w_required', |
| 3501 |
'w_randomize', |
| 3502 |
'w_allow_other', |
| 3503 |
'w_allow_other_num', |
| 3504 |
'w_choices_params', |
| 3505 |
'w_class', |
| 3506 |
'w_property', |
| 3507 |
'w_property_values', |
| 3508 |
'w_quantity', |
| 3509 |
'w_quantity_value', |
| 3510 |
); |
| 3511 |
} |
| 3512 |
if ( strpos($temp, 'w_hide_label') > -1 ) { |
| 3513 |
$params_names = array( |
| 3514 |
'w_field_label_size', |
| 3515 |
'w_field_label_pos', |
| 3516 |
'w_field_option_pos', |
| 3517 |
'w_hide_label', |
| 3518 |
'w_flow', |
| 3519 |
'w_choices', |
| 3520 |
'w_choices_price', |
| 3521 |
'w_choices_checked', |
| 3522 |
'w_required', |
| 3523 |
'w_randomize', |
| 3524 |
'w_allow_other', |
| 3525 |
'w_allow_other_num', |
| 3526 |
'w_choices_params', |
| 3527 |
'w_class', |
| 3528 |
'w_property', |
| 3529 |
'w_property_values', |
| 3530 |
'w_quantity', |
| 3531 |
'w_quantity_value', |
| 3532 |
); |
| 3533 |
} |
| 3534 |
foreach ( $params_names as $params_name ) { |
| 3535 |
$temp = explode('*:*' . $params_name . '*:*', $temp); |
| 3536 |
$param[$params_name] = $temp[0]; |
| 3537 |
$temp = $temp[1]; |
| 3538 |
} |
| 3539 |
$required = ($param['w_required'] == "yes" ? TRUE : FALSE); |
| 3540 |
$param['w_property'] = explode('***', $param['w_property']); |
| 3541 |
if ( $required ) { |
| 3542 |
array_push($req_fields, $id1); |
| 3543 |
} |
| 3544 |
$onsubmit_js .= 'jQuery("<input type=\"hidden\" name=\"wdform_' . $id1 . '_element_label' . $form_id . '\" />").val(jQuery("label[for=\'"+jQuery("input[name^=\'wdform_' . $id1 . '_element' . $form_id . '\']:checked").attr("id")+"\']").eq(0).text()).appendTo("#form' . $form_id . '");'; |
| 3545 |
$onsubmit_js .= 'jQuery("<input type=\"hidden\" name=\"wdform_' . $id1 . '_element_quantity_label' . $form_id . '\" />").val("' . (__("Quantity", WDFMInstance(self::PLUGIN)->prefix)) . '").appendTo("#form' . $form_id . '");'; |
| 3546 |
foreach ( $param['w_property'] as $key => $property ) { |
| 3547 |
$onsubmit_js .= 'jQuery("<input type=\"hidden\" name=\"wdform_' . $id1 . '_element_property_label' . $form_id . $key . '\" />").val("' . $property . '").appendTo("#form' . $form_id . '");'; |
| 3548 |
} |
| 3549 |
break; |
| 3550 |
} |
| 3551 |
case 'type_paypal_shipping': { |
| 3552 |
$params_names = array( |
| 3553 |
'w_field_label_size', |
| 3554 |
'w_field_label_pos', |
| 3555 |
'w_flow', |
| 3556 |
'w_choices', |
| 3557 |
'w_choices_price', |
| 3558 |
'w_choices_checked', |
| 3559 |
'w_required', |
| 3560 |
'w_randomize', |
| 3561 |
'w_allow_other', |
| 3562 |
'w_allow_other_num', |
| 3563 |
'w_class', |
| 3564 |
); |
| 3565 |
$temp = $params; |
| 3566 |
if ( strpos($temp, 'w_field_option_pos') > -1 ) { |
| 3567 |
$params_names = array( |
| 3568 |
'w_field_label_size', |
| 3569 |
'w_field_label_pos', |
| 3570 |
'w_field_option_pos', |
| 3571 |
'w_flow', |
| 3572 |
'w_choices', |
| 3573 |
'w_choices_price', |
| 3574 |
'w_choices_checked', |
| 3575 |
'w_required', |
| 3576 |
'w_randomize', |
| 3577 |
'w_allow_other', |
| 3578 |
'w_allow_other_num', |
| 3579 |
'w_choices_params', |
| 3580 |
'w_class', |
| 3581 |
); |
| 3582 |
} |
| 3583 |
if ( strpos($temp, 'w_hide_label') > -1 ) { |
| 3584 |
$params_names = array( |
| 3585 |
'w_field_label_size', |
| 3586 |
'w_field_label_pos', |
| 3587 |
'w_field_option_pos', |
| 3588 |
'w_hide_label', |
| 3589 |
'w_flow', |
| 3590 |
'w_choices', |
| 3591 |
'w_choices_price', |
| 3592 |
'w_choices_checked', |
| 3593 |
'w_required', |
| 3594 |
'w_randomize', |
| 3595 |
'w_allow_other', |
| 3596 |
'w_allow_other_num', |
| 3597 |
'w_choices_params', |
| 3598 |
'w_class', |
| 3599 |
); |
| 3600 |
} |
| 3601 |
foreach ( $params_names as $params_name ) { |
| 3602 |
$temp = explode('*:*' . $params_name . '*:*', $temp); |
| 3603 |
$param[$params_name] = $temp[0]; |
| 3604 |
$temp = $temp[1]; |
| 3605 |
} |
| 3606 |
$required = ($param['w_required'] == "yes" ? TRUE : FALSE); |
| 3607 |
if ( $required ) { |
| 3608 |
array_push($req_fields, $id1); |
| 3609 |
} |
| 3610 |
$onsubmit_js .= ' |
| 3611 |
jQuery("<input type=\"hidden\" name=\"wdform_' . $id1 . '_element_label' . $form_id . '\" />").val(jQuery("label[for=\'"+jQuery("input[name^=\'wdform_' . $id1 . '_element' . $form_id . '\']:checked").attr("id")+"\']").eq(0).text()).appendTo("#form' . $form_id . '");'; |
| 3612 |
break; |
| 3613 |
} |
| 3614 |
case 'type_star_rating': { |
| 3615 |
$params_names = array( |
| 3616 |
'w_field_label_size', |
| 3617 |
'w_field_label_pos', |
| 3618 |
'w_field_label_col', |
| 3619 |
'w_star_amount', |
| 3620 |
'w_required', |
| 3621 |
'w_class', |
| 3622 |
); |
| 3623 |
$temp = $params; |
| 3624 |
if ( strpos($temp, 'w_hide_label') > -1 ) { |
| 3625 |
$params_names = array( |
| 3626 |
'w_field_label_size', |
| 3627 |
'w_field_label_pos', |
| 3628 |
'w_hide_label', |
| 3629 |
'w_field_label_col', |
| 3630 |
'w_star_amount', |
| 3631 |
'w_required', |
| 3632 |
'w_class', |
| 3633 |
); |
| 3634 |
} |
| 3635 |
foreach ( $params_names as $params_name ) { |
| 3636 |
$temp = explode('*:*' . $params_name . '*:*', $temp); |
| 3637 |
$param[$params_name] = $temp[0]; |
| 3638 |
$temp = $temp[1]; |
| 3639 |
} |
| 3640 |
$required = ($param['w_required'] == "yes" ? TRUE : FALSE); |
| 3641 |
for ( $i = 0; $i < $param['w_star_amount']; $i++ ) { |
| 3642 |
$onload_js .= ' |
| 3643 |
jQuery("#wdform_' . $id1 . '_star_' . $i . '_' . $form_id . '").mouseover(function() {change_src(' . $i . ',"wdform_' . $id1 . '", ' . $form_id . ', "' . $param['w_field_label_col'] . '");});'; |
| 3644 |
$onload_js .= ' |
| 3645 |
jQuery("#wdform_' . $id1 . '_star_' . $i . '_' . $form_id . '").mouseout(function() {reset_src(' . $i . ',"wdform_' . $id1 . '", ' . $form_id . ');});'; |
| 3646 |
$onload_js .= ' |
| 3647 |
jQuery("#wdform_' . $id1 . '_star_' . $i . '_' . $form_id . '").click(function() {select_star_rating(' . $i . ',"wdform_' . $id1 . '", ' . $form_id . ',"' . $param['w_field_label_col'] . '", "' . $param['w_star_amount'] . '");});'; |
| 3648 |
} |
| 3649 |
if ( $required ) { |
| 3650 |
array_push($req_fields, $id1); |
| 3651 |
} |
| 3652 |
$post = isset($_POST['wdform_' . $id1 . '_selected_star_amount' . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . '_selected_star_amount' . $form_id])) : NULL; |
| 3653 |
if ( isset($post) ) { |
| 3654 |
$onload_js .= ' |
| 3655 |
select_star_rating(' . ($post - 1) . ',"wdform_' . $id1 . '", ' . $form_id . ',"' . $param['w_field_label_col'] . '", "' . $param['w_star_amount'] . '");'; |
| 3656 |
} |
| 3657 |
$onsubmit_js .= ' |
| 3658 |
jQuery("<input type=\"hidden\" name=\"wdform_' . $id1 . '_star_amount' . $form_id . '\" value=\"' . $param['w_star_amount'] . '\" />").appendTo("#form' . $form_id . '");'; |
| 3659 |
break; |
| 3660 |
} |
| 3661 |
case 'type_scale_rating': { |
| 3662 |
$params_names = array( |
| 3663 |
'w_field_label_size', |
| 3664 |
'w_field_label_pos', |
| 3665 |
'w_mini_labels', |
| 3666 |
'w_scale_amount', |
| 3667 |
'w_required', |
| 3668 |
'w_class', |
| 3669 |
); |
| 3670 |
$temp = $params; |
| 3671 |
if ( strpos($temp, 'w_hide_label') > -1 ) { |
| 3672 |
$params_names = array( |
| 3673 |
'w_field_label_size', |
| 3674 |
'w_field_label_pos', |
| 3675 |
'w_hide_label', |
| 3676 |
'w_mini_labels', |
| 3677 |
'w_scale_amount', |
| 3678 |
'w_required', |
| 3679 |
'w_class', |
| 3680 |
); |
| 3681 |
} |
| 3682 |
foreach ( $params_names as $params_name ) { |
| 3683 |
$temp = explode('*:*' . $params_name . '*:*', $temp); |
| 3684 |
$param[$params_name] = $temp[0]; |
| 3685 |
$temp = $temp[1]; |
| 3686 |
} |
| 3687 |
$required = ($param['w_required'] == "yes" ? TRUE : FALSE); |
| 3688 |
if ( $required ) { |
| 3689 |
array_push($req_fields, $id1); |
| 3690 |
} |
| 3691 |
$onsubmit_js .= ' |
| 3692 |
jQuery("<input type=\"hidden\" name=\"wdform_' . $id1 . '_scale_amount' . $form_id . '\" value=\"' . $param['w_scale_amount'] . '\" />").appendTo("#form' . $form_id . '");'; |
| 3693 |
break; |
| 3694 |
} |
| 3695 |
case 'type_spinner': { |
| 3696 |
$params_names = array( |
| 3697 |
'w_field_label_size', |
| 3698 |
'w_field_label_pos', |
| 3699 |
'w_field_width', |
| 3700 |
'w_field_min_value', |
| 3701 |
'w_field_max_value', |
| 3702 |
'w_field_step', |
| 3703 |
'w_field_value', |
| 3704 |
'w_required', |
| 3705 |
'w_class', |
| 3706 |
); |
| 3707 |
$temp = $params; |
| 3708 |
if ( strpos($temp, 'w_hide_label') > -1 ) { |
| 3709 |
$params_names = array( |
| 3710 |
'w_field_label_size', |
| 3711 |
'w_field_label_pos', |
| 3712 |
'w_hide_label', |
| 3713 |
'w_field_width', |
| 3714 |
'w_field_min_value', |
| 3715 |
'w_field_max_value', |
| 3716 |
'w_field_step', |
| 3717 |
'w_field_value', |
| 3718 |
'w_required', |
| 3719 |
'w_class', |
| 3720 |
); |
| 3721 |
} |
| 3722 |
foreach ( $params_names as $params_name ) { |
| 3723 |
$temp = explode('*:*' . $params_name . '*:*', $temp); |
| 3724 |
$param[$params_name] = $temp[0]; |
| 3725 |
$temp = $temp[1]; |
| 3726 |
} |
| 3727 |
$required = ($param['w_required'] == "yes" ? TRUE : FALSE); |
| 3728 |
$onload_js .= ' |
| 3729 |
jQuery("#form' . $form_id . ' #wdform_' . $id1 . '_element' . $form_id . '")[0].spin = null; |
| 3730 |
spinner = jQuery("#form' . $form_id . ' #wdform_' . $id1 . '_element' . $form_id . '").spinner(); |
| 3731 |
if ("' . $param['w_field_value'] . '" == "null" && jQuery("#form' . $form_id . ' #wdform_' . $id1 . '_element' . $form_id . '").val() == "") { spinner.spinner("value", ""); } |
| 3732 |
jQuery("#form' . $form_id . ' #wdform_' . $id1 . '_element' . $form_id . '").spinner({ min: "' . $param['w_field_min_value'] . '"}); |
| 3733 |
jQuery("#form' . $form_id . ' #wdform_' . $id1 . '_element' . $form_id . '").spinner({ max: "' . $param['w_field_max_value'] . '"}); |
| 3734 |
jQuery("#form' . $form_id . ' #wdform_' . $id1 . '_element' . $form_id . '").spinner({ step: "' . $param['w_field_step'] . '"});'; |
| 3735 |
if ( $required ) { |
| 3736 |
array_push($req_fields, $id1); |
| 3737 |
} |
| 3738 |
$spinner_check[$id1] = array( $param['w_field_min_value'], $param['w_field_max_value'] ); |
| 3739 |
break; |
| 3740 |
} |
| 3741 |
case 'type_slider': { |
| 3742 |
$params_names = array( |
| 3743 |
'w_field_label_size', |
| 3744 |
'w_field_label_pos', |
| 3745 |
'w_field_width', |
| 3746 |
'w_field_min_value', |
| 3747 |
'w_field_max_value', |
| 3748 |
'w_field_value', |
| 3749 |
'w_required', |
| 3750 |
'w_class', |
| 3751 |
); |
| 3752 |
$temp = $params; |
| 3753 |
if ( strpos($temp, 'w_hide_label') > -1 ) { |
| 3754 |
$params_names = array( |
| 3755 |
'w_field_label_size', |
| 3756 |
'w_field_label_pos', |
| 3757 |
'w_hide_label', |
| 3758 |
'w_field_width', |
| 3759 |
'w_field_min_value', |
| 3760 |
'w_field_max_value', |
| 3761 |
'w_field_value', |
| 3762 |
'w_required', |
| 3763 |
'w_class', |
| 3764 |
); |
| 3765 |
} |
| 3766 |
if ( strpos($temp, 'w_field_step') > -1 ) { |
| 3767 |
$params_names = array( |
| 3768 |
'w_field_label_size', |
| 3769 |
'w_field_label_pos', |
| 3770 |
'w_hide_label', |
| 3771 |
'w_field_width', |
| 3772 |
'w_field_min_value', |
| 3773 |
'w_field_max_value', |
| 3774 |
'w_field_step', |
| 3775 |
'w_field_value', |
| 3776 |
'w_required', |
| 3777 |
'w_class', |
| 3778 |
); |
| 3779 |
} |
| 3780 |
foreach ( $params_names as $params_name ) { |
| 3781 |
$temp = explode('*:*' . $params_name . '*:*', $temp); |
| 3782 |
$param[$params_name] = $temp[0]; |
| 3783 |
$temp = $temp[1]; |
| 3784 |
} |
| 3785 |
$required = ($param['w_required'] == "yes" ? TRUE : FALSE); |
| 3786 |
$onload_js .= ' |
| 3787 |
jQuery("#wdform_' . $id1 . '_element' . $form_id . '")[0].slide = null; |
| 3788 |
jQuery("#wdform_' . $id1 . '_element' . $form_id . '").slider({ |
| 3789 |
step: parseInt(' . $param['w_field_step'] . '), |
| 3790 |
range: "min", |
| 3791 |
value: eval(' . $param['w_field_value'] . '), |
| 3792 |
min: eval(' . $param['w_field_min_value'] . '), |
| 3793 |
max: eval(' . $param['w_field_max_value'] . '), |
| 3794 |
slide: function( event, ui ) { |
| 3795 |
jQuery("#wdform_' . $id1 . '_element_value' . $form_id . '").html("" + ui.value); |
| 3796 |
jQuery("#wdform_' . $id1 . '_slider_value' . $form_id . '").val("" + ui.value); |
| 3797 |
} |
| 3798 |
});'; |
| 3799 |
if ( $required ) { |
| 3800 |
array_push($req_fields, $id1); |
| 3801 |
} |
| 3802 |
break; |
| 3803 |
} |
| 3804 |
case 'type_range': { |
| 3805 |
$params_names = array( |
| 3806 |
'w_field_label_size', |
| 3807 |
'w_field_label_pos', |
| 3808 |
'w_field_range_width', |
| 3809 |
'w_field_range_step', |
| 3810 |
'w_field_value1', |
| 3811 |
'w_field_value2', |
| 3812 |
'w_mini_labels', |
| 3813 |
'w_required', |
| 3814 |
'w_class', |
| 3815 |
); |
| 3816 |
$temp = $params; |
| 3817 |
if ( strpos($temp, 'w_hide_label') > -1 ) { |
| 3818 |
$params_names = array( |
| 3819 |
'w_field_label_size', |
| 3820 |
'w_field_label_pos', |
| 3821 |
'w_hide_label', |
| 3822 |
'w_field_range_width', |
| 3823 |
'w_field_range_step', |
| 3824 |
'w_field_value1', |
| 3825 |
'w_field_value2', |
| 3826 |
'w_mini_labels', |
| 3827 |
'w_required', |
| 3828 |
'w_class', |
| 3829 |
); |
| 3830 |
} |
| 3831 |
foreach ( $params_names as $params_name ) { |
| 3832 |
$temp = explode('*:*' . $params_name . '*:*', $temp); |
| 3833 |
$param[$params_name] = $temp[0]; |
| 3834 |
$temp = $temp[1]; |
| 3835 |
} |
| 3836 |
$required = ($param['w_required'] == "yes" ? TRUE : FALSE); |
| 3837 |
$onload_js .= ' |
| 3838 |
jQuery("#form' . $form_id . ' #wdform_' . $id1 . '_element' . $form_id . '0")[0].spin = null; |
| 3839 |
jQuery("#form' . $form_id . ' #wdform_' . $id1 . '_element' . $form_id . '1")[0].spin = null; |
| 3840 |
spinner0 = jQuery("#form' . $form_id . ' #wdform_' . $id1 . '_element' . $form_id . '0").spinner(); |
| 3841 |
if ("' . $param['w_field_value1'] . '" == "null" && jQuery("#form' . $form_id . ' #wdform_' . $id1 . '_element' . $form_id . '0").val() == "") { spinner0.spinner("value", ""); } |
| 3842 |
jQuery("#form' . $form_id . ' #wdform_' . $id1 . '_element' . $form_id . '").spinner({ step: ' . $param['w_field_range_step'] . '}); |
| 3843 |
spinner1 = jQuery("#form' . $form_id . ' #wdform_' . $id1 . '_element' . $form_id . '1").spinner(); |
| 3844 |
if ("' . $param['w_field_value2'] . '" == "null" && jQuery("#form' . $form_id . ' #wdform_' . $id1 . '_element' . $form_id . '1").val() == "") { spinner1.spinner("value", ""); } |
| 3845 |
jQuery("#form' . $form_id . ' #wdform_' . $id1 . '_element' . $form_id . '").spinner({ step: ' . $param['w_field_range_step'] . '});'; |
| 3846 |
if ( $required ) { |
| 3847 |
array_push($req_fields, $id1); |
| 3848 |
} |
| 3849 |
break; |
| 3850 |
} |
| 3851 |
case 'type_grading': { |
| 3852 |
$params_names = array( |
| 3853 |
'w_field_label_size', |
| 3854 |
'w_field_label_pos', |
| 3855 |
'w_items', |
| 3856 |
'w_total', |
| 3857 |
'w_required', |
| 3858 |
'w_class', |
| 3859 |
); |
| 3860 |
$temp = $params; |
| 3861 |
if ( strpos($temp, 'w_hide_label') > -1 ) { |
| 3862 |
$params_names = array( |
| 3863 |
'w_field_label_size', |
| 3864 |
'w_field_label_pos', |
| 3865 |
'w_hide_label', |
| 3866 |
'w_items', |
| 3867 |
'w_total', |
| 3868 |
'w_required', |
| 3869 |
'w_class', |
| 3870 |
); |
| 3871 |
} |
| 3872 |
foreach ( $params_names as $params_name ) { |
| 3873 |
$temp = explode('*:*' . $params_name . '*:*', $temp); |
| 3874 |
$param[$params_name] = $temp[0]; |
| 3875 |
$temp = $temp[1]; |
| 3876 |
} |
| 3877 |
$required = ($param['w_required'] == "yes" ? TRUE : FALSE); |
| 3878 |
$w_items = explode('***', $param['w_items']); |
| 3879 |
$w_items_labels = implode(':', $w_items); |
| 3880 |
$onload_js .= ' |
| 3881 |
jQuery("#wdform_' . $id1 . '_element' . $form_id . ' input").change(function() {sum_grading_values("wdform_' . $id1 . '",' . $form_id . ');});'; |
| 3882 |
$onload_js .= ' |
| 3883 |
jQuery("#wdform_' . $id1 . '_element' . $form_id . ' input").keyup(function() {sum_grading_values("wdform_' . $id1 . '",' . $form_id . ');});'; |
| 3884 |
$onload_js .= ' |
| 3885 |
jQuery("#wdform_' . $id1 . '_element' . $form_id . ' input").keyup(function() {sum_grading_values("wdform_' . $id1 . '",' . $form_id . ');});'; |
| 3886 |
$onload_js .= ' |
| 3887 |
sum_grading_values("wdform_' . $id1 . '",' . $form_id . ');'; |
| 3888 |
if ( $required ) { |
| 3889 |
array_push($req_fields, $id1); |
| 3890 |
} |
| 3891 |
if ($param['w_total'] != '' && $param['w_total'] != '0') { |
| 3892 |
$check_js .= ' |
| 3893 |
var isAllowdedSubmit = true; |
| 3894 |
if(x.find(jQuery("div[wdid=' . $id1 . ']")).length != 0 && x.find(jQuery("div[wdid=' . $id1 . ']")).css("display") != "none") { |
| 3895 |
if(parseInt(jQuery("#wdform_' . $id1 . '_sum_element' . $form_id . '").html()) > ' . $param['w_total'] . ') { |
| 3896 |
alert("' . addslashes(__("Your score should be less than", WDFMInstance(self::PLUGIN)->prefix)) . ' ' . $param['w_total'] . '"); |
| 3897 |
return false; |
| 3898 |
} |
| 3899 |
}'; |
| 3900 |
} |
| 3901 |
$onsubmit_js .= ' |
| 3902 |
jQuery("<input type=\"hidden\" name=\"wdform_' . $id1 . '_hidden_item' . $form_id . '\" value=\"' . $w_items_labels . ':' . $param['w_total'] . '\" />").appendTo("#form' . $form_id . '");'; |
| 3903 |
break; |
| 3904 |
} |
| 3905 |
case 'type_matrix': { |
| 3906 |
$params_names = array( |
| 3907 |
'w_field_label_size', |
| 3908 |
'w_field_label_pos', |
| 3909 |
'w_field_input_type', |
| 3910 |
'w_rows', |
| 3911 |
'w_columns', |
| 3912 |
'w_required', |
| 3913 |
'w_class', |
| 3914 |
'w_textbox_size', |
| 3915 |
); |
| 3916 |
$temp = $params; |
| 3917 |
if ( strpos($temp, 'w_hide_label') > -1 ) { |
| 3918 |
$params_names = array( |
| 3919 |
'w_field_label_size', |
| 3920 |
'w_field_label_pos', |
| 3921 |
'w_hide_label', |
| 3922 |
'w_field_input_type', |
| 3923 |
'w_rows', |
| 3924 |
'w_columns', |
| 3925 |
'w_required', |
| 3926 |
'w_class', |
| 3927 |
'w_textbox_size', |
| 3928 |
); |
| 3929 |
} |
| 3930 |
foreach ( $params_names as $params_name ) { |
| 3931 |
$temp = explode('*:*' . $params_name . '*:*', $temp); |
| 3932 |
$param[$params_name] = $temp[0]; |
| 3933 |
$temp = $temp[1]; |
| 3934 |
} |
| 3935 |
$required = ($param['w_required'] == "yes" ? TRUE : FALSE); |
| 3936 |
$onsubmit_js .= 'jQuery("<input type=\"hidden\" name=\"wdform_' . $id1 . '_input_type' . $form_id . '\" value=\"' . $param['w_field_input_type'] . '\" /><input type=\"hidden\" name=\"wdform_' . $id1 . '_hidden_row' . $form_id . '\" value=\"' . esc_html(addslashes($param['w_rows'])) . '\" /><input type=\"hidden\" name=\"wdform_' . $id1 . '_hidden_column' . $form_id . '\" value=\"' . esc_html(addslashes($param['w_columns'])) . '\" />").appendTo("#form' . $form_id . '");'; |
| 3937 |
if ( $required ) { |
| 3938 |
array_push($req_fields, $id1); |
| 3939 |
} |
| 3940 |
break; |
| 3941 |
} |
| 3942 |
case 'type_paypal_total': { |
| 3943 |
$onload_js .= 'set_total_value(' . $form_id . ');'; |
| 3944 |
break; |
| 3945 |
} |
| 3946 |
break; |
| 3947 |
} |
| 3948 |
} |
| 3949 |
} |
| 3950 |
$onsubmit_js .= ' |
| 3951 |
var disabled_fields = ""; |
| 3952 |
jQuery("#form' . $form_id . ' div[wdid]").each(function() { |
| 3953 |
if(jQuery(this).css("display") == "none") { |
| 3954 |
disabled_fields += jQuery(this).attr("wdid"); |
| 3955 |
disabled_fields += ","; |
| 3956 |
} |
| 3957 |
}) |
| 3958 |
if(disabled_fields) { |
| 3959 |
jQuery("<input type=\"hidden\" name=\"disabled_fields' . $form_id . '\" value =\""+disabled_fields+"\" />").appendTo("#form' . $form_id . '"); |
| 3960 |
};'; |
| 3961 |
ob_start(); |
| 3962 |
?> |
| 3963 |
var fm_currentDate = new Date(); |
| 3964 |
var FormCurrency_<?php echo $form_id; ?> = '<?php echo $form_currency ?>'; |
| 3965 |
var FormPaypalTax_<?php echo $form_id; ?> = '<?php echo $form_paypal_tax ?>'; |
| 3966 |
var check_submit<?php echo $form_id; ?> = 0; |
| 3967 |
var check_before_submit<?php echo $form_id; ?> = {}; |
| 3968 |
var required_fields<?php echo $form_id; ?> = <?php echo json_encode($req_fields) ?>; |
| 3969 |
var labels_and_ids<?php echo $form_id; ?> = <?php echo json_encode($labels_and_ids) ?>; |
| 3970 |
var check_regExp_all<?php echo $form_id; ?> = <?php echo json_encode($check_regExp_all) ?>; |
| 3971 |
var check_paypal_price_min_max<?php echo $form_id; ?> = <?php echo json_encode($check_paypal_price_min_max) ?>; |
| 3972 |
var file_upload_check<?php echo $form_id; ?> = <?php echo json_encode($file_upload_check) ?>; |
| 3973 |
var spinner_check<?php echo $form_id; ?> = <?php echo json_encode($spinner_check) ?>; |
| 3974 |
var scrollbox_trigger_point<?php echo $form_id; ?> = '<?php echo $row_display->scrollbox_trigger_point; ?>'; |
| 3975 |
var header_image_animation<?php echo $form_id; ?> = '<?php echo $row->header_image_animation; ?>'; |
| 3976 |
var scrollbox_loading_delay<?php echo $form_id; ?> = '<?php echo $row_display->scrollbox_loading_delay; ?>'; |
| 3977 |
var scrollbox_auto_hide<?php echo $form_id; ?> = '<?php echo $row_display->scrollbox_auto_hide; ?>'; |
| 3978 |
var inputIds<?php echo $form_id; ?> = '<?php echo json_encode($inputIds); ?>'; |
| 3979 |
var form_view_count<?php echo $form_id ?> = 0; |
| 3980 |
<?php echo preg_replace($pattern, ' ', $row->javascript); ?> |
| 3981 |
|
| 3982 |
function onload_js<?php echo $form_id ?>() {<?php |
| 3983 |
echo $onload_js; ?> |
| 3984 |
} |
| 3985 |
|
| 3986 |
function condition_js<?php echo $form_id ?>() {<?php |
| 3987 |
echo $condition_js; ?> |
| 3988 |
} |
| 3989 |
|
| 3990 |
function check_js<?php echo $form_id ?>(id, form_id) { |
| 3991 |
if (id != 0) { |
| 3992 |
x = jQuery("#" + form_id + "form_view"+id); |
| 3993 |
} |
| 3994 |
else { |
| 3995 |
x = jQuery("#form"+form_id); |
| 3996 |
} |
| 3997 |
<?php echo $check_js; ?> |
| 3998 |
} |
| 3999 |
|
| 4000 |
function onsubmit_js<?php echo $form_id ?>() { |
| 4001 |
<?php echo $onsubmit_js; ?> |
| 4002 |
} |
| 4003 |
|
| 4004 |
function unset_fields<?php echo $form_id ?>( values, id, i ) { |
| 4005 |
rid = 0; |
| 4006 |
if ( i > 0 ) { |
| 4007 |
jQuery.each( values, function( k, v ) { |
| 4008 |
if ( id == k.split('|')[2] ) { |
| 4009 |
rid = k.split('|')[0]; |
| 4010 |
values[k] = ''; |
| 4011 |
} |
| 4012 |
}); |
| 4013 |
return unset_fields<?php echo $form_id ?>(values, rid, i - 1); |
| 4014 |
} else { |
| 4015 |
return values; |
| 4016 |
} |
| 4017 |
} |
| 4018 |
function ajax_similarity<?php echo $form_id ?>( obj, changing_field_id ) { |
| 4019 |
jQuery.ajax({ |
| 4020 |
type: "POST", |
| 4021 |
url: fm_objectL10n.form_maker_admin_ajax, |
| 4022 |
dataType: "json", |
| 4023 |
data: { |
| 4024 |
nonce: fm_ajax.ajaxnonce, |
| 4025 |
action: 'fm_reload_input', |
| 4026 |
page: 'form_maker', |
| 4027 |
form_id: <?php echo $form_id ?>, |
| 4028 |
inputs: obj.inputs |
| 4029 |
}, |
| 4030 |
beforeSend: function() { |
| 4031 |
if ( !jQuery.isEmptyObject(obj.inputs) ) { |
| 4032 |
jQuery.each( obj.inputs, function( key, val ) { |
| 4033 |
wdid = key.split('|')[0]; |
| 4034 |
if ( val != '' && parseInt(wdid) == parseInt(changing_field_id) ) { |
| 4035 |
jQuery("#form<?php echo $form_id ?> div[wdid='"+ wdid +"']").append( '<div class="fm-loading"></div>' ); |
| 4036 |
} |
| 4037 |
}); |
| 4038 |
} |
| 4039 |
}, |
| 4040 |
success: function (res) { |
| 4041 |
if ( !jQuery.isEmptyObject(obj.inputs) ) { |
| 4042 |
jQuery.each( obj.inputs, function( key, val ) { |
| 4043 |
wdid = key.split('|')[0]; |
| 4044 |
jQuery("#form<?php echo $form_id ?> div[wdid='"+ wdid +"'] .fm-loading").remove(); |
| 4045 |
if ( !jQuery.isEmptyObject(res[wdid]) && ( !val || parseInt(wdid) == parseInt(changing_field_id) ) ) { |
| 4046 |
jQuery("#form<?php echo $form_id ?> div[wdid='"+ wdid +"']").html( res[wdid].html ); |
| 4047 |
} |
| 4048 |
}); |
| 4049 |
} |
| 4050 |
}, |
| 4051 |
complete: function() { |
| 4052 |
} |
| 4053 |
}); |
| 4054 |
} |
| 4055 |
|
| 4056 |
jQuery(document).ready(function () { |
| 4057 |
if (jQuery('#form<?php echo $form_id ?> .wdform_section').length > 0) { |
| 4058 |
fm_document_ready(<?php echo $form_id ?>); |
| 4059 |
} |
| 4060 |
else { |
| 4061 |
jQuery("#form<?php echo $form_id ?>").closest(".fm-form-container").removeAttr("style") |
| 4062 |
} |
| 4063 |
if (jQuery('#form<?php echo $form_id ?> .wdform_section').length > 0) { |
| 4064 |
formOnload(<?php echo $form_id ?>); |
| 4065 |
} |
| 4066 |
|
| 4067 |
var ajaxObj<?php echo $form_id ?> = {}; |
| 4068 |
var value_ids<?php echo $form_id ?> = {}; |
| 4069 |
|
| 4070 |
jQuery.each( jQuery.parseJSON( inputIds<?php echo $form_id ?> ), function( key, values ) { |
| 4071 |
jQuery.each( values, function( index, input_id ) { |
| 4072 |
tagName = jQuery('#form<?php echo $form_id ?> [id^="wdform_'+ input_id +'_elemen"]').prop("tagName"); |
| 4073 |
type = jQuery('#form<?php echo $form_id ?> [id^="wdform_'+ input_id +'_elemen"]').prop("type"); |
| 4074 |
if ( tagName == 'INPUT' ) { |
| 4075 |
input_value = jQuery('#form<?php echo $form_id ?> [id^="wdform_'+ input_id +'_elemen"]').val(); |
| 4076 |
if ( jQuery('#form<?php echo $form_id ?> [id^="wdform_'+ input_id +'_elemen"]').is(':checked') ) { |
| 4077 |
if ( input_value ) { |
| 4078 |
value_ids<?php echo $form_id ?>[key + '|' + input_id] = input_value; |
| 4079 |
} |
| 4080 |
} |
| 4081 |
else if ( type == 'text' ) { |
| 4082 |
if ( input_value ) { |
| 4083 |
value_ids<?php echo $form_id ?>[key + '|' + input_id] = input_value; |
| 4084 |
} |
| 4085 |
} |
| 4086 |
} |
| 4087 |
else if ( tagName == 'SELECT' ) { |
| 4088 |
select_value = jQuery('#form<?php echo $form_id ?> [id^="wdform_'+ input_id +'_elemen"] option:selected').val(); |
| 4089 |
if ( select_value ) { |
| 4090 |
value_ids<?php echo $form_id ?>[key + '|' + input_id] = select_value; |
| 4091 |
} |
| 4092 |
} |
| 4093 |
ajaxObj<?php echo $form_id ?>.inputs = value_ids<?php echo $form_id ?>; |
| 4094 |
|
| 4095 |
jQuery(document).on('change', '#form<?php echo $form_id ?> [id^="wdform_'+ input_id +'_elemen"]', function() { |
| 4096 |
var id = ''; |
| 4097 |
var changing_field_id = ''; |
| 4098 |
if( jQuery(this).prop("tagName") == 'INPUT' ) { |
| 4099 |
if( jQuery(this).is(':checked') ) { |
| 4100 |
id = jQuery(this).val(); |
| 4101 |
} |
| 4102 |
if( jQuery(this).attr('type') == 'text' ) { |
| 4103 |
id = jQuery(this).val(); |
| 4104 |
} |
| 4105 |
} |
| 4106 |
else { |
| 4107 |
id = jQuery(this).val(); |
| 4108 |
} |
| 4109 |
value_ids<?php echo $form_id ?>[key + '|' + input_id] = id; |
| 4110 |
|
| 4111 |
jQuery.each( value_ids<?php echo $form_id ?>, function( k, v ) { |
| 4112 |
key_arr = k.split('|'); |
| 4113 |
if ( input_id == key_arr[2] ) { |
| 4114 |
changing_field_id = key_arr[0]; |
| 4115 |
count = Object.keys(value_ids<?php echo $form_id ?>).length; |
| 4116 |
value_ids<?php echo $form_id ?> = unset_fields<?php echo $form_id ?>( value_ids<?php echo $form_id ?>, changing_field_id, count ); |
| 4117 |
} |
| 4118 |
}); |
| 4119 |
|
| 4120 |
ajaxObj<?php echo $form_id ?>.inputs = value_ids<?php echo $form_id ?>; |
| 4121 |
ajax_similarity<?php echo $form_id ?>( ajaxObj<?php echo $form_id ?>, changing_field_id ); |
| 4122 |
}); |
| 4123 |
}); |
| 4124 |
}); |
| 4125 |
ajax_similarity<?php echo $form_id ?>( ajaxObj<?php echo $form_id ?>, null ); |
| 4126 |
}); |
| 4127 |
<?php |
| 4128 |
$js_content = ob_get_clean(); |
| 4129 |
self::$fm_js_content = $js_content; |
| 4130 |
fwrite($jsfile, $js_content); |
| 4131 |
fclose($jsfile); |
| 4132 |
clearstatcache(); |
| 4133 |
} |
| 4134 |
|
| 4135 |
/** |
| 4136 |
* Get submissions to export. |
| 4137 |
* |
| 4138 |
* @return array |
| 4139 |
*/ |
| 4140 |
public static function get_submissions_to_export() { |
| 4141 |
global $wpdb; |
| 4142 |
$params = array(); |
| 4143 |
$form_id = (int) $_REQUEST['form_id']; |
| 4144 |
$limitstart = (int) $_REQUEST['limitstart']; |
| 4145 |
$page_num = (int) $_REQUEST['page_num']; |
| 4146 |
$search_labels = isset($_REQUEST['search_labels']) ? $_REQUEST['search_labels'] : ''; |
| 4147 |
$groupids = !empty($_REQUEST['groupids']) ? explode(',', $_REQUEST['groupids']) : ''; |
| 4148 |
$verified_emails = isset($_REQUEST['verified_emails']) ? json_decode(stripslashes($_REQUEST['verified_emails']), TRUE) : array(); |
| 4149 |
$paypal_info_fields = array( |
| 4150 |
'currency' => 'Currency', |
| 4151 |
'ord_last_modified' => 'Last modified', |
| 4152 |
'status' => 'Status', |
| 4153 |
'full_name' => 'Full Name', |
| 4154 |
'fax' => 'Fax', |
| 4155 |
'mobile_phone' => 'Mobile phone', |
| 4156 |
'email' => 'Email', |
| 4157 |
'phone' => 'Phone', |
| 4158 |
'address' => 'Address', |
| 4159 |
'paypal_info' => 'Paypal info', |
| 4160 |
'ipn' => 'IPN', |
| 4161 |
'tax' => 'Tax', |
| 4162 |
'shipping' => 'Shipping' |
| 4163 |
); |
| 4164 |
$query = $wpdb->prepare("SELECT distinct element_label FROM " . $wpdb->prefix . "formmaker_submits where form_id=%d", $form_id); |
| 4165 |
$labels = $wpdb->get_col($query); |
| 4166 |
$query_lable = $wpdb->prepare("SELECT label_order,title FROM " . $wpdb->prefix . "formmaker where id=%d", $form_id); |
| 4167 |
$rows_lable = $wpdb->get_results($query_lable); |
| 4168 |
$ptn = "/[^a-zA-Z0-9_]/"; |
| 4169 |
$rpltxt = ""; |
| 4170 |
$title = isset($rows_lable[0]) ? preg_replace($ptn, $rpltxt, $rows_lable[0]->title) : ''; |
| 4171 |
$sorted_labels_id = array(); |
| 4172 |
$sorted_labels = array(); |
| 4173 |
$sorted_types = array(); |
| 4174 |
$label_titles = array(); |
| 4175 |
$label_id = array(); |
| 4176 |
$label_order = array(); |
| 4177 |
$label_order_original = array(); |
| 4178 |
$label_type = array(); |
| 4179 |
if ( $labels ) { |
| 4180 |
$label_all = explode('#****#', $rows_lable[0]->label_order); |
| 4181 |
$label_all = array_slice($label_all, 0, count($label_all) - 1); |
| 4182 |
foreach ( $label_all as $key => $label_each ) { |
| 4183 |
$label_id_each = explode('#**id**#', $label_each); |
| 4184 |
array_push($label_id, $label_id_each[0]); |
| 4185 |
$label_oder_each = explode('#**label**#', $label_id_each[1]); |
| 4186 |
array_push($label_order_original, $label_oder_each[0]); |
| 4187 |
$label_temp = preg_replace($ptn, $rpltxt, $label_oder_each[0]); |
| 4188 |
array_push($label_order, $label_temp); |
| 4189 |
array_push($label_type, $label_oder_each[1]); |
| 4190 |
} |
| 4191 |
foreach ( $label_id as $key => $label ) { |
| 4192 |
if ( in_array($label, $labels) && $label_type[$key] != 'type_arithmetic_captcha' |
| 4193 |
&& in_array($label, $labels) && $label_type[$key] != 'type_stripe' ) { |
| 4194 |
array_push($sorted_labels, $label_order[$key]); |
| 4195 |
array_push($sorted_labels_id, $label); |
| 4196 |
array_push($label_titles, stripslashes($label_order_original[$key])); |
| 4197 |
array_push($sorted_types, $label_type[$key]); |
| 4198 |
} |
| 4199 |
} |
| 4200 |
} |
| 4201 |
$m = count($sorted_labels); |
| 4202 |
$wpdb->query("SET SESSION group_concat_max_len = 1000000"); |
| 4203 |
$rows = array(); |
| 4204 |
if ( !empty($groupids) ) { |
| 4205 |
$query = $wpdb->prepare("SELECT `group_id`, `ip`, `date`, `user_id_wd`, GROUP_CONCAT( element_label SEPARATOR ',') AS `element_label`, GROUP_CONCAT( element_value SEPARATOR '*:*el_value*:*') AS `element_value` FROM " . $wpdb->prefix . "formmaker_submits WHERE `form_id` = %d and `group_id` IN(" . implode($groupids,',') . ") GROUP BY `group_id` ORDER BY `date` ASC", $form_id); |
| 4206 |
$rows = $wpdb->get_results($query, OBJECT_K); |
| 4207 |
} |
| 4208 |
$data = array(); |
| 4209 |
$is_paypal_info = FALSE; |
| 4210 |
for ( $www = 0; $www < count($groupids); $www++ ) { |
| 4211 |
$i = $groupids[$www]; |
| 4212 |
$field_key = array_search($i, $label_id); |
| 4213 |
if ( $label_type[$field_key] != 'type_arithmetic_captcha' |
| 4214 |
&& $label_type[$field_key] != 'type_stripe' ) { |
| 4215 |
$data_temp = array(); |
| 4216 |
$tt = $rows[$i]; |
| 4217 |
$date = $tt->date; |
| 4218 |
$ip = $tt->ip; |
| 4219 |
$user_id = get_userdata($tt->user_id_wd); |
| 4220 |
$username = $user_id ? $user_id->display_name : ""; |
| 4221 |
$useremail = $user_id ? $user_id->user_email : ""; |
| 4222 |
$data_temp['ID'] = $i; |
| 4223 |
$data_temp['Submit date'] = $date; |
| 4224 |
$data_temp['Submitter\'s IP'] = $ip; |
| 4225 |
$data_temp['Submitter\'s Username'] = $username; |
| 4226 |
$data_temp['Submitter\'s Email Address'] = $useremail; |
| 4227 |
$element_labels = explode(',', $tt->element_label); |
| 4228 |
$element_values = explode('*:*el_value*:*', $tt->element_value); |
| 4229 |
for ( $h = 0; $h < $m; $h++ ) { |
| 4230 |
if ( isset($data_temp[$label_titles[$h]]) ) { |
| 4231 |
$label_titles[$h] .= '(1)'; |
| 4232 |
} |
| 4233 |
if ( in_array($sorted_labels_id[$h], $element_labels) ) { |
| 4234 |
$element_value = $element_values[array_search($sorted_labels_id[$h], $element_labels)]; |
| 4235 |
if ( strpos($element_value, "*@@url@@*") ) { |
| 4236 |
$file_names = ''; |
| 4237 |
$new_files = explode("*@@url@@*", $element_value); |
| 4238 |
foreach ( $new_files as $new_file ) { |
| 4239 |
if ( $new_file ) { |
| 4240 |
$file_names .= $new_file . ", "; |
| 4241 |
} |
| 4242 |
} |
| 4243 |
$data_temp[stripslashes($label_titles[$h])] = $file_names; |
| 4244 |
} |
| 4245 |
elseif ( strpos($element_value, "***br***") ) { |
| 4246 |
$element_value = str_replace("***br***", ', ', $element_value); |
| 4247 |
if ( strpos($element_value, "***quantity***") ) { |
| 4248 |
$element_value = str_replace("***quantity***", '', $element_value); |
| 4249 |
} |
| 4250 |
if ( strpos($element_value, "***property***") ) { |
| 4251 |
$element_value = str_replace("***property***", '', $element_value); |
| 4252 |
} |
| 4253 |
if ( substr($element_value, -2) == ', ' ) { |
| 4254 |
$data_temp[stripslashes($label_titles[$h])] = substr($element_value, 0, -2); |
| 4255 |
} |
| 4256 |
else { |
| 4257 |
$data_temp[stripslashes($label_titles[$h])] = $element_value; |
| 4258 |
} |
| 4259 |
} |
| 4260 |
elseif ( strpos($element_value, "***map***") ) { |
| 4261 |
$data_temp[stripslashes($label_titles[$h])] = 'Longitude:' . str_replace("***map***", ', Latitude:', $element_value); |
| 4262 |
} |
| 4263 |
elseif ( strpos($element_value, "***star_rating***") ) { |
| 4264 |
$element = str_replace("***star_rating***", '', $element_value); |
| 4265 |
$element = explode("***", $element); |
| 4266 |
$data_temp[stripslashes($label_titles[$h])] = ' ' . $element[1] . '/' . $element[0]; |
| 4267 |
} |
| 4268 |
elseif ( strpos($element_value, "@@@") !== FALSE ) { |
| 4269 |
$data_temp[stripslashes($label_titles[$h])] = str_replace("@@@", ' ', $element_value); |
| 4270 |
} |
| 4271 |
elseif ( strpos($element_value, "***grading***") ) { |
| 4272 |
$element = str_replace("***grading***", '', $element_value); |
| 4273 |
$grading = explode(":", $element); |
| 4274 |
$items_count = sizeof($grading) - 1; |
| 4275 |
$items = ""; |
| 4276 |
$total = ""; |
| 4277 |
for ( $k = 0; $k < $items_count / 2; $k++ ) { |
| 4278 |
$items .= $grading[$items_count / 2 + $k] . ": " . $grading[$k] . ", "; |
| 4279 |
$total += $grading[$k]; |
| 4280 |
} |
| 4281 |
$items .= "Total: " . $total; |
| 4282 |
$data_temp[stripslashes($label_titles[$h])] = $items; |
| 4283 |
} |
| 4284 |
elseif ( strpos($element_value, "***matrix***") ) { |
| 4285 |
$element = str_replace("***matrix***", '', $element_value); |
| 4286 |
$matrix_value = explode('***', $element); |
| 4287 |
$matrix_value = array_slice($matrix_value, 0, count($matrix_value) - 1); |
| 4288 |
$mat_rows = $matrix_value[0]; |
| 4289 |
$mat_columns = $matrix_value[$mat_rows + 1]; |
| 4290 |
$matrix = ""; |
| 4291 |
$aaa = array(); |
| 4292 |
$var_checkbox = 1; |
| 4293 |
$selected_value = ""; |
| 4294 |
$selected_value_yes = ""; |
| 4295 |
$selected_value_no = ""; |
| 4296 |
for ( $k = 1; $k <= $mat_rows; $k++ ) { |
| 4297 |
if ( $matrix_value[$mat_rows + $mat_columns + 2] == "radio" ) { |
| 4298 |
if ( $matrix_value[$mat_rows + $mat_columns + 2 + $k] == 0 ) { |
| 4299 |
$checked = "0"; |
| 4300 |
$aaa[1] = ""; |
| 4301 |
} |
| 4302 |
else { |
| 4303 |
$aaa = explode("_", $matrix_value[$mat_rows + $mat_columns + 2 + $k]); |
| 4304 |
} |
| 4305 |
for ( $l = 1; $l <= $mat_columns; $l++ ) { |
| 4306 |
$checked = $aaa[1] == $l ? '1' : '0'; |
| 4307 |
$matrix .= '[' . $matrix_value[$k] . ',' . $matrix_value[$mat_rows + 1 + $l] . ']=' . $checked . "; "; |
| 4308 |
} |
| 4309 |
} |
| 4310 |
else { |
| 4311 |
if ( $matrix_value[$mat_rows + $mat_columns + 2] == "checkbox" ) { |
| 4312 |
for ( $l = 1; $l <= $mat_columns; $l++ ) { |
| 4313 |
$checked = $matrix_value[$mat_rows + $mat_columns + 2 + $var_checkbox] == 1 ? '1' : '0'; |
| 4314 |
$matrix .= '[' . $matrix_value[$k] . ',' . $matrix_value[$mat_rows + 1 + $l] . ']=' . $checked . "; "; |
| 4315 |
$var_checkbox++; |
| 4316 |
} |
| 4317 |
} |
| 4318 |
else { |
| 4319 |
if ( $matrix_value[$mat_rows + $mat_columns + 2] == "text" ) { |
| 4320 |
for ( $l = 1; $l <= $mat_columns; $l++ ) { |
| 4321 |
$text_value = $matrix_value[$mat_rows + $mat_columns + 2 + $var_checkbox]; |
| 4322 |
$matrix .= '[' . $matrix_value[$k] . ',' . $matrix_value[$mat_rows + 1 + $l] . ']=' . $text_value . "; "; |
| 4323 |
$var_checkbox++; |
| 4324 |
} |
| 4325 |
} |
| 4326 |
else { |
| 4327 |
for ( $l = 1; $l <= $mat_columns; $l++ ) { |
| 4328 |
$selected_text = $matrix_value[$mat_rows + $mat_columns + 2 + $var_checkbox]; |
| 4329 |
$matrix .= '[' . $matrix_value[$k] . ',' . $matrix_value[$mat_rows + 1 + $l] . ']=' . $selected_text . "; "; |
| 4330 |
$var_checkbox++; |
| 4331 |
} |
| 4332 |
} |
| 4333 |
} |
| 4334 |
} |
| 4335 |
} |
| 4336 |
$data_temp[stripslashes($label_titles[$h])] = $matrix; |
| 4337 |
} |
| 4338 |
else { |
| 4339 |
$val = strip_tags(htmlspecialchars_decode($element_value)); |
| 4340 |
$val = stripslashes(str_replace(''', "'", $val)); |
| 4341 |
$data_temp[stripslashes($label_titles[$h])] = $val; |
| 4342 |
} |
| 4343 |
} |
| 4344 |
else { |
| 4345 |
$data_temp[stripslashes($label_titles[$h])] = ''; |
| 4346 |
} |
| 4347 |
if ( isset($verified_emails[$sorted_labels_id[$h]]) && $sorted_types[$h] == "type_submitter_mail" ) { |
| 4348 |
if ( $data_temp[stripslashes($label_titles[$h])] == '' ) { |
| 4349 |
$data_temp[stripslashes($label_titles[$h]) . '(verified)'] = ''; |
| 4350 |
} |
| 4351 |
else { |
| 4352 |
if ( in_array($i, $verified_emails[$sorted_labels_id[$h]]) ) { |
| 4353 |
$data_temp[stripslashes($label_titles[$h]) . '(verified)'] = 'yes'; |
| 4354 |
} |
| 4355 |
else { |
| 4356 |
$data_temp[stripslashes($label_titles[$h]) . '(verified)'] = 'no'; |
| 4357 |
} |
| 4358 |
} |
| 4359 |
} |
| 4360 |
} |
| 4361 |
$item_total = $wpdb->get_var($wpdb->prepare("SELECT `element_value` FROM " . $wpdb->prefix . "formmaker_submits where group_id=%d AND element_label=%s", $i, 'item_total')); |
| 4362 |
$total = $wpdb->get_var($wpdb->prepare("SELECT `element_value` FROM " . $wpdb->prefix . "formmaker_submits where group_id=%d AND element_label=%s", $i, 'total')); |
| 4363 |
$payment_status = $wpdb->get_var($wpdb->prepare("SELECT `element_value` FROM " . $wpdb->prefix . "formmaker_submits where group_id=%d AND element_label=%s", $i, '0')); |
| 4364 |
if ( $item_total ) { |
| 4365 |
$data_temp['Item Total'] = $item_total; |
| 4366 |
} |
| 4367 |
if ( $total ) { |
| 4368 |
$data_temp['Total'] = $total; |
| 4369 |
} |
| 4370 |
if ( $payment_status ) { |
| 4371 |
$data_temp['Payment Status'] = $payment_status; |
| 4372 |
} |
| 4373 |
$query = $wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "formmaker_sessions where group_id=%d", $i); |
| 4374 |
$paypal_info = $wpdb->get_results($query); |
| 4375 |
if ( $paypal_info ) { |
| 4376 |
$is_paypal_info = TRUE; |
| 4377 |
} |
| 4378 |
if ( $is_paypal_info ) { |
| 4379 |
foreach ( $paypal_info_fields as $key => $paypal_info_field ) { |
| 4380 |
if ( $paypal_info ) { |
| 4381 |
$data_temp['PAYPAL_' . $paypal_info_field ] = $paypal_info[0]->$key; |
| 4382 |
} |
| 4383 |
else { |
| 4384 |
$data_temp['PAYPAL_' . $paypal_info_field ] = ''; |
| 4385 |
} |
| 4386 |
} |
| 4387 |
} |
| 4388 |
$data[$i] = $data_temp; |
| 4389 |
} |
| 4390 |
} |
| 4391 |
array_push($params, $data); |
| 4392 |
array_push($params, $title); |
| 4393 |
array_push($params, $is_paypal_info); |
| 4394 |
|
| 4395 |
return $params; |
| 4396 |
} |
| 4397 |
|
| 4398 |
/** |
| 4399 |
* No items. |
| 4400 |
* |
| 4401 |
* @param $title |
| 4402 |
* |
| 4403 |
* @return string |
| 4404 |
*/ |
| 4405 |
public static function no_items($title) { |
| 4406 |
$title = ($title != '') ? strtolower($title) : 'items'; |
| 4407 |
ob_start(); |
| 4408 |
?><tr class="no-items"> |
| 4409 |
<td class="colspanchange fm-column-not-hide" colspan="0"><?php echo sprintf(__('No %s found.', WDFMInstance(self::PLUGIN)->prefix), $title); ?></td> |
| 4410 |
</tr><?php |
| 4411 |
return ob_get_clean(); |
| 4412 |
} |
| 4413 |
|
| 4414 |
/** |
| 4415 |
* Get current page url. |
| 4416 |
* |
| 4417 |
* @return string |
| 4418 |
*/ |
| 4419 |
public static function get_current_page_url() { |
| 4420 |
global $wp; |
| 4421 |
return add_query_arg( $_SERVER['QUERY_STRING'], '', home_url( $wp->request ) ); |
| 4422 |
} |
| 4423 |
|
| 4424 |
/** |
| 4425 |
* Get all addons. |
| 4426 |
* |
| 4427 |
* @return array $addons |
| 4428 |
*/ |
| 4429 |
public static function get_all_addons_path() { |
| 4430 |
$addons = array( |
| 4431 |
'form-maker-export-import/fm_exp_imp.php', |
| 4432 |
'form-maker-save-progress/fm_save.php', |
| 4433 |
'form-maker-conditional-emails/fm_conditional_emails.php', |
| 4434 |
'form-maker-pushover/fm_pushover.php', |
| 4435 |
'form-maker-mailchimp/fm_mailchimp.php', |
| 4436 |
'form-maker-reg/fm_reg.php', |
| 4437 |
'form-maker-post-generation/fm_post_generation.php', |
| 4438 |
'form-maker-dropbox-integration/fm_dropbox_integration.php', |
| 4439 |
'form-maker-gdrive-integration/fm_gdrive_integration.php', |
| 4440 |
'form-maker-pdf-integration/fm_pdf_integration.php', |
| 4441 |
'form-maker-stripe/fm_stripe.php', |
| 4442 |
'form-maker-calculator/fm_calculator.php' |
| 4443 |
); |
| 4444 |
|
| 4445 |
return $addons; |
| 4446 |
} |
| 4447 |
|
| 4448 |
/** |
| 4449 |
* Deactivate all addons with given additional plugin. |
| 4450 |
* |
| 4451 |
* @param bool $additional_plugin |
| 4452 |
*/ |
| 4453 |
public static function deactivate_all_addons($additional_plugin = FALSE) { |
| 4454 |
include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); |
| 4455 |
$addons = self::get_all_addons_path(); |
| 4456 |
if ( $additional_plugin ) { |
| 4457 |
array_push($addons, $additional_plugin); |
| 4458 |
} |
| 4459 |
foreach ( $addons as $addon ) { |
| 4460 |
if ( is_plugin_active( $addon ) ) { |
| 4461 |
deactivate_plugins( $addon, false, false ); |
| 4462 |
} |
| 4463 |
} |
| 4464 |
} |
| 4465 |
|
| 4466 |
/** |
| 4467 |
* Get countries list. |
| 4468 |
* |
| 4469 |
* @return array |
| 4470 |
*/ |
| 4471 |
public static function get_countries() { |
| 4472 |
$countries = array( |
| 4473 |
"" => "", |
| 4474 |
"Afghanistan" => __("Afghanistan", WDFMInstance(self::PLUGIN)->prefix), |
| 4475 |
"Albania" => __("Albania", WDFMInstance(self::PLUGIN)->prefix), |
| 4476 |
"Algeria" => __("Algeria", WDFMInstance(self::PLUGIN)->prefix), |
| 4477 |
"Andorra" => __("Andorra", WDFMInstance(self::PLUGIN)->prefix), |
| 4478 |
"Angola" => __("Angola", WDFMInstance(self::PLUGIN)->prefix), |
| 4479 |
"Antigua and Barbuda" => __("Antigua and Barbuda", WDFMInstance(self::PLUGIN)->prefix), |
| 4480 |
"Argentina" => __("Argentina", WDFMInstance(self::PLUGIN)->prefix), |
| 4481 |
"Armenia" => __("Armenia", WDFMInstance(self::PLUGIN)->prefix), |
| 4482 |
"Australia" => __("Australia", WDFMInstance(self::PLUGIN)->prefix), |
| 4483 |
"Austria" => __("Austria", WDFMInstance(self::PLUGIN)->prefix), |
| 4484 |
"Azerbaijan" => __("Azerbaijan", WDFMInstance(self::PLUGIN)->prefix), |
| 4485 |
"Bahamas" => __("Bahamas", WDFMInstance(self::PLUGIN)->prefix), |
| 4486 |
"Bahrain" => __("Bahrain", WDFMInstance(self::PLUGIN)->prefix), |
| 4487 |
"Bangladesh" => __("Bangladesh", WDFMInstance(self::PLUGIN)->prefix), |
| 4488 |
"Barbados" => __("Barbados", WDFMInstance(self::PLUGIN)->prefix), |
| 4489 |
"Belarus" => __("Belarus", WDFMInstance(self::PLUGIN)->prefix), |
| 4490 |
"Belgium" => __("Belgium", WDFMInstance(self::PLUGIN)->prefix), |
| 4491 |
"Belize" => __("Belize", WDFMInstance(self::PLUGIN)->prefix), |
| 4492 |
"Benin" => __("Benin", WDFMInstance(self::PLUGIN)->prefix), |
| 4493 |
"Bhutan" => __("Bhutan", WDFMInstance(self::PLUGIN)->prefix), |
| 4494 |
"Bolivia" => __("Bolivia", WDFMInstance(self::PLUGIN)->prefix), |
| 4495 |
"Bosnia and Herzegovina" => __("Bosnia and Herzegovina", WDFMInstance(self::PLUGIN)->prefix), |
| 4496 |
"Botswana" => __("Botswana", WDFMInstance(self::PLUGIN)->prefix), |
| 4497 |
"Brazil" => __("Brazil", WDFMInstance(self::PLUGIN)->prefix), |
| 4498 |
"Brunei" => __("Brunei", WDFMInstance(self::PLUGIN)->prefix), |
| 4499 |
"Bulgaria" => __("Bulgaria", WDFMInstance(self::PLUGIN)->prefix), |
| 4500 |
"Burkina" => __("Burkina Faso", WDFMInstance(self::PLUGIN)->prefix), |
| 4501 |
"Burundi" => __("Burundi", WDFMInstance(self::PLUGIN)->prefix), |
| 4502 |
"Cambodia" => __("Cambodia", WDFMInstance(self::PLUGIN)->prefix), |
| 4503 |
"Cameroon" => __("Cameroon", WDFMInstance(self::PLUGIN)->prefix), |
| 4504 |
"Canada" => __("Canada", WDFMInstance(self::PLUGIN)->prefix), |
| 4505 |
"Cape Verde" => __("Cape Verde", WDFMInstance(self::PLUGIN)->prefix), |
| 4506 |
"Central African Republic" => __("Central African Republic", WDFMInstance(self::PLUGIN)->prefix), |
| 4507 |
"Chad" => __("Chad", WDFMInstance(self::PLUGIN)->prefix), |
| 4508 |
"Chile" => __("Chile", WDFMInstance(self::PLUGIN)->prefix), |
| 4509 |
"China" => __("China", WDFMInstance(self::PLUGIN)->prefix), |
| 4510 |
"Colombia" => __("Colombia", WDFMInstance(self::PLUGIN)->prefix), |
| 4511 |
"Comoros" => __("Comoros", WDFMInstance(self::PLUGIN)->prefix), |
| 4512 |
"Congo (Brazzaville)" => __("Congo (Brazzaville)", WDFMInstance(self::PLUGIN)->prefix), |
| 4513 |
"Congo" => __("Congo", WDFMInstance(self::PLUGIN)->prefix), |
| 4514 |
"Costa Rica" => __("Costa Rica", WDFMInstance(self::PLUGIN)->prefix), |
| 4515 |
"Cote d'Ivoire" => __("Cote d'Ivoire", WDFMInstance(self::PLUGIN)->prefix), |
| 4516 |
"Croatia" => __("Croatia", WDFMInstance(self::PLUGIN)->prefix), |
| 4517 |
"Cuba" => __("Cuba", WDFMInstance(self::PLUGIN)->prefix), |
| 4518 |
"Curacao" => __("Curacao", WDFMInstance(self::PLUGIN)->prefix), |
| 4519 |
"Cyprus" => __("Cyprus", WDFMInstance(self::PLUGIN)->prefix), |
| 4520 |
"Czech Republic" => __("Czech Republic", WDFMInstance(self::PLUGIN)->prefix), |
| 4521 |
"Denmark" => __("Denmark", WDFMInstance(self::PLUGIN)->prefix), |
| 4522 |
"Djibouti" => __("Djibouti", WDFMInstance(self::PLUGIN)->prefix), |
| 4523 |
"Dominica" => __("Dominica", WDFMInstance(self::PLUGIN)->prefix), |
| 4524 |
"Dominican Republic" => __("Dominican Republic", WDFMInstance(self::PLUGIN)->prefix), |
| 4525 |
"East Timor (Timor Timur" => __("East Timor (Timor Timur)", WDFMInstance(self::PLUGIN)->prefix), |
| 4526 |
"Ecuador" => __("Ecuador", WDFMInstance(self::PLUGIN)->prefix), |
| 4527 |
"Egypt" => __("Egypt", WDFMInstance(self::PLUGIN)->prefix), |
| 4528 |
"El Salvador" => __("El Salvador", WDFMInstance(self::PLUGIN)->prefix), |
| 4529 |
"Equatorial" => __("Equatorial Guinea", WDFMInstance(self::PLUGIN)->prefix), |
| 4530 |
"Eritrea" => __("Eritrea", WDFMInstance(self::PLUGIN)->prefix), |
| 4531 |
"Estonia" => __("Estonia", WDFMInstance(self::PLUGIN)->prefix), |
| 4532 |
"Ethiopia" => __("Ethiopia", WDFMInstance(self::PLUGIN)->prefix), |
| 4533 |
"Fiji" => __("Fiji", WDFMInstance(self::PLUGIN)->prefix), |
| 4534 |
"Finland" => __("Finland", WDFMInstance(self::PLUGIN)->prefix), |
| 4535 |
"France" => __("France", WDFMInstance(self::PLUGIN)->prefix), |
| 4536 |
"Gabon" => __("Gabon", WDFMInstance(self::PLUGIN)->prefix), |
| 4537 |
"Gambia, The" => __("Gambia, The", WDFMInstance(self::PLUGIN)->prefix), |
| 4538 |
"Georgia" => __("Georgia", WDFMInstance(self::PLUGIN)->prefix), |
| 4539 |
"Germany" => __("Germany", WDFMInstance(self::PLUGIN)->prefix), |
| 4540 |
"Ghana" => __("Ghana", WDFMInstance(self::PLUGIN)->prefix), |
| 4541 |
"Greece" => __("Greece", WDFMInstance(self::PLUGIN)->prefix), |
| 4542 |
"Grenada" => __("Grenada", WDFMInstance(self::PLUGIN)->prefix), |
| 4543 |
"Guatemala" => __("Guatemala", WDFMInstance(self::PLUGIN)->prefix), |
| 4544 |
"Guinea" => __("Guinea", WDFMInstance(self::PLUGIN)->prefix), |
| 4545 |
"Guinea-Bissau" => __("Guinea-Bissau", WDFMInstance(self::PLUGIN)->prefix), |
| 4546 |
"Guyana" => __("Guyana", WDFMInstance(self::PLUGIN)->prefix), |
| 4547 |
"Haiti" => __("Haiti", WDFMInstance(self::PLUGIN)->prefix), |
| 4548 |
"Honduras" => __("Honduras", WDFMInstance(self::PLUGIN)->prefix), |
| 4549 |
"Hong Kong" => __("Hong Kong", WDFMInstance(self::PLUGIN)->prefix), |
| 4550 |
"Hungary" => __("Hungary", WDFMInstance(self::PLUGIN)->prefix), |
| 4551 |
"Iceland" => __("Iceland", WDFMInstance(self::PLUGIN)->prefix), |
| 4552 |
"India" => __("India", WDFMInstance(self::PLUGIN)->prefix), |
| 4553 |
"Indonesia" => __("Indonesia", WDFMInstance(self::PLUGIN)->prefix), |
| 4554 |
"Iran" => __("Iran", WDFMInstance(self::PLUGIN)->prefix), |
| 4555 |
"Iraq" => __("Iraq", WDFMInstance(self::PLUGIN)->prefix), |
| 4556 |
"Ireland" => __("Ireland", WDFMInstance(self::PLUGIN)->prefix), |
| 4557 |
"Israel" => __("Israel", WDFMInstance(self::PLUGIN)->prefix), |
| 4558 |
"Italy" => __("Italy", WDFMInstance(self::PLUGIN)->prefix), |
| 4559 |
"Jamaica" => __("Jamaica", WDFMInstance(self::PLUGIN)->prefix), |
| 4560 |
"Japan" => __("Japan", WDFMInstance(self::PLUGIN)->prefix), |
| 4561 |
"Jordan" => __("Jordan", WDFMInstance(self::PLUGIN)->prefix), |
| 4562 |
"Kazakhstan" => __("Kazakhstan", WDFMInstance(self::PLUGIN)->prefix), |
| 4563 |
"Kenya" => __("Kenya", WDFMInstance(self::PLUGIN)->prefix), |
| 4564 |
"Kiribati" => __("Kiribati", WDFMInstance(self::PLUGIN)->prefix), |
| 4565 |
"Korea, North" => __("Korea, North", WDFMInstance(self::PLUGIN)->prefix), |
| 4566 |
"Korea, South" => __("Korea, South", WDFMInstance(self::PLUGIN)->prefix), |
| 4567 |
"Kuwait" => __("Kuwait", WDFMInstance(self::PLUGIN)->prefix), |
| 4568 |
"Kyrgyzstan" => __("Kyrgyzstan", WDFMInstance(self::PLUGIN)->prefix), |
| 4569 |
"Laos" => __("Laos", WDFMInstance(self::PLUGIN)->prefix), |
| 4570 |
"Latvia" => __("Latvia", WDFMInstance(self::PLUGIN)->prefix), |
| 4571 |
"Lebanon" => __("Lebanon", WDFMInstance(self::PLUGIN)->prefix), |
| 4572 |
"Lesotho" => __("Lesotho", WDFMInstance(self::PLUGIN)->prefix), |
| 4573 |
"Liberia" => __("Liberia", WDFMInstance(self::PLUGIN)->prefix), |
| 4574 |
"Libya" => __("Libya", WDFMInstance(self::PLUGIN)->prefix), |
| 4575 |
"Liechtenstein" => __("Liechtenstein", WDFMInstance(self::PLUGIN)->prefix), |
| 4576 |
"Lithuania" => __("Lithuania", WDFMInstance(self::PLUGIN)->prefix), |
| 4577 |
"Luxembourg" => __("Luxembourg", WDFMInstance(self::PLUGIN)->prefix), |
| 4578 |
"North Macedonia" => __("North Macedonia", WDFMInstance(self::PLUGIN)->prefix), |
| 4579 |
"Madagascar" => __("Madagascar", WDFMInstance(self::PLUGIN)->prefix), |
| 4580 |
"Malawi" => __("Malawi", WDFMInstance(self::PLUGIN)->prefix), |
| 4581 |
"Malaysia" => __("Malaysia", WDFMInstance(self::PLUGIN)->prefix), |
| 4582 |
"Maldives" => __("Maldives", WDFMInstance(self::PLUGIN)->prefix), |
| 4583 |
"Mali" => __("Mali", WDFMInstance(self::PLUGIN)->prefix), |
| 4584 |
"Malta" => __("Malta", WDFMInstance(self::PLUGIN)->prefix), |
| 4585 |
"Marshall Islands" => __("Marshall Islands", WDFMInstance(self::PLUGIN)->prefix), |
| 4586 |
"Mauritania" => __("Mauritania", WDFMInstance(self::PLUGIN)->prefix), |
| 4587 |
"Mauritius" => __("Mauritius", WDFMInstance(self::PLUGIN)->prefix), |
| 4588 |
"Mexico" => __("Mexico", WDFMInstance(self::PLUGIN)->prefix), |
| 4589 |
"Micronesia" => __("Micronesia", WDFMInstance(self::PLUGIN)->prefix), |
| 4590 |
"Moldova" => __("Moldova", WDFMInstance(self::PLUGIN)->prefix), |
| 4591 |
"Monaco" => __("Monaco", WDFMInstance(self::PLUGIN)->prefix), |
| 4592 |
"Mongolia" => __("Mongolia", WDFMInstance(self::PLUGIN)->prefix), |
| 4593 |
"Morocco" => __("Morocco", WDFMInstance(self::PLUGIN)->prefix), |
| 4594 |
"Mozambique" => __("Mozambique", WDFMInstance(self::PLUGIN)->prefix), |
| 4595 |
"Myanmar" => __("Myanmar", WDFMInstance(self::PLUGIN)->prefix), |
| 4596 |
"Namibia" => __("Namibia", WDFMInstance(self::PLUGIN)->prefix), |
| 4597 |
"Nauru" => __("Nauru", WDFMInstance(self::PLUGIN)->prefix), |
| 4598 |
"Nepal" => __("Nepal", WDFMInstance(self::PLUGIN)->prefix), |
| 4599 |
"Netherlands" => __("Netherlands", WDFMInstance(self::PLUGIN)->prefix), |
| 4600 |
"New Zealand" => __("New Zealand", WDFMInstance(self::PLUGIN)->prefix), |
| 4601 |
"Nicaragua" => __("Nicaragua", WDFMInstance(self::PLUGIN)->prefix), |
| 4602 |
"Niger" => __("Niger", WDFMInstance(self::PLUGIN)->prefix), |
| 4603 |
"Nigeria" => __("Nigeria", WDFMInstance(self::PLUGIN)->prefix), |
| 4604 |
"Norway" => __("Norway", WDFMInstance(self::PLUGIN)->prefix), |
| 4605 |
"Oman" => __("Oman", WDFMInstance(self::PLUGIN)->prefix), |
| 4606 |
"Pakistan" => __("Pakistan", WDFMInstance(self::PLUGIN)->prefix), |
| 4607 |
"Palau" => __("Palau", WDFMInstance(self::PLUGIN)->prefix), |
| 4608 |
"Palestine" => __("Palestine", WDFMInstance(self::PLUGIN)->prefix), |
| 4609 |
"Panama" => __("Panama", WDFMInstance(self::PLUGIN)->prefix), |
| 4610 |
"Papua New Guinea" => __("Papua New Guinea", WDFMInstance(self::PLUGIN)->prefix), |
| 4611 |
"Paraguay" => __("Paraguay", WDFMInstance(self::PLUGIN)->prefix), |
| 4612 |
"Peru" => __("Peru", WDFMInstance(self::PLUGIN)->prefix), |
| 4613 |
"Philippines" => __("Philippines", WDFMInstance(self::PLUGIN)->prefix), |
| 4614 |
"Poland" => __("Poland", WDFMInstance(self::PLUGIN)->prefix), |
| 4615 |
"Portugal" => __("Portugal", WDFMInstance(self::PLUGIN)->prefix), |
| 4616 |
"Puerto Rico" => __("Puerto Rico", WDFMInstance(self::PLUGIN)->prefix), |
| 4617 |
"Qatar" => __("Qatar", WDFMInstance(self::PLUGIN)->prefix), |
| 4618 |
"Romania" => __("Romania", WDFMInstance(self::PLUGIN)->prefix), |
| 4619 |
"Russia" => __("Russia", WDFMInstance(self::PLUGIN)->prefix), |
| 4620 |
"Rwanda" => __("Rwanda", WDFMInstance(self::PLUGIN)->prefix), |
| 4621 |
"Saint Kitts and Nevis" => __("Saint Kitts and Nevis", WDFMInstance(self::PLUGIN)->prefix), |
| 4622 |
"Saint Lucia" => __("Saint Lucia", WDFMInstance(self::PLUGIN)->prefix), |
| 4623 |
"Saint Vincent" => __("Saint Vincent", WDFMInstance(self::PLUGIN)->prefix), |
| 4624 |
"Samoa" => __("Samoa", WDFMInstance(self::PLUGIN)->prefix), |
| 4625 |
"San Marino" => __("San Marino", WDFMInstance(self::PLUGIN)->prefix), |
| 4626 |
"Sao Tome and Principe" => __("Sao Tome and Principe", WDFMInstance(self::PLUGIN)->prefix), |
| 4627 |
"Saudi Arabia" => __("Saudi Arabia", WDFMInstance(self::PLUGIN)->prefix), |
| 4628 |
"Senegal" => __("Senegal", WDFMInstance(self::PLUGIN)->prefix), |
| 4629 |
"Serbia" => __("Serbia", WDFMInstance(self::PLUGIN)->prefix), |
| 4630 |
"Montenegro" => __("Montenegro", WDFMInstance(self::PLUGIN)->prefix), |
| 4631 |
"Seychelles" => __("Seychelles", WDFMInstance(self::PLUGIN)->prefix), |
| 4632 |
"Sierra Leone" => __("Sierra Leone", WDFMInstance(self::PLUGIN)->prefix), |
| 4633 |
"Singapore" => __("Singapore", WDFMInstance(self::PLUGIN)->prefix), |
| 4634 |
"Slovakia" => __("Slovakia", WDFMInstance(self::PLUGIN)->prefix), |
| 4635 |
"Slovenia" => __("Slovenia", WDFMInstance(self::PLUGIN)->prefix), |
| 4636 |
"Solomon Islands" => __("Solomon Islands", WDFMInstance(self::PLUGIN)->prefix), |
| 4637 |
"Somalia" => __("Somalia", WDFMInstance(self::PLUGIN)->prefix), |
| 4638 |
"South Africa" => __("South Africa", WDFMInstance(self::PLUGIN)->prefix), |
| 4639 |
"Spain" => __("Spain", WDFMInstance(self::PLUGIN)->prefix), |
| 4640 |
"Sri Lanka" => __("Sri Lanka", WDFMInstance(self::PLUGIN)->prefix), |
| 4641 |
"Sudan" => __("Sudan", WDFMInstance(self::PLUGIN)->prefix), |
| 4642 |
"Suriname" => __("Suriname", WDFMInstance(self::PLUGIN)->prefix), |
| 4643 |
"Eswatini" => __("Eswatini", WDFMInstance(self::PLUGIN)->prefix), |
| 4644 |
"Sweden" => __("Sweden", WDFMInstance(self::PLUGIN)->prefix), |
| 4645 |
"Switzerland" => __("Switzerland", WDFMInstance(self::PLUGIN)->prefix), |
| 4646 |
"Syria" => __("Syria", WDFMInstance(self::PLUGIN)->prefix), |
| 4647 |
"Taiwan" => __("Taiwan", WDFMInstance(self::PLUGIN)->prefix), |
| 4648 |
"Tajikistan" => __("Tajikistan", WDFMInstance(self::PLUGIN)->prefix), |
| 4649 |
"Tanzania" => __("Tanzania", WDFMInstance(self::PLUGIN)->prefix), |
| 4650 |
"Thailand" => __("Thailand", WDFMInstance(self::PLUGIN)->prefix), |
| 4651 |
"Togo" => __("Togo", WDFMInstance(self::PLUGIN)->prefix), |
| 4652 |
"Tonga" => __("Tonga", WDFMInstance(self::PLUGIN)->prefix), |
| 4653 |
"Trinidad and Tobago" => __("Trinidad and Tobago", WDFMInstance(self::PLUGIN)->prefix), |
| 4654 |
"Tunisia" => __("Tunisia", WDFMInstance(self::PLUGIN)->prefix), |
| 4655 |
"Turkey" => __("Turkey", WDFMInstance(self::PLUGIN)->prefix), |
| 4656 |
"Turkmenistan" => __("Turkmenistan", WDFMInstance(self::PLUGIN)->prefix), |
| 4657 |
"Tuvalu" => __("Tuvalu", WDFMInstance(self::PLUGIN)->prefix), |
| 4658 |
"Uganda" => __("Uganda", WDFMInstance(self::PLUGIN)->prefix), |
| 4659 |
"Ukraine" => __("Ukraine", WDFMInstance(self::PLUGIN)->prefix), |
| 4660 |
"United Arab Emirates" => __("United Arab Emirates", WDFMInstance(self::PLUGIN)->prefix), |
| 4661 |
"United Kingdom" => __("United Kingdom", WDFMInstance(self::PLUGIN)->prefix), |
| 4662 |
"United States" => __("United States", WDFMInstance(self::PLUGIN)->prefix), |
| 4663 |
"Uruguay" => __("Uruguay", WDFMInstance(self::PLUGIN)->prefix), |
| 4664 |
"Uzbekistan" => __("Uzbekistan", WDFMInstance(self::PLUGIN)->prefix), |
| 4665 |
"Vanuatu" => __("Vanuatu", WDFMInstance(self::PLUGIN)->prefix), |
| 4666 |
"Vatican City" => __("Vatican City", WDFMInstance(self::PLUGIN)->prefix), |
| 4667 |
"Venezuela" => __("Venezuela", WDFMInstance(self::PLUGIN)->prefix), |
| 4668 |
"Vietnam" => __("Vietnam", WDFMInstance(self::PLUGIN)->prefix), |
| 4669 |
"Wales" => __("Wales", WDFMInstance(self::PLUGIN)->prefix), |
| 4670 |
"Yemen" => __("Yemen", WDFMInstance(self::PLUGIN)->prefix), |
| 4671 |
"Zambia" => __("Zambia", WDFMInstance(self::PLUGIN)->prefix), |
| 4672 |
"Zimbabwe" => __("Zimbabwe", WDFMInstance(self::PLUGIN)->prefix), |
| 4673 |
); |
| 4674 |
asort( $countries ); |
| 4675 |
return $countries; |
| 4676 |
} |
| 4677 |
|
| 4678 |
/** |
| 4679 |
* Get states list. |
| 4680 |
* |
| 4681 |
* @return array |
| 4682 |
*/ |
| 4683 |
public static function get_states() { |
| 4684 |
$states = array( |
| 4685 |
"" => "", |
| 4686 |
"Alabama" => __("Alabama", WDFMInstance(self::PLUGIN)->prefix), |
| 4687 |
"Alaska" => __("Alaska", WDFMInstance(self::PLUGIN)->prefix), |
| 4688 |
"Arizona" => __("Arizona", WDFMInstance(self::PLUGIN)->prefix), |
| 4689 |
"Arkansas" => __("Arkansas", WDFMInstance(self::PLUGIN)->prefix), |
| 4690 |
"California" => __("California", WDFMInstance(self::PLUGIN)->prefix), |
| 4691 |
"Colorado" => __("Colorado", WDFMInstance(self::PLUGIN)->prefix), |
| 4692 |
"Connecticut" => __("Connecticut", WDFMInstance(self::PLUGIN)->prefix), |
| 4693 |
"Delaware" => __("Delaware", WDFMInstance(self::PLUGIN)->prefix), |
| 4694 |
"District Of Columbia" => __("District Of Columbia", WDFMInstance(self::PLUGIN)->prefix), |
| 4695 |
"Florida" => __("Florida", WDFMInstance(self::PLUGIN)->prefix), |
| 4696 |
"Georgia" => __("Georgia", WDFMInstance(self::PLUGIN)->prefix), |
| 4697 |
"Hawaii" => __("Hawaii", WDFMInstance(self::PLUGIN)->prefix), |
| 4698 |
"Idaho" => __("Idaho", WDFMInstance(self::PLUGIN)->prefix), |
| 4699 |
"Illinois" => __("Illinois", WDFMInstance(self::PLUGIN)->prefix), |
| 4700 |
"Indiana" => __("Indiana", WDFMInstance(self::PLUGIN)->prefix), |
| 4701 |
"Iowa" => __("Iowa", WDFMInstance(self::PLUGIN)->prefix), |
| 4702 |
"Kansas" => __("Kansas", WDFMInstance(self::PLUGIN)->prefix), |
| 4703 |
"Kentucky" => __("Kentucky", WDFMInstance(self::PLUGIN)->prefix), |
| 4704 |
"Louisiana" => __("Louisiana", WDFMInstance(self::PLUGIN)->prefix), |
| 4705 |
"Maine" => __("Maine", WDFMInstance(self::PLUGIN)->prefix), |
| 4706 |
"Maryland" => __("Maryland", WDFMInstance(self::PLUGIN)->prefix), |
| 4707 |
"Massachusetts" => __("Massachusetts", WDFMInstance(self::PLUGIN)->prefix), |
| 4708 |
"Michigan" => __("Michigan", WDFMInstance(self::PLUGIN)->prefix), |
| 4709 |
"Minnesota" => __("Minnesota", WDFMInstance(self::PLUGIN)->prefix), |
| 4710 |
"Mississippi" => __("Mississippi", WDFMInstance(self::PLUGIN)->prefix), |
| 4711 |
"Missouri" => __("Missouri", WDFMInstance(self::PLUGIN)->prefix), |
| 4712 |
"Montana" => __("Montana", WDFMInstance(self::PLUGIN)->prefix), |
| 4713 |
"Nebraska" => __("Nebraska", WDFMInstance(self::PLUGIN)->prefix), |
| 4714 |
"Nevada" => __("Nevada", WDFMInstance(self::PLUGIN)->prefix), |
| 4715 |
"New Hampshire" => __("New Hampshire", WDFMInstance(self::PLUGIN)->prefix), |
| 4716 |
"New Jersey" => __("New Jersey", WDFMInstance(self::PLUGIN)->prefix), |
| 4717 |
"New Mexico" => __("New Mexico", WDFMInstance(self::PLUGIN)->prefix), |
| 4718 |
"New York" => __("New York", WDFMInstance(self::PLUGIN)->prefix), |
| 4719 |
"North Carolina" => __("North Carolina", WDFMInstance(self::PLUGIN)->prefix), |
| 4720 |
"North Dakota" => __("North Dakota", WDFMInstance(self::PLUGIN)->prefix), |
| 4721 |
"Ohio" => __("Ohio", WDFMInstance(self::PLUGIN)->prefix), |
| 4722 |
"Oklahoma" => __("Oklahoma", WDFMInstance(self::PLUGIN)->prefix), |
| 4723 |
"Oregon" => __("Oregon", WDFMInstance(self::PLUGIN)->prefix), |
| 4724 |
"Pennsylvania" => __("Pennsylvania", WDFMInstance(self::PLUGIN)->prefix), |
| 4725 |
"Rhode Island" => __("Rhode Island", WDFMInstance(self::PLUGIN)->prefix), |
| 4726 |
"South Carolina" => __("South Carolina", WDFMInstance(self::PLUGIN)->prefix), |
| 4727 |
"South Dakota" => __("South Dakota", WDFMInstance(self::PLUGIN)->prefix), |
| 4728 |
"Tennessee" => __("Tennessee", WDFMInstance(self::PLUGIN)->prefix), |
| 4729 |
"Texas" => __("Texas", WDFMInstance(self::PLUGIN)->prefix), |
| 4730 |
"Utah" => __("Utah", WDFMInstance(self::PLUGIN)->prefix), |
| 4731 |
"Vermont" => __("Vermont", WDFMInstance(self::PLUGIN)->prefix), |
| 4732 |
"Virginia" => __("Virginia", WDFMInstance(self::PLUGIN)->prefix), |
| 4733 |
"Washington" => __("Washington", WDFMInstance(self::PLUGIN)->prefix), |
| 4734 |
"West Virginia" => __("West Virginia", WDFMInstance(self::PLUGIN)->prefix), |
| 4735 |
"Wisconsin" => __("Wisconsin", WDFMInstance(self::PLUGIN)->prefix), |
| 4736 |
"Wyoming" => __("Wyoming", WDFMInstance(self::PLUGIN)->prefix), |
| 4737 |
); |
| 4738 |
asort( $states ); |
| 4739 |
return $states; |
| 4740 |
} |
| 4741 |
|
| 4742 |
/** |
| 4743 |
* Get Canada states list. |
| 4744 |
* |
| 4745 |
* @return array |
| 4746 |
*/ |
| 4747 |
public function get_provinces_canada() { |
| 4748 |
$province = array( |
| 4749 |
"" => "", |
| 4750 |
"Alberta" => __("Alberta", WDFMInstance(self::PLUGIN)->prefix), |
| 4751 |
"British Columbia" => __("British Columbia", WDFMInstance(self::PLUGIN)->prefix), |
| 4752 |
"Manitoba" => __("Manitoba", WDFMInstance(self::PLUGIN)->prefix), |
| 4753 |
"New Brunswick" => __("New Brunswick", WDFMInstance(self::PLUGIN)->prefix), |
| 4754 |
"Newfoundland and Labrador" => __("Newfoundland and Labrador", WDFMInstance(self::PLUGIN)->prefix), |
| 4755 |
"Northwest Territories" => __("Northwest Territories", WDFMInstance(self::PLUGIN)->prefix), |
| 4756 |
"Nova Scotia" => __("Nova Scotia", WDFMInstance(self::PLUGIN)->prefix), |
| 4757 |
"Nunavut" => __("Nunavut", WDFMInstance(self::PLUGIN)->prefix), |
| 4758 |
"Ontario" => __("Ontario", WDFMInstance(self::PLUGIN)->prefix), |
| 4759 |
"Prince Edward Island" => __("Prince Edward Island", WDFMInstance(self::PLUGIN)->prefix), |
| 4760 |
"Quebec" => __("Quebec", WDFMInstance(self::PLUGIN)->prefix), |
| 4761 |
"Saskatchewan" => __("Saskatchewan", WDFMInstance(self::PLUGIN)->prefix), |
| 4762 |
"Yukon" => __("Yukon", WDFMInstance(self::PLUGIN)->prefix), |
| 4763 |
); |
| 4764 |
asort( $province ); |
| 4765 |
return $province; |
| 4766 |
} |
| 4767 |
|
| 4768 |
/** |
| 4769 |
* Localize ui datepicker. |
| 4770 |
* |
| 4771 |
* @return string |
| 4772 |
*/ |
| 4773 |
public static function localize_ui_datepicker() { |
| 4774 |
return 'jQuery(document).ready(function(jQuery){ |
| 4775 |
jQuery.datepicker.setDefaults( { |
| 4776 |
"closeText":"' . __('Done', WDFMInstance(self::PLUGIN)->prefix) . '", |
| 4777 |
"prevText":"' . __('Prev', WDFMInstance(self::PLUGIN)->prefix) . '", |
| 4778 |
"nextText":"' . __('Next', WDFMInstance(self::PLUGIN)->prefix) . '", |
| 4779 |
"currentText":"' . __('Today', WDFMInstance(self::PLUGIN)->prefix) . '", |
| 4780 |
"monthNames":["' . __('January', WDFMInstance(self::PLUGIN)->prefix) . '","' . __('February', WDFMInstance(self::PLUGIN)->prefix) . '","' . __('March', WDFMInstance(self::PLUGIN)->prefix) . '","' . __('April', WDFMInstance(self::PLUGIN)->prefix) . '","' . __('May', WDFMInstance(self::PLUGIN)->prefix) . '","' . __('June', WDFMInstance(self::PLUGIN)->prefix) . '","' . __('July', WDFMInstance(self::PLUGIN)->prefix) . '","' . __('August', WDFMInstance(self::PLUGIN)->prefix) . '","' . __('September', WDFMInstance(self::PLUGIN)->prefix) . '","' . __('October', WDFMInstance(self::PLUGIN)->prefix) . '","' . __('November', WDFMInstance(self::PLUGIN)->prefix) . '","' . __('December', WDFMInstance(self::PLUGIN)->prefix) . '"], |
| 4781 |
"monthNamesShort":["' . __('Jan', WDFMInstance(self::PLUGIN)->prefix) . '","' . __('Feb', WDFMInstance(self::PLUGIN)->prefix) . '","' . __('Mar', WDFMInstance(self::PLUGIN)->prefix) . '","' . __('Apr', WDFMInstance(self::PLUGIN)->prefix) . '","' . __('May', WDFMInstance(self::PLUGIN)->prefix) . '","' . __('Jun', WDFMInstance(self::PLUGIN)->prefix) . '","' . __('Jul', WDFMInstance(self::PLUGIN)->prefix) . '","' . __('Aug', WDFMInstance(self::PLUGIN)->prefix) . '","' . __('Sep', WDFMInstance(self::PLUGIN)->prefix) . '","' . __('Oct', WDFMInstance(self::PLUGIN)->prefix) . '","' . __('Nov', WDFMInstance(self::PLUGIN)->prefix) . '","' . __('Dec', WDFMInstance(self::PLUGIN)->prefix) . '"], |
| 4782 |
"dayNames":["' . __('Sunday', WDFMInstance(self::PLUGIN)->prefix) . '","' . __('Monday', WDFMInstance(self::PLUGIN)->prefix) . '","' . __('Tuesday', WDFMInstance(self::PLUGIN)->prefix) . '","' . __('Wednesday', WDFMInstance(self::PLUGIN)->prefix) . '","' . __('Thursday', WDFMInstance(self::PLUGIN)->prefix) . '","' . __('Friday', WDFMInstance(self::PLUGIN)->prefix) . '","' . __('Saturday', WDFMInstance(self::PLUGIN)->prefix) . '"], |
| 4783 |
"dayNamesShort":["' . __('Sun', WDFMInstance(self::PLUGIN)->prefix) . '","' . __('Mon', WDFMInstance(self::PLUGIN)->prefix) . '","' . __('Tue', WDFMInstance(self::PLUGIN)->prefix) . '","' . __('Wed', WDFMInstance(self::PLUGIN)->prefix) . '","' . __('Thu', WDFMInstance(self::PLUGIN)->prefix) . '","' . __('Fri', WDFMInstance(self::PLUGIN)->prefix) . '","' . __('Sat', WDFMInstance(self::PLUGIN)->prefix) . '"], |
| 4784 |
"dayNamesMin":["' . __('Su', WDFMInstance(self::PLUGIN)->prefix) . '","' . __('Mo', WDFMInstance(self::PLUGIN)->prefix) . '","' . __('Tu', WDFMInstance(self::PLUGIN)->prefix) . '","' . __('We', WDFMInstance(self::PLUGIN)->prefix) . '","' . __('Th', WDFMInstance(self::PLUGIN)->prefix) . '","' . __('Fr', WDFMInstance(self::PLUGIN)->prefix) . '","' . __('Sa', WDFMInstance(self::PLUGIN)->prefix) . '"] |
| 4785 |
}); |
| 4786 |
})'; |
| 4787 |
} |
| 4788 |
|
| 4789 |
/** |
| 4790 |
* Forbidden template. |
| 4791 |
* |
| 4792 |
* @return string |
| 4793 |
*/ |
| 4794 |
public static function forbidden_template() { |
| 4795 |
return '<!DOCTYPE html> |
| 4796 |
<html> |
| 4797 |
<head> |
| 4798 |
<title>403 Forbidden</title> |
| 4799 |
</head> |
| 4800 |
<body> |
| 4801 |
<p>Directory access is forbidden.</p> |
| 4802 |
</body> |
| 4803 |
</html>'; |
| 4804 |
} |
| 4805 |
|
| 4806 |
/** |
| 4807 |
* Sanitize parameters and send email. |
| 4808 |
* |
| 4809 |
* @param string $recipient |
| 4810 |
* @param string $subject |
| 4811 |
* @param string $message |
| 4812 |
* @param array $header_arr |
| 4813 |
* @param array $attachment |
| 4814 |
* |
| 4815 |
* @return bool |
| 4816 |
*/ |
| 4817 |
public static function mail($recipient, $subject, $message = '', $header_arr = array(), $attachment = array()) { |
| 4818 |
$recipient = trim($recipient, ','); |
| 4819 |
$recipient = explode(',', $recipient); |
| 4820 |
$recipient = array_map('trim', $recipient); |
| 4821 |
if ( empty($recipient) ) { |
| 4822 |
return FALSE; |
| 4823 |
} |
| 4824 |
|
| 4825 |
if ( function_exists('mb_internal_encoding') ) { |
| 4826 |
mb_internal_encoding('UTF-8'); |
| 4827 |
} |
| 4828 |
|
| 4829 |
$subject = html_entity_decode($subject, ENT_QUOTES); |
| 4830 |
$subject = stripslashes($subject); |
| 4831 |
if ( function_exists('mb_encode_mimeheader') ) { |
| 4832 |
$subject = mb_encode_mimeheader($subject, 'UTF-8', 'Q'); |
| 4833 |
} |
| 4834 |
|
| 4835 |
$message = stripslashes($message); |
| 4836 |
// $message = self::encodeQuotedPrintable($message); |
| 4837 |
|
| 4838 |
$headers = array(); |
| 4839 |
|
| 4840 |
// $headers[] = 'Content-Transfer-Encoding: QUOTED-PRINTABLE'; |
| 4841 |
|
| 4842 |
if ( isset($header_arr['from_name']) && $header_arr['from_name'] ) { |
| 4843 |
$from_name = $header_arr['from_name']; |
| 4844 |
$from_name = html_entity_decode($from_name, ENT_QUOTES); |
| 4845 |
$from_name = stripslashes($from_name); |
| 4846 |
if ( function_exists('mb_encode_mimeheader') ) { |
| 4847 |
$from_name = mb_encode_mimeheader($from_name, 'UTF-8', 'Q'); |
| 4848 |
} |
| 4849 |
// $from_str .= "'" . $from_name . "' "; |
| 4850 |
self::$email_from_name = $from_name; |
| 4851 |
add_filter('wp_mail_from_name', array('WDW_FM_Library', 'mail_from_name')); |
| 4852 |
} |
| 4853 |
|
| 4854 |
if ( isset($header_arr['from']) && $header_arr['from'] ) { |
| 4855 |
$from = $header_arr['from']; |
| 4856 |
$from = trim($from); |
| 4857 |
$from = trim($from, ','); |
| 4858 |
// $from_str = "From: "; |
| 4859 |
|
| 4860 |
// $from_str .= "<" . $from . ">"; |
| 4861 |
// $headers[] = $from_str; |
| 4862 |
self::$email_from = $from; |
| 4863 |
add_filter('wp_mail_from', array('WDW_FM_Library', 'mail_from')); |
| 4864 |
} |
| 4865 |
|
| 4866 |
if ( isset($header_arr['content_type']) && $header_arr['content_type'] ) { |
| 4867 |
// $headers[] = "Content-Type: " . $header_arr['content_type']; |
| 4868 |
self::$email_content_type = $header_arr['content_type']; |
| 4869 |
add_filter('wp_mail_content_type', array('WDW_FM_Library', 'mail_content_type')); |
| 4870 |
} |
| 4871 |
|
| 4872 |
if ( isset($header_arr['charset']) && $header_arr['charset'] ) { |
| 4873 |
// $headers[] = $header_arr['charset']; |
| 4874 |
self::$email_charset = $header_arr['charset']; |
| 4875 |
add_filter('wp_mail_charset', array('WDW_FM_Library', 'mail_charset')); |
| 4876 |
} |
| 4877 |
|
| 4878 |
if ( isset($header_arr['reply_to']) && $header_arr['reply_to'] ) { |
| 4879 |
$reply_to = $header_arr['reply_to']; |
| 4880 |
$reply_to = trim($reply_to); |
| 4881 |
$reply_to = trim($reply_to, ','); |
| 4882 |
$headers[] = "Reply-To: <" . $reply_to . ">"; |
| 4883 |
} |
| 4884 |
|
| 4885 |
if ( isset($header_arr['cc']) && $header_arr['cc'] ) { |
| 4886 |
$cc = $header_arr['cc']; |
| 4887 |
$cc = trim($cc); |
| 4888 |
$cc = trim($cc, ','); |
| 4889 |
$headers[] = "Cc: " . $cc; |
| 4890 |
} |
| 4891 |
|
| 4892 |
if ( isset($header_arr['bcc']) && $header_arr['bcc'] ) { |
| 4893 |
$bcc = $header_arr['bcc']; |
| 4894 |
$bcc = trim($bcc); |
| 4895 |
$bcc = trim($bcc, ','); |
| 4896 |
$headers[] = "Bcc: " . $bcc; |
| 4897 |
} |
| 4898 |
|
| 4899 |
$sent = wp_mail($recipient, $subject, $message, $headers, $attachment); |
| 4900 |
|
| 4901 |
remove_filter('wp_mail_content_type', array('WDW_FM_Library', 'mail_content_type')); |
| 4902 |
remove_filter('wp_mail_charset', array('WDW_FM_Library', 'mail_charset')); |
| 4903 |
remove_filter('wp_mail_from', array('WDW_FM_Library', 'mail_from')); |
| 4904 |
remove_filter('wp_mail_from_name', array('WDW_FM_Library', 'mail_from_name')); |
| 4905 |
|
| 4906 |
return $sent; |
| 4907 |
} |
| 4908 |
|
| 4909 |
public static $email_content_type; |
| 4910 |
public static $email_charset; |
| 4911 |
public static $email_from; |
| 4912 |
public static $email_from_name; |
| 4913 |
public static function mail_content_type() { |
| 4914 |
return self::$email_content_type; |
| 4915 |
} |
| 4916 |
|
| 4917 |
public static function mail_charset() { |
| 4918 |
return self::$email_charset; |
| 4919 |
} |
| 4920 |
|
| 4921 |
public static function mail_from() { |
| 4922 |
return self::$email_from; |
| 4923 |
} |
| 4924 |
public static function mail_from_name() { |
| 4925 |
return self::$email_from_name; |
| 4926 |
} |
| 4927 |
|
| 4928 |
/** |
| 4929 |
* Get labels parameters. |
| 4930 |
* |
| 4931 |
* @param int $form_id |
| 4932 |
* @param int $page_num |
| 4933 |
* @param int $per_num |
| 4934 |
* |
| 4935 |
* @return array $labels_parameters |
| 4936 |
*/ |
| 4937 |
public static function get_labels_parameters($form_id, $page_num = 0, $per_num = 0) { |
| 4938 |
global $wpdb; |
| 4939 |
$labels = array(); |
| 4940 |
$labels_id = array(); |
| 4941 |
$form_labels = array(); |
| 4942 |
$sorted_labels_id = array(); |
| 4943 |
$label_names = array(); |
| 4944 |
$label_types = array(); |
| 4945 |
$sorted_label_types = array(); |
| 4946 |
$label_names_original = array(); |
| 4947 |
$labels_parameters = array(); |
| 4948 |
$join_query = array(); |
| 4949 |
$join_where = array(); |
| 4950 |
$join_verified = array(); |
| 4951 |
$rows_ord = array(); |
| 4952 |
$join = ''; |
| 4953 |
$query = $wpdb->prepare("SELECT `group_id`,`element_value` FROM " . $wpdb->prefix . "formmaker_submits WHERE `form_id`='%d' and `element_label` = 'verifyinfo' ", $form_id); |
| 4954 |
$ver_emails_data = $wpdb->get_results($query); |
| 4955 |
$ver_emails_array = array(); |
| 4956 |
if ( $ver_emails_data ) { |
| 4957 |
foreach ( $ver_emails_data as $ver_email ) { |
| 4958 |
$elem_label = str_replace('verified**', '', $ver_email->element_value); |
| 4959 |
$query = $wpdb->prepare("SELECT `element_value` FROM " . $wpdb->prefix . "formmaker_submits WHERE `form_id`='%d' AND `group_id` = '%d' AND `element_label` = '%s' ", $form_id, (int) $ver_email->group_id, $elem_label); |
| 4960 |
if ( !isset($ver_emails_array[$elem_label]) ) { |
| 4961 |
$ver_emails_array[$elem_label] = array(); |
| 4962 |
} |
| 4963 |
if ( !in_array($wpdb->get_var($query), $ver_emails_array[$elem_label]) ) { |
| 4964 |
$ver_emails_array[$elem_label][] = $wpdb->get_var($query); |
| 4965 |
} |
| 4966 |
} |
| 4967 |
} |
| 4968 |
for ( $i = 0; $i < 9; $i++ ) { |
| 4969 |
array_push($labels_parameters, NULL); |
| 4970 |
} |
| 4971 |
$sorted_label_names = array(); |
| 4972 |
$sorted_label_names_original = array(); |
| 4973 |
$where_labels = array(); |
| 4974 |
$where2 = array(); |
| 4975 |
$order_by = ((isset($_POST['order_by']) && esc_html(stripslashes($_POST['order_by'])) != '') ? esc_html(stripslashes($_POST['order_by'])) : 'group_id'); |
| 4976 |
$asc_or_desc = ((isset($_POST['asc_or_desc']) && $_POST['asc_or_desc'] == 'asc') ? 'asc' : 'desc'); |
| 4977 |
|
| 4978 |
$lists['hide_label_list'] = ((isset($_POST['hide_label_list'])) ? esc_html(stripslashes($_POST['hide_label_list'])) : ''); |
| 4979 |
$lists['startdate'] = ((isset($_POST['startdate'])) ? esc_html(stripslashes($_POST['startdate'])) : ''); |
| 4980 |
$lists['enddate'] = ((isset($_POST['enddate'])) ? esc_html(stripslashes($_POST['enddate'])) : ''); |
| 4981 |
$lists['ip_search'] = ((isset($_POST['ip_search'])) ? esc_html(stripslashes($_POST['ip_search'])) : ''); |
| 4982 |
$lists['username_search'] = ((isset($_POST['username_search'])) ? esc_html(stripslashes($_POST['username_search'])) : ''); |
| 4983 |
$lists['useremail_search'] = ((isset($_POST['useremail_search'])) ? esc_html(stripslashes($_POST['useremail_search'])) : ''); |
| 4984 |
$lists['id_search'] = ((isset($_POST['id_search'])) ? esc_html(stripslashes($_POST['id_search'])) : ''); |
| 4985 |
if ( $lists['ip_search'] ) { |
| 4986 |
$where[] = 'ip LIKE "%' . $lists['ip_search'] . '%"'; |
| 4987 |
} |
| 4988 |
if ( $lists['startdate'] != '' ) { |
| 4989 |
$where[] = " `date`>='" . $lists['startdate'] . " 00:00:00' "; |
| 4990 |
} |
| 4991 |
if ( $lists['enddate'] != '' ) { |
| 4992 |
$where[] = " `date`<='" . $lists['enddate'] . " 23:59:59' "; |
| 4993 |
} |
| 4994 |
if ( $lists['username_search'] ) { |
| 4995 |
$where[] = 'user_id_wd IN (SELECT ID FROM ' . $wpdb->prefix . 'users WHERE display_name LIKE "%' . $lists['username_search'] . '%")'; |
| 4996 |
} |
| 4997 |
if ( $lists['useremail_search'] ) { |
| 4998 |
$where[] = 'user_id_wd IN (SELECT ID FROM ' . $wpdb->prefix . 'users WHERE user_email LIKE "%' . $lists['useremail_search'] . '%")'; |
| 4999 |
} |
| 5000 |
if ( $lists['id_search'] ) { |
| 5001 |
$where[] = 'group_id =' . (int) $lists['id_search']; |
| 5002 |
} |
| 5003 |
$where[] = 'form_id=' . $form_id . ''; |
| 5004 |
$where = (count($where) ? ' ' . implode(' AND ', $where) : ''); |
| 5005 |
if ( $order_by == 'group_id' or $order_by == 'date' or $order_by == 'ip' ) { |
| 5006 |
$orderby = ' ORDER BY ' . $order_by . ' ' . $asc_or_desc . ''; |
| 5007 |
} |
| 5008 |
elseif ( $order_by == 'display_name' or $order_by == 'user_email' ) { |
| 5009 |
$orderby = ' ORDER BY (SELECT ' . $order_by . ' FROM ' . $wpdb->prefix . 'users WHERE ID=user_id_wd) ' . $asc_or_desc . ''; |
| 5010 |
} |
| 5011 |
else { |
| 5012 |
$orderby = ""; |
| 5013 |
} |
| 5014 |
if ( $form_id ) { |
| 5015 |
for ( $i = 0; $i < 9; $i++ ) { |
| 5016 |
array_pop($labels_parameters); |
| 5017 |
} |
| 5018 |
$query = "SELECT distinct element_label FROM " . $wpdb->prefix . "formmaker_submits WHERE " . $where; |
| 5019 |
$results = $wpdb->get_results($query); |
| 5020 |
for ( $i = 0; $i < count($results); $i++ ) { |
| 5021 |
array_push($labels, $results[$i]->element_label); |
| 5022 |
} |
| 5023 |
$form = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "formmaker WHERE id='%d'", $form_id)); |
| 5024 |
if ( !empty($form->label_order) && strpos($form->label_order, 'type_paypal_') ) { |
| 5025 |
$form->label_order = $form->label_order . "item_total#**id**#Item Total#**label**#type_paypal_payment_total#****#total#**id**#Total#**label**#type_paypal_payment_total#****#0#**id**#Payment Status#**label**#type_paypal_payment_status#****#"; |
| 5026 |
} |
| 5027 |
if ( !empty($form->label_order)) { |
| 5028 |
$form_labels = explode('#****#', $form->label_order); |
| 5029 |
} |
| 5030 |
$form_labels = array_slice($form_labels, 0, count($form_labels) - 1); |
| 5031 |
foreach ( $form_labels as $key => $form_label ) { |
| 5032 |
$label_id = explode('#**id**#', $form_label); |
| 5033 |
array_push($labels_id, $label_id[0]); |
| 5034 |
$label_name_type = explode('#**label**#', $label_id[1]); |
| 5035 |
array_push($label_names_original, $label_name_type[0]); |
| 5036 |
$ptn = "/[^a-zA-Z0-9_]/"; |
| 5037 |
$rpltxt = ""; |
| 5038 |
$label_name = preg_replace($ptn, $rpltxt, $label_name_type[0]); |
| 5039 |
array_push($label_names, $label_name); |
| 5040 |
array_push($label_types, $label_name_type[1]); |
| 5041 |
} |
| 5042 |
foreach ( $labels_id as $key => $label_id ) { |
| 5043 |
if ( in_array($label_id, $labels) ) { |
| 5044 |
if ( !in_array($label_id, $sorted_labels_id) ) { |
| 5045 |
array_push($sorted_labels_id, $label_id); |
| 5046 |
} |
| 5047 |
array_push($sorted_label_names, $label_names[$key]); |
| 5048 |
array_push($sorted_label_types, $label_types[$key]); |
| 5049 |
array_push($sorted_label_names_original, $label_names_original[$key]); |
| 5050 |
if ( isset($_POST[$form_id . '_' . $label_id . '_search']) ) { |
| 5051 |
$search_temp = esc_html($_POST[$form_id . '_' . $label_id . '_search']); |
| 5052 |
} |
| 5053 |
else { |
| 5054 |
$search_temp = ''; |
| 5055 |
} |
| 5056 |
$search_temp = strtolower($search_temp); |
| 5057 |
$lists[$form_id . '_' . $label_id . '_search'] = $search_temp; |
| 5058 |
if ( $search_temp ) { |
| 5059 |
$join_query[] = 'search'; |
| 5060 |
$join_where[] = array( 'label' => $label_id, 'search' => $search_temp ); |
| 5061 |
} |
| 5062 |
if ( isset($_POST[$form_id . '_' . $label_id . '_search_verified']) ) { |
| 5063 |
$search_verified = $_POST[$form_id . '_' . $label_id . '_search_verified']; |
| 5064 |
$lists[$form_id . '_' . $label_id . '_search_verified'] = $search_verified; |
| 5065 |
} |
| 5066 |
else { |
| 5067 |
$search_verified = ''; |
| 5068 |
} |
| 5069 |
if ( $search_verified && isset($ver_emails_array[$label_id]) ) { |
| 5070 |
$join_query[] = 'search'; |
| 5071 |
$join_where[] = NULL; |
| 5072 |
$join_verified[] = array( |
| 5073 |
'label' => $label_id, |
| 5074 |
'ver_search' => implode('|', $ver_emails_array[$label_id]), |
| 5075 |
); |
| 5076 |
} |
| 5077 |
} |
| 5078 |
} |
| 5079 |
if ( strpos($order_by, "_field") ) { |
| 5080 |
if ( in_array(str_replace("_field", "", $order_by), $labels) ) { |
| 5081 |
$join_query[] = 'sort'; |
| 5082 |
$join_where[] = array( 'label' => str_replace("_field", "", $order_by) ); |
| 5083 |
} |
| 5084 |
} |
| 5085 |
$cols = 'group_id'; |
| 5086 |
if ( $order_by == 'date' or $order_by == 'ip' ) { |
| 5087 |
$cols = 'group_id, date, ip'; |
| 5088 |
} |
| 5089 |
$ver_where = ''; |
| 5090 |
if ( !empty($join_verified) ) { |
| 5091 |
foreach ( $join_verified as $key_ver => $join_ver ) { |
| 5092 |
$ver_where .= '(element_label="' . $join_ver['label'] . '" AND element_value REGEXP "' . $join_ver['ver_search'] . '" ) AND'; |
| 5093 |
} |
| 5094 |
} |
| 5095 |
switch ( count($join_query) ) { |
| 5096 |
case 0: |
| 5097 |
$join = 'SELECT distinct group_id FROM ' . $wpdb->prefix . 'formmaker_submits WHERE ' . $where; |
| 5098 |
break; |
| 5099 |
case 1: |
| 5100 |
if ( $join_query[0] == 'sort' ) { |
| 5101 |
$join = 'SELECT group_id FROM ' . $wpdb->prefix . 'formmaker_submits WHERE ' . $where . ' AND element_label="' . $join_where[0]['label'] . '" '; |
| 5102 |
$join_count = 'SELECT count(group_id) FROM ' . $wpdb->prefix . 'formmaker_submits WHERE form_id="' . $form_id . '" AND element_label="' . $join_where[0]['label'] . '" '; |
| 5103 |
$orderby = ' ORDER BY `element_value` ' . $asc_or_desc; |
| 5104 |
} |
| 5105 |
else { |
| 5106 |
if ( isset($join_where[0]['search']) ) { |
| 5107 |
$join = 'SELECT group_id FROM ' . $wpdb->prefix . 'formmaker_submits WHERE element_label="' . $join_where[0]['label'] . '" AND (element_value LIKE "%' . $join_where[0]['search'] . '%" OR element_value LIKE "%' . str_replace(' ', '@@@', $join_where[0]['search']) . '%") AND ' . $where; |
| 5108 |
} |
| 5109 |
else { |
| 5110 |
$join = 'SELECT group_id FROM ' . $wpdb->prefix . 'formmaker_submits WHERE ' . $ver_where . $where; |
| 5111 |
} |
| 5112 |
} |
| 5113 |
break; |
| 5114 |
default: |
| 5115 |
if ( !empty($join_verified) ) { |
| 5116 |
if ( isset($join_where[0]['search']) ) { |
| 5117 |
$join = 'SELECT t.group_id from (SELECT t1.group_id from (SELECT ' . $cols . ' FROM ' . $wpdb->prefix . 'formmaker_submits WHERE (element_label="' . $join_where[0]['label'] . '" AND (element_value LIKE "%' . $join_where[0]['search'] . '%" OR element_value LIKE "%' . str_replace(' ', '@@@', $join_where[0]['search']) . '%")) AND ' . $where . ' ) as t1 JOIN (SELECT group_id FROM ' . $wpdb->prefix . 'formmaker_submits WHERE ' . $ver_where . $where . ') as t2 ON t1.group_id = t2.group_id) as t '; |
| 5118 |
} |
| 5119 |
else { |
| 5120 |
$join = 'SELECT t.group_id FROM (SELECT ' . $cols . ' FROM ' . $wpdb->prefix . 'formmaker_submits WHERE ' . $ver_where . $where . ') as t '; |
| 5121 |
} |
| 5122 |
} |
| 5123 |
else { |
| 5124 |
$join = 'SELECT t.group_id FROM (SELECT ' . $cols . ' FROM ' . $wpdb->prefix . 'formmaker_submits WHERE ' . $where . ' AND element_label="' . $join_where[0]['label'] . '" AND (element_value LIKE "%' . $join_where[0]['search'] . '%" OR element_value LIKE "%' . str_replace(' ', '@@@', $join_where[0]['search']) . '%" )) as t '; |
| 5125 |
} |
| 5126 |
for ( $key = 1; $key < count($join_query); $key++ ) { |
| 5127 |
if ( $join_query[$key] == 'sort' ) { |
| 5128 |
if ( isset($join_where[$key]) ) { |
| 5129 |
$join .= 'LEFT JOIN (SELECT group_id as group_id' . $key . ', element_value FROM ' . $wpdb->prefix . 'formmaker_submits WHERE ' . $where . ' AND element_label="' . $join_where[$key]['label'] . '") as t' . $key . ' ON t' . $key . '.group_id' . $key . '=t.group_id '; |
| 5130 |
$orderby = ' ORDER BY t' . $key . '.`element_value` ' . $asc_or_desc . ''; |
| 5131 |
} |
| 5132 |
} |
| 5133 |
else { |
| 5134 |
if ( isset($join_where[$key]) ) { |
| 5135 |
$join .= 'INNER JOIN (SELECT group_id as group_id' . $key . ' FROM ' . $wpdb->prefix . 'formmaker_submits WHERE ' . $where . ' AND element_label="' . $join_where[$key]['label'] . '" AND (element_value LIKE "%' . $join_where[$key]['search'] . '%" OR element_value LIKE "%' . str_replace(' ', '@@@', $join_where[$key]['search']) . '%")) as t' . $key . ' ON t' . $key . '.group_id' . $key . '=t.group_id '; |
| 5136 |
} |
| 5137 |
} |
| 5138 |
} |
| 5139 |
break; |
| 5140 |
} |
| 5141 |
$pos = strpos($join, 'SELECT t.group_id'); |
| 5142 |
if ( $pos === FALSE ) { |
| 5143 |
$query = str_replace(array( |
| 5144 |
'SELECT group_id', |
| 5145 |
'SELECT distinct group_id', |
| 5146 |
), array( 'SELECT count(distinct group_id)', 'SELECT count(distinct group_id)' ), $join); |
| 5147 |
} |
| 5148 |
else { |
| 5149 |
$query = str_replace('SELECT t.group_id', 'SELECT count(t.group_id)', $join); |
| 5150 |
} |
| 5151 |
$total = $wpdb->get_var($query); |
| 5152 |
$query_sub_count = "SELECT count(distinct group_id) from " . $wpdb->prefix . "formmaker_submits"; |
| 5153 |
$sub_count = (int) $wpdb->get_var($query_sub_count); |
| 5154 |
$query = $join . ' ' . $orderby . ' LIMIT ' . $page_num . ', '.$per_num; |
| 5155 |
$results = $wpdb->get_results($query); |
| 5156 |
for ( $i = 0; $i < count($results); $i++ ) { |
| 5157 |
array_push($rows_ord, $results[$i]->group_id); |
| 5158 |
} |
| 5159 |
$query1 = $join . ' ' . $orderby; |
| 5160 |
$searched_group_ids = $wpdb->get_results($query1); |
| 5161 |
$searched_ids = array(); |
| 5162 |
for ( $i = 0; $i < count($searched_group_ids); $i++ ) { |
| 5163 |
array_push($searched_ids, $searched_group_ids[$i]->group_id); |
| 5164 |
} |
| 5165 |
$where2 = array(); |
| 5166 |
$where2[] = "group_id='0'"; |
| 5167 |
foreach ( $rows_ord as $rows_ordd ) { |
| 5168 |
$where2[] = "group_id='" . $rows_ordd . "'"; |
| 5169 |
} |
| 5170 |
$where2 = (count($where2) ? ' WHERE ' . implode(' OR ', $where2) . '' : ''); |
| 5171 |
$query = 'SELECT * FROM ' . $wpdb->prefix . 'formmaker_submits ' . $where2; |
| 5172 |
$rows = $wpdb->get_results($query); |
| 5173 |
$group_ids = $rows_ord; |
| 5174 |
$lists['total'] = $total; |
| 5175 |
$lists['limit'] = $per_num; |
| 5176 |
$where_choices = $where; |
| 5177 |
array_push($labels_parameters, $sorted_labels_id); |
| 5178 |
array_push($labels_parameters, $sorted_label_types); |
| 5179 |
array_push($labels_parameters, $lists); |
| 5180 |
array_push($labels_parameters, $sorted_label_names); |
| 5181 |
array_push($labels_parameters, $sorted_label_names_original); |
| 5182 |
array_push($labels_parameters, $rows); |
| 5183 |
array_push($labels_parameters, $group_ids); |
| 5184 |
array_push($labels_parameters, $where_choices); |
| 5185 |
array_push($labels_parameters, $searched_ids); |
| 5186 |
} |
| 5187 |
|
| 5188 |
return $labels_parameters; |
| 5189 |
} |
| 5190 |
|
| 5191 |
/** |
| 5192 |
* Encode a given string with the QUOTED_PRINTABLE mechanism and wrap the lines. |
| 5193 |
* |
| 5194 |
* @param string $str |
| 5195 |
* @param int $lineLength Line length; defaults to {@link LINELENGTH} |
| 5196 |
* @param string $lineEnd Line end; defaults to {@link LINEEND} |
| 5197 |
* |
| 5198 |
* @return string |
| 5199 |
*/ |
| 5200 |
public static function encodeQuotedPrintable( $str, $lineLength = self::LINELENGTH, $lineEnd = self::LINEEND ) { |
| 5201 |
$out = ''; |
| 5202 |
$str = self::_encodeQuotedPrintable($str); |
| 5203 |
// Split encoded text into separate lines |
| 5204 |
while ( strlen($str) > 0 ) { |
| 5205 |
$ptr = strlen($str); |
| 5206 |
if ( $ptr > $lineLength ) { |
| 5207 |
$ptr = $lineLength; |
| 5208 |
} |
| 5209 |
// Ensure we are not splitting across an encoded character |
| 5210 |
$pos = strrpos(substr($str, 0, $ptr), '='); |
| 5211 |
if ( $pos !== FALSE && $pos >= $ptr - 2 ) { |
| 5212 |
$ptr = $pos; |
| 5213 |
} |
| 5214 |
// Check if there is a space at the end of the line and rewind |
| 5215 |
if ( $ptr > 0 && $str[$ptr - 1] == ' ' ) { |
| 5216 |
--$ptr; |
| 5217 |
} |
| 5218 |
// Add string and continue |
| 5219 |
$out .= substr($str, 0, $ptr) . '=' . $lineEnd; |
| 5220 |
$str = substr($str, $ptr); |
| 5221 |
} |
| 5222 |
$out = rtrim($out, $lineEnd); |
| 5223 |
$out = rtrim($out, '='); |
| 5224 |
|
| 5225 |
return $out; |
| 5226 |
} |
| 5227 |
|
| 5228 |
/** |
| 5229 |
* Converts a string into quoted printable format. |
| 5230 |
* |
| 5231 |
* @param string $str |
| 5232 |
* |
| 5233 |
* @return string |
| 5234 |
*/ |
| 5235 |
private static function _encodeQuotedPrintable( $str ) { |
| 5236 |
$str = str_replace('=', '=3D', $str); |
| 5237 |
$str = str_replace(self::$qpKeys, self::$qpReplaceValues, $str); |
| 5238 |
$str = rtrim($str); |
| 5239 |
|
| 5240 |
return $str; |
| 5241 |
} |
| 5242 |
|
| 5243 |
/** |
| 5244 |
* decode a quoted printable encoded string |
| 5245 |
* The charset of the returned string depends on your iconv settings. |
| 5246 |
* |
| 5247 |
* @param string $string Encoded string |
| 5248 |
* |
| 5249 |
* @return string Decoded string |
| 5250 |
*/ |
| 5251 |
public static function decodeQuotedPrintable( $string ) { |
| 5252 |
return quoted_printable_decode($string); |
| 5253 |
} |
| 5254 |
|
| 5255 |
/** |
| 5256 |
* Replace currencycode. |
| 5257 |
* |
| 5258 |
* @param string $key |
| 5259 |
* |
| 5260 |
* @return string |
| 5261 |
*/ |
| 5262 |
public static function replace_currency_code( $currency ) { |
| 5263 |
$currency_code = array('USD', 'EUR', 'GBP', 'JPY', 'CAD', 'MXN', 'HKD', 'HUF', 'NOK', 'NZD', 'SGD', 'SEK', 'PLN', 'AUD', 'DKK', 'CHF', 'CZK', 'ILS', 'BRL', 'TWD', 'MYR', 'PHP', 'THB'); |
| 5264 |
$currency_sign = array('$', '€', '£', '¥', 'C$', 'Mex$', 'HK$', 'Ft', 'kr', 'NZ$', 'S$', 'kr', 'zl', 'A$', 'kr', 'CHF', 'Kc', '₪', 'R$', 'NT$', 'RM', '₱', '฿'); |
| 5265 |
if (isset($currency_code[$currency])) { |
| 5266 |
$currency = $currency_sign[array_search($currency, $currency_code)]; |
| 5267 |
} |
| 5268 |
return $currency; |
| 5269 |
} |
| 5270 |
|
| 5271 |
/** |
| 5272 |
* Create Email options placeholders. |
| 5273 |
* |
| 5274 |
* @param array $labels |
| 5275 |
* @return array $data |
| 5276 |
*/ |
| 5277 |
public static function create_email_options_placeholders( $labels = array() ) { |
| 5278 |
$data = array(); |
| 5279 |
$form_inputs = array(); |
| 5280 |
$continue_types = array('type_submit_reset', 'type_editor', 'type_map', 'type_mark_map', 'type_captcha', 'type_recaptcha', 'type_button', 'type_send_copy'); |
| 5281 |
$inputs = array( |
| 5282 |
array('value' => 'all', 'title' => __('All fields list', WDFMInstance(self::PLUGIN)->prefix)), |
| 5283 |
); |
| 5284 |
if ( !empty($labels) ) { |
| 5285 |
foreach($labels as $key => $label) { |
| 5286 |
if ( empty($key) || in_array($label['type'], $continue_types) ) { |
| 5287 |
continue; |
| 5288 |
} |
| 5289 |
if ( $label['type'] == "type_file_upload" ) { |
| 5290 |
$key = $key . '(link)'; |
| 5291 |
} |
| 5292 |
$form_inputs[] = array('value' => $key, 'title' => $label['name'] ); |
| 5293 |
} |
| 5294 |
} |
| 5295 |
$data[__('Form fields', WDFMInstance(self::PLUGIN)->prefix)] = array_merge($inputs, $form_inputs); |
| 5296 |
$data[__('Misc', WDFMInstance(self::PLUGIN)->prefix)] = array( |
| 5297 |
array('value' => 'formtitle', 'title' => __('Form Title', WDFMInstance(self::PLUGIN)->prefix)), |
| 5298 |
array('value' => 'subid', 'title' => __('Submission ID', WDFMInstance(self::PLUGIN)->prefix)), |
| 5299 |
array('value' => 'ip', 'title' => __('IP', WDFMInstance(self::PLUGIN)->prefix)), |
| 5300 |
array('value' => 'adminemail', 'title' => __('Admin Email', WDFMInstance(self::PLUGIN)->prefix)), |
| 5301 |
array('value' => 'useremail', 'title' => __('User Email', WDFMInstance(self::PLUGIN)->prefix)), |
| 5302 |
array('value' => 'username', 'title' => __('User Name', WDFMInstance(self::PLUGIN)->prefix)), |
| 5303 |
array('value' => 'pageurl', 'title' => __('Page Url', WDFMInstance(self::PLUGIN)->prefix)), |
| 5304 |
array('value' => 'verificationlink', 'title' => __('Verification Link', WDFMInstance(self::PLUGIN)->prefix)), |
| 5305 |
); |
| 5306 |
$data[__('Misc', WDFMInstance(self::PLUGIN)->prefix)] = apply_filters('fm_placeholders_misc', $data[__('Misc', WDFMInstance(self::PLUGIN)->prefix)]); |
| 5307 |
return $data; |
| 5308 |
} |
| 5309 |
|
| 5310 |
/** |
| 5311 |
* Get shortcode data. |
| 5312 |
* |
| 5313 |
* @return json $data |
| 5314 |
*/ |
| 5315 |
public static function get_shortcode_data() { |
| 5316 |
global $wpdb; |
| 5317 |
$rows = $wpdb->get_results("SELECT `id`, `title` as name FROM `" . $wpdb->prefix . "formmaker`" . (!WDFMInstance(self::PLUGIN)->is_free ? '' : ' WHERE id' . (WDFMInstance(self::PLUGIN)->is_free == 1 ? ' NOT ' : ' ') . 'IN (' . (get_option('contact_form_forms', '') != '' ? get_option('contact_form_forms') : 0) . ') ORDER BY `title`')); |
| 5318 |
$data = array(); |
| 5319 |
$data['shortcode_prefix'] = WDFMInstance(self::PLUGIN)->is_free == 2 ? 'wd_contact_form' : 'Form'; |
| 5320 |
$data['inputs'][] = array( |
| 5321 |
'type' => 'select', |
| 5322 |
'id' => WDFMInstance(self::PLUGIN)->prefix . '_id', |
| 5323 |
'name' => WDFMInstance(self::PLUGIN)->prefix . '_id', |
| 5324 |
'shortcode_attibute_name' => 'id', |
| 5325 |
'options' => $rows, |
| 5326 |
); |
| 5327 |
return json_encode($data); |
| 5328 |
} |
| 5329 |
|
| 5330 |
/** |
| 5331 |
* Session start if not started. |
| 5332 |
*/ |
| 5333 |
public static function start_session() { |
| 5334 |
if (session_id() == '' || (function_exists('session_status') && (session_status() == PHP_SESSION_NONE))) { |
| 5335 |
@session_start(); |
| 5336 |
} |
| 5337 |
} |
| 5338 |
|
| 5339 |
public static function get_user_submission_ids( $email_address ) { |
| 5340 |
global $wpdb; |
| 5341 |
$user = get_user_by( 'email', $email_address ); |
| 5342 |
$query = 'SELECT DISTINCT submits.`form_id`, form.`title`, submits.`group_id` FROM ' . $wpdb->prefix . 'formmaker_submits as submits INNER JOIN ' . $wpdb->prefix . 'formmaker as form ON submits.form_id=form.id WHERE submits.`element_value`=\'' . $email_address . '\'' . ($user ? ' OR submits.`user_id_wd`=' . $user->ID : '') . (!WDFMInstance(self::PLUGIN)->is_free ? '' : ' AND submits.form_id' . (WDFMInstance(self::PLUGIN)->is_free == 1 ? ' NOT ' : ' ') . 'IN (' . (get_option( 'contact_form_forms', '' ) != '' ? get_option( 'contact_form_forms' ) : 0) . ')') . ' ORDER BY submits.`form_id`'; |
| 5343 |
$results = $wpdb->get_results($query); |
| 5344 |
return $results; |
| 5345 |
} |
| 5346 |
|
| 5347 |
public static function get_submission_by_id( $group_id ) { |
| 5348 |
global $wpdb; |
| 5349 |
$query = 'SELECT * FROM ' . $wpdb->prefix . 'formmaker_submits WHERE `group_id`=' . (int) $group_id; |
| 5350 |
$results = $wpdb->get_results($query); |
| 5351 |
return $results; |
| 5352 |
} |
| 5353 |
|
| 5354 |
public static function delete_user_submissions( $email_address ) { |
| 5355 |
global $wpdb; |
| 5356 |
$submission_ids = self::get_user_submission_ids( $email_address ); |
| 5357 |
$ids = array(); |
| 5358 |
foreach ($submission_ids as $id) { |
| 5359 |
$ids[] = $id->group_id; |
| 5360 |
} |
| 5361 |
$ids = implode(',', $ids); |
| 5362 |
$query = 'DELETE FROM ' . $wpdb->prefix . 'formmaker_sessions WHERE group_id IN (' . $ids . ')'; |
| 5363 |
$deleted = $wpdb->query($query); |
| 5364 |
$query = 'DELETE FROM ' . $wpdb->prefix . 'formmaker_submits WHERE group_id IN (' . $ids . ')'; |
| 5365 |
$deleted = $deleted || $wpdb->query($query); |
| 5366 |
return $deleted; |
| 5367 |
} |
| 5368 |
|
| 5369 |
public static function privacy_personal_data_export ( $email_address, $page = 1 ) { |
| 5370 |
$export_items = array(); |
| 5371 |
|
| 5372 |
$submission_ids = self::get_user_submission_ids( $email_address ); |
| 5373 |
if ($submission_ids) { |
| 5374 |
require_once WDFMInstance(self::PLUGIN)->plugin_dir . '/admin/models/model.php'; |
| 5375 |
require_once WDFMInstance(self::PLUGIN)->plugin_dir . '/admin/models/Submissions_fm.php'; |
| 5376 |
$model_class = self::PLUGIN == 2 ? 'FMModelSubmissions_fmc' : 'FMModelSubmissions_fm'; |
| 5377 |
$model = new $model_class(); |
| 5378 |
$form_id = 0; |
| 5379 |
$label_parameters = array(); |
| 5380 |
foreach ($submission_ids as $submission_id) { |
| 5381 |
if ($submission_id->form_id != $form_id) { |
| 5382 |
$form_id = $submission_id->form_id; |
| 5383 |
$label_parameters = $model->get_labels_parameters($form_id); |
| 5384 |
} |
| 5385 |
$data = array(); |
| 5386 |
$submission = self::get_submission_by_id($submission_id->group_id); |
| 5387 |
if ( $submission ) { |
| 5388 |
$data[] = array( |
| 5389 |
'name' => __( 'Form Title', WDFMInstance(self::PLUGIN)->prefix ), |
| 5390 |
'value' => $submission_id->title |
| 5391 |
); |
| 5392 |
// Selecting this each time as any user could submit a data containing $email_address. |
| 5393 |
$user = get_user_by( 'id', $submission[0]->user_id_wd ); |
| 5394 |
if ($user) { |
| 5395 |
$data[] = array( |
| 5396 |
'name' => __( 'Submitter Name', WDFMInstance( self::PLUGIN )->prefix ), |
| 5397 |
'value' => $user->display_name |
| 5398 |
); |
| 5399 |
$data[] = array( |
| 5400 |
'name' => __( 'Submitter Email', WDFMInstance( self::PLUGIN )->prefix ), |
| 5401 |
'value' => $user->user_email |
| 5402 |
); |
| 5403 |
} |
| 5404 |
$data[] = array( |
| 5405 |
'name' => __( 'Submitter IP', WDFMInstance(self::PLUGIN)->prefix ), |
| 5406 |
'value' => $submission[0]->ip |
| 5407 |
); |
| 5408 |
$data[] = array( |
| 5409 |
'name' => __( 'Submission Date', WDFMInstance(self::PLUGIN)->prefix ), |
| 5410 |
'value' => $submission[0]->date |
| 5411 |
); |
| 5412 |
foreach ( $submission as $row ) { |
| 5413 |
$element_label = $label_parameters[3][array_search($row->element_label, $label_parameters[0])]; |
| 5414 |
$data[] = array( |
| 5415 |
'name' => $element_label, |
| 5416 |
'value' => $row->element_value |
| 5417 |
); |
| 5418 |
} |
| 5419 |
} |
| 5420 |
|
| 5421 |
$item_id = WDFMInstance(self::PLUGIN)->slug . '-submission-' . $submission_id->group_id; |
| 5422 |
// This is nor submission group_id. |
| 5423 |
$group_id = WDFMInstance(self::PLUGIN)->slug; |
| 5424 |
$group_label = WDFMInstance(self::PLUGIN)->nicename . __( ' Submissions', WDFMInstance(self::PLUGIN)->prefix ); |
| 5425 |
$export_items[] = array( |
| 5426 |
'group_id' => $group_id, |
| 5427 |
'group_label' => $group_label, |
| 5428 |
'item_id' => $item_id, |
| 5429 |
'data' => $data, |
| 5430 |
); |
| 5431 |
} |
| 5432 |
} |
| 5433 |
|
| 5434 |
return array( |
| 5435 |
'data' => $export_items, |
| 5436 |
'done' => true, |
| 5437 |
); |
| 5438 |
} |
| 5439 |
|
| 5440 |
public static function privacy_personal_data_erase( $email_address, $page = 1 ) { |
| 5441 |
$items_removed = self::delete_user_submissions( $email_address ); |
| 5442 |
|
| 5443 |
return array( |
| 5444 |
'items_removed' => $items_removed, |
| 5445 |
'items_retained' => false, |
| 5446 |
'messages' => array(sprintf(__('All personal data and submissions of this user found in %s plugin were removed.', WDFMInstance(self::PLUGIN)->prefix), WDFMInstance(self::PLUGIN)->nicename)), |
| 5447 |
'done' => true, |
| 5448 |
); |
| 5449 |
} |
| 5450 |
|
| 5451 |
/** |
| 5452 |
* Array remove keys. |
| 5453 |
* |
| 5454 |
* @param array $array |
| 5455 |
* @param array $keys |
| 5456 |
* @return array |
| 5457 |
*/ |
| 5458 |
public static function array_remove_keys( $array = array(), $keys = array() ) { |
| 5459 |
if ( !empty($array) ) { |
| 5460 |
foreach ( $array as $key => $val ) { |
| 5461 |
if ( isset($keys[$key]) ) { |
| 5462 |
unset($array[$key]); |
| 5463 |
} |
| 5464 |
} |
| 5465 |
} |
| 5466 |
return $array; |
| 5467 |
} |
| 5468 |
|
| 5469 |
/** |
| 5470 |
* Check if is preview of Elementor builder. |
| 5471 |
* |
| 5472 |
* @return bool |
| 5473 |
*/ |
| 5474 |
public static function elementor_is_active() { |
| 5475 |
if ( in_array(WDW_FM_Library(self::PLUGIN)->get('action', ''), array( |
| 5476 |
'elementor', |
| 5477 |
'elementor_ajax', |
| 5478 |
)) || WDW_FM_Library(self::PLUGIN)->get('elementor-preview', '') ) { |
| 5479 |
|
| 5480 |
return TRUE; |
| 5481 |
} |
| 5482 |
|
| 5483 |
return FALSE; |
| 5484 |
} |
| 5485 |
|
| 5486 |
// TODO. This function should be replaced with WP functionality in another version. At the moment it is not. |
| 5487 |
/** |
| 5488 |
* Get privacy_policy_url |
| 5489 |
* |
| 5490 |
* @return string $url |
| 5491 |
*/ |
| 5492 |
public static function get_privacy_policy_url() { |
| 5493 |
$permalink = ''; |
| 5494 |
$title = __('Privacy Policy', WDFMInstance(self::PLUGIN)->prefix); |
| 5495 |
$post_id = get_option( 'wp_page_for_privacy_policy' ); |
| 5496 |
if ( $post_id ) { |
| 5497 |
$post = get_post( $post_id, OBJECT ); |
| 5498 |
if ( !empty($post) && $post->post_status == 'publish' ) { |
| 5499 |
$permalink = get_permalink( $post_id ); |
| 5500 |
$title = $post->post_title; |
| 5501 |
} |
| 5502 |
} |
| 5503 |
return array('url' => $permalink, 'title' => $title); |
| 5504 |
} |
| 5505 |
|
| 5506 |
public static function unique_number() { |
| 5507 |
$use_random_number = ( WDW_FM_Library(self::PLUGIN)->elementor_is_active() ) ? TRUE : FALSE; |
| 5508 |
if ($use_random_number) { |
| 5509 |
return mt_rand(); |
| 5510 |
} |
| 5511 |
else { |
| 5512 |
global $fm; |
| 5513 |
$unique = $fm; |
| 5514 |
$fm++; |
| 5515 |
return $unique; |
| 5516 |
} |
| 5517 |
} |
| 5518 |
|
| 5519 |
/** |
| 5520 |
* Get forms. |
| 5521 |
* |
| 5522 |
* @return array |
| 5523 |
*/ |
| 5524 |
public static function get_forms() { |
| 5525 |
global $wpdb; |
| 5526 |
$query = "SELECT `id`, `title` FROM `" . $wpdb->prefix . "formmaker`" . (!WDFMInstance(self::PLUGIN)->is_free ? '' : ' WHERE id' . (WDFMInstance(self::PLUGIN)->is_free == 1 ? ' NOT ' : ' ') . 'IN (' . (get_option('contact_form_forms', '') != '' ? get_option('contact_form_forms') : 0) . ') ORDER BY `title`'); |
| 5527 |
|
| 5528 |
$rows = $wpdb->get_results($query); |
| 5529 |
|
| 5530 |
$forms = array(); |
| 5531 |
$forms[0] = __('Select a form', WDFMInstance(self::PLUGIN)->prefix); |
| 5532 |
foreach ( $rows as $row ) { |
| 5533 |
$forms[$row->id] = $row->title; |
| 5534 |
} |
| 5535 |
|
| 5536 |
return $forms; |
| 5537 |
} |
| 5538 |
|
| 5539 |
/** |
| 5540 |
* Is plugin active. |
| 5541 |
* |
| 5542 |
* @param $plugin_name |
| 5543 |
* |
| 5544 |
* @return bool |
| 5545 |
*/ |
| 5546 |
public static function is_plugin_installed($plugin_name) { |
| 5547 |
if ( is_dir(WP_PLUGIN_DIR . '/' . $plugin_name . '/') ) { |
| 5548 |
return TRUE; |
| 5549 |
} |
| 5550 |
|
| 5551 |
return FALSE; |
| 5552 |
} |
| 5553 |
|
| 5554 |
/** |
| 5555 |
* Get activation or deactivation link of a plugin |
| 5556 |
* |
| 5557 |
* @author Nazmul Ahsan <mail@nazmulahsan.me> |
| 5558 |
* |
| 5559 |
* @param string $plugin plugin file name |
| 5560 |
* @param string $action action to perform. activate or deactivate |
| 5561 |
* |
| 5562 |
* @return string $url action url |
| 5563 |
*/ |
| 5564 |
public static function na_action_link( $plugin, $action = 'activate' ) { |
| 5565 |
if ( strpos($plugin, '/') ) { |
| 5566 |
$plugin = str_replace('\/', '%2F', $plugin); |
| 5567 |
} |
| 5568 |
$url = sprintf(admin_url('plugins.php?action=' . $action . '&plugin=%s&plugin_status=all&paged=1&s'), $plugin); |
| 5569 |
$_REQUEST['plugin'] = $plugin; |
| 5570 |
$url = wp_nonce_url($url, $action . '-plugin_' . $plugin); |
| 5571 |
|
| 5572 |
return $url; |
| 5573 |
} |
| 5574 |
|
| 5575 |
public static function twbb_install_button($v) { |
| 5576 |
$prefix = WDFMInstance(1)->prefix; |
| 5577 |
$slug = '10web-manager'; |
| 5578 |
$install_url = esc_url(wp_nonce_url(self_admin_url('update.php?action=install-plugin&plugin=' . $slug), 'install-plugin_' . $slug)); |
| 5579 |
$activation_url = self::na_action_link($slug . '/10web-manager.php', 'activate'); |
| 5580 |
$tenweb_url = admin_url('admin.php?page=tenweb_menu'); |
| 5581 |
$dismiss_url = add_query_arg(array( 'action' => 'wd_tenweb_dismiss' ), admin_url('admin-ajax.php')); |
| 5582 |
$activate = self::is_plugin_installed($slug) && !is_plugin_active('10web-manager/manager.php') ? TRUE : FALSE; |
| 5583 |
?> |
| 5584 |
<a class="button<?php echo($v == 2 ? ' button-primary' : ''); ?> tenweb_activaion" |
| 5585 |
id="<?php echo $activate ? 'activate_now' : 'install_now'; ?>" |
| 5586 |
data-activation="<?php _e("Activation", $prefix); ?>" |
| 5587 |
data-tenweb-url="<?php echo $tenweb_url; ?>" |
| 5588 |
data-install-url="<?php echo $install_url; ?>" |
| 5589 |
data-activate-url="<?php echo $activation_url; ?>"> |
| 5590 |
<span class="tenweb_activaion_text"><?php echo $activate ? __("Activate", $prefix) : __("Install", $prefix); ?></span> |
| 5591 |
<span class="spinner" id="loading"></span> |
| 5592 |
</a> |
| 5593 |
<span class="hide <?php echo $activate ? 'error_activate' : 'error_install tenweb_active'; ?> "> |
| 5594 |
<?php echo $activate ? __("Activation failed, please try again.", $prefix) : __("Installation failed, please try again.", $prefix); ?> |
| 5595 |
</span> |
| 5596 |
<script> |
| 5597 |
var url = jQuery(".tenweb_activaion").attr("data-install-url"); |
| 5598 |
var activate_url = jQuery(".tenweb_activaion").attr("data-activate-url"); |
| 5599 |
|
| 5600 |
function install_tenweb_plugin() { |
| 5601 |
jQuery("#loading").addClass('is-active'); |
| 5602 |
jQuery(this).prop('disable', true); |
| 5603 |
jQuery.ajax({ |
| 5604 |
method: "POST", |
| 5605 |
url: url, |
| 5606 |
}).done(function () { |
| 5607 |
/* Check if plugin installed.*/ |
| 5608 |
jQuery.ajax({ |
| 5609 |
type: 'POST', |
| 5610 |
dataType: 'json', |
| 5611 |
url: jQuery("#verifyUrl").attr('data-url'), |
| 5612 |
error: function () { |
| 5613 |
jQuery("#loading").removeClass('is-active'); |
| 5614 |
jQuery(".error_install").show(); |
| 5615 |
}, |
| 5616 |
success: function (response) { |
| 5617 |
if (response.status_install == 1) { |
| 5618 |
jQuery('#install_now .tenweb_activaion_text').text(jQuery("#install_now").data("activation")); |
| 5619 |
activate_tenweb_plugin(); |
| 5620 |
} |
| 5621 |
else { |
| 5622 |
jQuery("#loading").removeClass('is-active'); |
| 5623 |
jQuery(".error_install").removeClass('hide'); |
| 5624 |
} |
| 5625 |
} |
| 5626 |
}); |
| 5627 |
}).fail(function () { |
| 5628 |
jQuery("#loading").removeClass('is-active'); |
| 5629 |
jQuery(".error_install").removeClass('hide'); |
| 5630 |
}); |
| 5631 |
} |
| 5632 |
function activate_tenweb_plugin() { |
| 5633 |
jQuery("#activate_now #loading").addClass('is-active'); |
| 5634 |
jQuery.ajax({ |
| 5635 |
method: "POST", |
| 5636 |
url: activate_url, |
| 5637 |
}).done(function () { |
| 5638 |
jQuery("#loading").removeClass('is-active'); |
| 5639 |
var data_tenweb_url = ''; |
| 5640 |
/* Check if plugin installed.*/ |
| 5641 |
jQuery.ajax({ |
| 5642 |
type: 'POST', |
| 5643 |
dataType: 'json', |
| 5644 |
url: jQuery("#verifyUrl").attr('data-url'), |
| 5645 |
error: function () { |
| 5646 |
jQuery("#loading").removeClass('is-active'); |
| 5647 |
jQuery(".error_activate").removeClass('hide'); |
| 5648 |
}, |
| 5649 |
success: function (response) { |
| 5650 |
if (response.status_active == 0) { |
| 5651 |
//jQuery('#install_now').addClass('hide'); |
| 5652 |
data_tenweb_url = jQuery('.tenweb_activaion').attr('data-tenweb-url'); |
| 5653 |
jQuery.post('<?php echo $dismiss_url; ?>'); |
| 5654 |
} |
| 5655 |
else { |
| 5656 |
jQuery("#loading").removeClass('is-active'); |
| 5657 |
jQuery(".error_activate").removeClass('hide'); |
| 5658 |
} |
| 5659 |
}, |
| 5660 |
complete: function () { |
| 5661 |
if (data_tenweb_url != '') { |
| 5662 |
window.location.href = data_tenweb_url; |
| 5663 |
} |
| 5664 |
} |
| 5665 |
}); |
| 5666 |
}).fail(function () { |
| 5667 |
jQuery("#loading").removeClass('is-active'); |
| 5668 |
}); |
| 5669 |
} |
| 5670 |
jQuery("#install_now").on("click", function () { |
| 5671 |
install_tenweb_plugin(); |
| 5672 |
}); |
| 5673 |
jQuery("#activate_now").on("click", function () { |
| 5674 |
activate_tenweb_plugin(); |
| 5675 |
}); |
| 5676 |
</script> |
| 5677 |
|
| 5678 |
<?php |
| 5679 |
} |
| 5680 |
} |
| 5681 |
|