Code Duplication    Length = 25-26 lines in 3 locations

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

@@ 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;
@@ 610-634 (lines=25) @@
607
         * First we check if the compiler function has already been registered
608
         * or loaded from a plugin file.
609
         */
610
        if (isset($this->_plugins['compiler'][$tag_command])) {
611
            $found = true;
612
            $plugin_func = $this->_plugins['compiler'][$tag_command][0];
613
            if (!is_callable($plugin_func)) {
614
                $message = "compiler function '$tag_command' is not implemented";
615
                $have_function = false;
616
            }
617
        }
618
        /*
619
         * Otherwise we need to load plugin file and look for the function
620
         * inside it.
621
         */
622
        else if ($plugin_file = $this->_get_plugin_filepath('compiler', $tag_command)) {
623
            $found = true;
624
625
            include_once $plugin_file;
626
627
            $plugin_func = 'smarty_compiler_' . $tag_command;
628
            if (!is_callable($plugin_func)) {
629
                $message = "plugin function $plugin_func() not found in $plugin_file\n";
630
                $have_function = false;
631
            } else {
632
                $this->_plugins['compiler'][$tag_command] = array($plugin_func, null, null, null, true);
633
            }
634
        }
635
636
        /*
637
         * True return value means that we either found a plugin or a
@@ 685-710 (lines=26) @@
682
         * First we check if the block function has already been registered
683
         * or loaded from a plugin file.
684
         */
685
        if (isset($this->_plugins['block'][$tag_command])) {
686
            $found = true;
687
            $plugin_func = $this->_plugins['block'][$tag_command][0];
688
            if (!is_callable($plugin_func)) {
689
                $message = "block function '$tag_command' is not implemented";
690
                $have_function = false;
691
            }
692
        }
693
        /*
694
         * Otherwise we need to load plugin file and look for the function
695
         * inside it.
696
         */
697
        else if ($plugin_file = $this->_get_plugin_filepath('block', $tag_command)) {
698
            $found = true;
699
700
            include_once $plugin_file;
701
702
            $plugin_func = 'smarty_block_' . $tag_command;
703
            if (!function_exists($plugin_func)) {
704
                $message = "plugin function $plugin_func() not found in $plugin_file\n";
705
                $have_function = false;
706
            } else {
707
                $this->_plugins['block'][$tag_command] = array($plugin_func, null, null, null, true);
708
709
            }
710
        }
711
712
        if (!$found) {
713
            return false;