| @@ 371-425 (lines=55) @@ | ||
| 368 | return $result; |
|
| 369 | } |
|
| 370 | ||
| 371 | function drawButton($title = null, $link = null, $type = null, $params = null, $force_css = false) { |
|
| 372 | $colours = array('success' => '#1cb841', |
|
| 373 | 'error' => '#ca3c3c', |
|
| 374 | 'warning' => '#ebaa16', |
|
| 375 | 'info' => '#42B8DD', |
|
| 376 | 'primary' => '#0078E7'); |
|
| 377 | ||
| 378 | if ( !isset($type) || !in_array($type, array_keys($colours)) ) { |
|
| 379 | $type = 'info'; |
|
| 380 | } |
|
| 381 | ||
| 382 | $css = 'font-size:14px;color:#fff;padding:8px 16px;border:0;border-radius:4px;text-shadow:0 1px 1px rgba(0, 0, 0, 0.2);text-decoration:none;display:inline-block;cursor:pointer;white-space:nowrap;vertical-align:baseline;text-align:center;background-color:' . $colours[$type] . ';'; |
|
| 383 | ||
| 384 | $button = ''; |
|
| 385 | ||
| 386 | if ( isset($link) ) { |
|
| 387 | $button .= '<a href="' . $link . '" class="bt-button'; |
|
| 388 | ||
| 389 | if ( isset($type) ) { |
|
| 390 | $button .= ' bt-button-' . $type; |
|
| 391 | } |
|
| 392 | ||
| 393 | $button .= '"'; |
|
| 394 | ||
| 395 | if ( isset($params) ) { |
|
| 396 | $button .= ' ' . $params; |
|
| 397 | } |
|
| 398 | ||
| 399 | if ( $force_css == true ) { |
|
| 400 | $button .= ' style="' . $css . '"'; |
|
| 401 | } |
|
| 402 | ||
| 403 | $button .= '>' . $title . '</a>'; |
|
| 404 | } else { |
|
| 405 | $button .= '<button type="submit" class="bt-button'; |
|
| 406 | ||
| 407 | if ( isset($type) ) { |
|
| 408 | $button .= ' bt-button-' . $type; |
|
| 409 | } |
|
| 410 | ||
| 411 | $button .= '"'; |
|
| 412 | ||
| 413 | if ( isset($params) ) { |
|
| 414 | $button .= ' ' . $params; |
|
| 415 | } |
|
| 416 | ||
| 417 | if ( $force_css == true ) { |
|
| 418 | $button .= ' style="' . $css . '"'; |
|
| 419 | } |
|
| 420 | ||
| 421 | $button .= '>' . $title . '</button>'; |
|
| 422 | } |
|
| 423 | ||
| 424 | return $button; |
|
| 425 | } |
|
| 426 | ||
| 427 | function createRandomValue($length, $type = 'mixed') { |
|
| 428 | if ( ($type != 'mixed') && ($type != 'chars') && ($type != 'digits')) $type = 'mixed'; |
|
| @@ 444-498 (lines=55) @@ | ||
| 441 | return $result; |
|
| 442 | } |
|
| 443 | ||
| 444 | function drawButton($title = null, $link = null, $type = null, $params = null, $force_css = false) { |
|
| 445 | $colours = array('success' => '#1cb841', |
|
| 446 | 'error' => '#ca3c3c', |
|
| 447 | 'warning' => '#ebaa16', |
|
| 448 | 'info' => '#42B8DD', |
|
| 449 | 'primary' => '#0078E7'); |
|
| 450 | ||
| 451 | if ( !isset($type) || !in_array($type, array_keys($colours)) ) { |
|
| 452 | $type = 'info'; |
|
| 453 | } |
|
| 454 | ||
| 455 | $css = 'font-size:14px;color:#fff;padding:8px 16px;border:0;border-radius:4px;text-shadow:0 1px 1px rgba(0, 0, 0, 0.2);text-decoration:none;display:inline-block;cursor:pointer;white-space:nowrap;vertical-align:baseline;text-align:center;background-color:' . $colours[$type] . ';'; |
|
| 456 | ||
| 457 | $button = ''; |
|
| 458 | ||
| 459 | if ( isset($link) ) { |
|
| 460 | $button .= '<a href="' . $link . '" class="pp-button'; |
|
| 461 | ||
| 462 | if ( isset($type) ) { |
|
| 463 | $button .= ' pp-button-' . $type; |
|
| 464 | } |
|
| 465 | ||
| 466 | $button .= '"'; |
|
| 467 | ||
| 468 | if ( isset($params) ) { |
|
| 469 | $button .= ' ' . $params; |
|
| 470 | } |
|
| 471 | ||
| 472 | if ( $force_css == true ) { |
|
| 473 | $button .= ' style="' . $css . '"'; |
|
| 474 | } |
|
| 475 | ||
| 476 | $button .= '>' . $title . '</a>'; |
|
| 477 | } else { |
|
| 478 | $button .= '<button type="submit" class="pp-button'; |
|
| 479 | ||
| 480 | if ( isset($type) ) { |
|
| 481 | $button .= ' pp-button-' . $type; |
|
| 482 | } |
|
| 483 | ||
| 484 | $button .= '"'; |
|
| 485 | ||
| 486 | if ( isset($params) ) { |
|
| 487 | $button .= ' ' . $params; |
|
| 488 | } |
|
| 489 | ||
| 490 | if ( $force_css == true ) { |
|
| 491 | $button .= ' style="' . $css . '"'; |
|
| 492 | } |
|
| 493 | ||
| 494 | $button .= '>' . $title . '</button>'; |
|
| 495 | } |
|
| 496 | ||
| 497 | return $button; |
|
| 498 | } |
|
| 499 | ||
| 500 | function createRandomValue($length, $type = 'mixed') { |
|
| 501 | if ( ($type != 'mixed') && ($type != 'chars') && ($type != 'digits')) $type = 'mixed'; |
|