Code Duplication    Length = 55-55 lines in 2 locations

catalog/includes/apps/braintree/OSCOM_Braintree.php 1 location

@@ 395-449 (lines=55) @@
392
      return $result;
393
    }
394
395
    function drawButton($title = null, $link = null, $type = null, $params = null, $force_css = false) {
396
      $colours = array('success' => '#1cb841',
397
                       'error' => '#ca3c3c',
398
                       'warning' => '#ebaa16',
399
                       'info' => '#42B8DD',
400
                       'primary' => '#0078E7');
401
402
      if ( !isset($type) || !in_array($type, array_keys($colours)) ) {
403
        $type = 'info';
404
      }
405
406
      $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] . ';';
407
408
      $button = '';
409
410
      if ( isset($link) ) {
411
        $button .= '<a href="' . $link . '" class="bt-button';
412
413
        if ( isset($type) ) {
414
          $button .= ' bt-button-' . $type;
415
        }
416
417
        $button .= '"';
418
419
        if ( isset($params) ) {
420
          $button .= ' ' . $params;
421
        }
422
423
        if ( $force_css == true ) {
424
          $button .= ' style="' . $css . '"';
425
        }
426
427
        $button .= '>' . $title . '</a>';
428
      } else {
429
        $button .= '<button type="submit" class="bt-button';
430
431
        if ( isset($type) ) {
432
          $button .= ' bt-button-' . $type;
433
        }
434
435
        $button .= '"';
436
437
        if ( isset($params) ) {
438
          $button .= ' ' . $params;
439
        }
440
441
        if ( $force_css == true ) {
442
          $button .= ' style="' . $css . '"';
443
        }
444
445
        $button .= '>' . $title . '</button>';
446
      }
447
448
      return $button;
449
    }
450
451
    function createRandomValue($length, $type = 'mixed') {
452
      if ( ($type != 'mixed') && ($type != 'chars') && ($type != 'digits')) $type = 'mixed';

catalog/includes/apps/paypal/OSCOM_PayPal.php 1 location

@@ 470-524 (lines=55) @@
467
      return $result;
468
    }
469
470
    function drawButton($title = null, $link = null, $type = null, $params = null, $force_css = false) {
471
      $colours = array('success' => '#1cb841',
472
                       'error' => '#ca3c3c',
473
                       'warning' => '#ebaa16',
474
                       'info' => '#42B8DD',
475
                       'primary' => '#0078E7');
476
477
      if ( !isset($type) || !in_array($type, array_keys($colours)) ) {
478
        $type = 'info';
479
      }
480
481
      $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] . ';';
482
483
      $button = '';
484
485
      if ( isset($link) ) {
486
        $button .= '<a href="' . $link . '" class="pp-button';
487
488
        if ( isset($type) ) {
489
          $button .= ' pp-button-' . $type;
490
        }
491
492
        $button .= '"';
493
494
        if ( isset($params) ) {
495
          $button .= ' ' . $params;
496
        }
497
498
        if ( $force_css == true ) {
499
          $button .= ' style="' . $css . '"';
500
        }
501
502
        $button .= '>' . $title . '</a>';
503
      } else {
504
        $button .= '<button type="submit" class="pp-button';
505
506
        if ( isset($type) ) {
507
          $button .= ' pp-button-' . $type;
508
        }
509
510
        $button .= '"';
511
512
        if ( isset($params) ) {
513
          $button .= ' ' . $params;
514
        }
515
516
        if ( $force_css == true ) {
517
          $button .= ' style="' . $css . '"';
518
        }
519
520
        $button .= '>' . $title . '</button>';
521
      }
522
523
      return $button;
524
    }
525
526
    function createRandomValue($length, $type = 'mixed') {
527
      if ( ($type != 'mixed') && ($type != 'chars') && ($type != 'digits')) $type = 'mixed';