Code Duplication    Length = 25-26 lines in 3 locations

htdocs/class/smarty/Smarty_Compiler.class.php 3 locations

@@ 615-639 (lines=25) @@
612
         * First we check if the compiler function has already been registered
613
         * or loaded from a plugin file.
614
         */
615
        if (isset($this->_plugins['compiler'][$tag_command])) {
616
            $found = true;
617
            $plugin_func = $this->_plugins['compiler'][$tag_command][0];
618
            if (!is_callable($plugin_func)) {
619
                $message = "compiler function '$tag_command' is not implemented";
620
                $have_function = false;
621
            }
622
        }
623
        /*
624
         * Otherwise we need to load plugin file and look for the function
625
         * inside it.
626
         */
627
        else if ($plugin_file = $this->_get_plugin_filepath('compiler', $tag_command)) {
628
            $found = true;
629
630
            include_once $plugin_file;
631
632
            $plugin_func = 'smarty_compiler_' . $tag_command;
633
            if (!is_callable($plugin_func)) {
634
                $message = "plugin function $plugin_func() not found in $plugin_file\n";
635
                $have_function = false;
636
            } else {
637
                $this->_plugins['compiler'][$tag_command] = array($plugin_func, null, null, null, true);
638
            }
639
        }
640
641
        /*
642
         * True return value means that we either found a plugin or a
@@ 690-715 (lines=26) @@
687
         * First we check if the block function has already been registered
688
         * or loaded from a plugin file.
689
         */
690
        if (isset($this->_plugins['block'][$tag_command])) {
691
            $found = true;
692
            $plugin_func = $this->_plugins['block'][$tag_command][0];
693
            if (!is_callable($plugin_func)) {
694
                $message = "block function '$tag_command' is not implemented";
695
                $have_function = false;
696
            }
697
        }
698
        /*
699
         * Otherwise we need to load plugin file and look for the function
700
         * inside it.
701
         */
702
        else if ($plugin_file = $this->_get_plugin_filepath('block', $tag_command)) {
703
            $found = true;
704
705
            include_once $plugin_file;
706
707
            $plugin_func = 'smarty_block_' . $tag_command;
708
            if (!function_exists($plugin_func)) {
709
                $message = "plugin function $plugin_func() not found in $plugin_file\n";
710
                $have_function = false;
711
            } else {
712
                $this->_plugins['block'][$tag_command] = array($plugin_func, null, null, null, true);
713
714
            }
715
        }
716
717
        if (!$found) {
718
            return false;
@@ 775-800 (lines=26) @@
772
         * First we check if the custom function has already been registered
773
         * or loaded from a plugin file.
774
         */
775
        if (isset($this->_plugins['function'][$tag_command])) {
776
            $found = true;
777
            $plugin_func = $this->_plugins['function'][$tag_command][0];
778
            if (!is_callable($plugin_func)) {
779
                $message = "custom function '$tag_command' is not implemented";
780
                $have_function = false;
781
            }
782
        }
783
        /*
784
         * Otherwise we need to load plugin file and look for the function
785
         * inside it.
786
         */
787
        else if ($plugin_file = $this->_get_plugin_filepath('function', $tag_command)) {
788
            $found = true;
789
790
            include_once $plugin_file;
791
792
            $plugin_func = 'smarty_function_' . $tag_command;
793
            if (!function_exists($plugin_func)) {
794
                $message = "plugin function $plugin_func() not found in $plugin_file\n";
795
                $have_function = false;
796
            } else {
797
                $this->_plugins['function'][$tag_command] = array($plugin_func, null, null, null, true);
798
799
            }
800
        }
801
802
        if (!$found) {
803
            return false;