Code Duplication    Length = 11-14 lines in 9 locations

Ajax/Jquery.php 9 locations

@@ 435-445 (lines=11) @@
432
	 * @param string $value
433
	 * @param boolean $immediatly delayed if false
434
	 */
435
	public function _attr($element='this', $attributeName, $value="", $immediatly=false) {
436
		$element=$this->_prep_element($element);
437
		if (isset($value)) {
438
			$value=$this->_prep_value($value);
439
			$str="$({$element}).attr(\"$attributeName\",{$value});";
440
		} else
441
			$str="$({$element}).attr(\"$attributeName\");";
442
		if ($immediatly)
443
			$this->jquery_code_for_compile[]=$str;
444
		return $str;
445
	}
446
447
	/**
448
	 * Execute a generic jQuery call with a value.
@@ 454-464 (lines=11) @@
451
	 * @param string $param
452
	 * @param boolean $immediatly delayed if false
453
	 */
454
	public function _genericCallValue($jQueryCall,$element='this', $param="", $immediatly=false) {
455
		$element=$this->_prep_element($element);
456
		if (isset($param)) {
457
			$param=$this->_prep_value($param);
458
			$str="$({$element}).{$jQueryCall}({$param});";
459
		} else
460
			$str="$({$element}).{$jQueryCall}();";
461
			if ($immediatly)
462
				$this->jquery_code_for_compile[]=$str;
463
			return $str;
464
	}
465
	/**
466
	 * Execute a generic jQuery call with 2 elements.
467
	 * @param string $jQueryCall
@@ 531-544 (lines=14) @@
528
	 * @param boolean $immediatly delayed if false
529
	 * @return string
530
	 */
531
	public function _fadeIn($element='this', $speed='', $callback='', $immediatly=false) {
532
		$element=$this->_prep_element($element);
533
		$speed=$this->_validate_speed($speed);
534
535
		if ($callback!='') {
536
			$callback=", function(){\n{$callback}\n}";
537
		}
538
539
		$str="$({$element}).fadeIn({$speed}{$callback});";
540
541
		if ($immediatly)
542
			$this->jquery_code_for_compile[]=$str;
543
		return $str;
544
	}
545
546
	// --------------------------------------------------------------------
547
@@ 557-570 (lines=14) @@
554
	 * @param boolean $immediatly delayed if false
555
	 * @return string
556
	 */
557
	public function _fadeOut($element='this', $speed='', $callback='', $immediatly=false) {
558
		$element=$this->_prep_element($element);
559
		$speed=$this->_validate_speed($speed);
560
561
		if ($callback!='') {
562
			$callback=", function(){\n{$callback}\n}";
563
		}
564
565
		$str="$({$element}).fadeOut({$speed}{$callback});";
566
567
		if ($immediatly)
568
			$this->jquery_code_for_compile[]=$str;
569
		return $str;
570
	}
571
572
	// --------------------------------------------------------------------
573
@@ 583-596 (lines=14) @@
580
	 * @param boolean $immediatly delayed if false
581
	 * @return string
582
	 */
583
	public function _hide($element='this', $speed='', $callback='', $immediatly=false) {
584
		$element=$this->_prep_element($element);
585
		$speed=$this->_validate_speed($speed);
586
587
		if ($callback!='') {
588
			$callback=", function(){\n{$callback}\n}";
589
		}
590
591
		$str="$({$element}).hide({$speed}{$callback});";
592
593
		if ($immediatly)
594
			$this->jquery_code_for_compile[]=$str;
595
		return $str;
596
	}
597
598
	// --------------------------------------------------------------------
599
@@ 611-624 (lines=14) @@
608
	 * @param boolean $immediatly delayed if false
609
	 * @return string
610
	 */
611
	public function _slideUp($element='this', $speed='', $callback='', $immediatly=false) {
612
		$element=$this->_prep_element($element);
613
		$speed=$this->_validate_speed($speed);
614
615
		if ($callback!='') {
616
			$callback=", function(){\n{$callback}\n}";
617
		}
618
619
		$str="$({$element}).slideUp({$speed}{$callback});";
620
621
		if ($immediatly)
622
			$this->jquery_code_for_compile[]=$str;
623
		return $str;
624
	}
625
626
	// --------------------------------------------------------------------
627
@@ 637-650 (lines=14) @@
634
	 * @param boolean $immediatly delayed if false
635
	 * @return string
636
	 */
637
	public function _slideDown($element='this', $speed='', $callback='', $immediatly=false) {
638
		$element=$this->_prep_element($element);
639
		$speed=$this->_validate_speed($speed);
640
641
		if ($callback!='') {
642
			$callback=", function(){\n{$callback}\n}";
643
		}
644
645
		$str="$({$element}).slideDown({$speed}{$callback});";
646
647
		if ($immediatly)
648
			$this->jquery_code_for_compile[]=$str;
649
		return $str;
650
	}
651
652
	// --------------------------------------------------------------------
653
@@ 663-676 (lines=14) @@
660
	 * @param boolean $immediatly delayed if false
661
	 * @return string
662
	 */
663
	public function _slideToggle($element='this', $speed='', $callback='', $immediatly=false) {
664
		$element=$this->_prep_element($element);
665
		$speed=$this->_validate_speed($speed);
666
667
		if ($callback!='') {
668
			$callback=", function(){\n{$callback}\n}";
669
		}
670
671
		$str="$({$element}).slideToggle({$speed}{$callback});";
672
673
		if ($immediatly)
674
			$this->jquery_code_for_compile[]=$str;
675
		return $str;
676
	}
677
678
	// --------------------------------------------------------------------
679
@@ 724-737 (lines=14) @@
721
	 * @param boolean $immediatly delayed if false
722
	 * @return string
723
	 */
724
	public function _show($element='this', $speed='', $callback='', $immediatly=false) {
725
		$element=$this->_prep_element($element);
726
		$speed=$this->_validate_speed($speed);
727
728
		if ($callback!='') {
729
			$callback=", function(){\n{$callback}\n}";
730
		}
731
732
		$str="$({$element}).show({$speed}{$callback});";
733
734
		if ($immediatly)
735
			$this->jquery_code_for_compile[]=$str;
736
		return $str;
737
	}
738
739
	/**
740
	 * Places a condition