private function callReplace($component)
    {
        ob_start();

        // Get component from Controller
        if ($component['file'] == 'plugin') {
            // Reusable plugin found in placeholder

            $selected_plugin_file = Plugin::getSelectedPluginValue($component['class']);

            if ($selected_plugin_file) {
                // Require file with plugin class
                $file_with_plugin = Finder::getInstance()
                    ->searchForRealPath($selected_plugin_file, Finder::TYPE_PLUGINS);
                require_once DIR_BASE . $file_with_plugin;

                $plugin_class_name = str_replace('.php', '', $selected_plugin_file);
                $plugin_class_name = str_replace('plugin', 'Plugin', $plugin_class_name); // Just in case

                /** @var Plugin $plugin_object */
                $plugin_object = new $plugin_class_name;
                $plugin_object->render();
            }

        } else {
            // Usual component, try Front site folder
            // Controller
            $this->mvc_instance->setComponentName($component['class']);
            $this->mvc_instance->setModifiers($component['modifiers']);
            $class = ucfirst($component['class']);

            $file = DIR_FRONT_CONTROLLERS . $component['file'] . '.php';
            if (is_file($file)) {
                require_once $file;
                $model_class = $class . 'Controller';
                $this->mvc_instance->setController($model_class);
            }

            // View
            $file = DIR_FRONT_VIEWS . $component['file'] . '.php';
            if (is_file($file)) {
                require_once $file;
                $view_class = $class . 'View';
                $this->mvc_instance->setView($view_class);
            }

            $this->mvc_instance->setMethod($component['method']);

            $this->mvc_instance->outputController();
            $this->mvc_instance->outputView();
        }

        return trim(ob_get_clean());
    }
private function callReplace($component)
    {
        ob_start();

        // Get component from Controller
        if ($component['file'] == 'plugin') {
            // Reusable plugin found in placeholder

            $selected_plugin_file = Plugin::getSelectedPluginValue($component['class']);

            if ($selected_plugin_file) {
                // Require file with plugin class
                $file_with_plugin = Finder::getInstance()
                    ->searchForRealPath($selected_plugin_file, Finder::TYPE_PLUGINS);
                require_once DIR_BASE . $file_with_plugin;

                $plugin_class_name = str_replace('.php', '', $selected_plugin_file);
                $plugin_class_name = str_replace('plugin', 'Plugin', $plugin_class_name); // Just in case

                /** @var Plugin $plugin_object */
                $plugin_object = new $plugin_class_name;
                $plugin_object->render();
            }

        } else {
            // Usual component, try Front site folder
            // Controller
            $this->mvc_instance->setComponentName($component['class']);
            $this->mvc_instance->setModifiers($component['modifiers']);
            $class = ucfirst($component['class']);

            $file = DIR_FRONT_CONTROLLERS . $component['file'] . '.php';
            if (is_file($file)) {
                require_once $file;
                $model_class = $class . 'Controller';
                $this->mvc_instance->setController($model_class);
            }

            // View
            $file = DIR_FRONT_VIEWS . $component['file'] . '.php';
            if (is_file($file)) {
                require_once $file;
                $view_class = $class . 'View';
                $this->mvc_instance->setView($view_class);
            }

            $this->mvc_instance->setMethod($component['method']);

            $this->mvc_instance->outputController();
            $this->mvc_instance->outputView();
        }

        return trim(ob_get_clean());
    }
private function callReplace ( $ component ) { ob_start ( ) ; // Get component from Controller if ( $ component [ 'file' ] == 'plugin' ) { // Reusable plugin found in placeholder $ selected_plugin_file = Plugin :: getSelectedPluginValue ( $ component [ 'class' ] ) ; if ( $ selected_plugin_file ) { // Require file with plugin class $ file_with_plugin = Finder :: getInstance ( ) -> searchForRealPath ( $ selected_plugin_file , Finder :: TYPE_PLUGINS ) ; require_once DIR_BASE . $ file_with_plugin ; $ plugin_class_name = str_replace ( '.php' , '' , $ selected_plugin_file ) ; $ plugin_class_name = str_replace ( 'plugin' , 'Plugin' , $ plugin_class_name ) ; // Just in case /** @var Plugin $plugin_object */ $ plugin_object = new $ plugin_class_name ; $ plugin_object -> render ( ) ; } } else { // Usual component, try Front site folder // Controller $ this -> mvc_instance -> setComponentName ( $ component [ 'class' ] ) ; $ this -> mvc_instance -> setModifiers ( $ component [ 'modifiers' ] ) ; $ class = ucfirst ( $ component [ 'class' ] ) ; $ file = DIR_FRONT_CONTROLLERS . $ component [ 'file' ] . '.php' ; if ( is_file ( $ file ) ) { require_once $ file ; $ model_class = $ class . 'Controller' ; $ this -> mvc_instance -> setController ( $ model_class ) ; } // View $ file = DIR_FRONT_VIEWS . $ component [ 'file' ] . '.php' ; if ( is_file ( $ file ) ) { require_once $ file ; $ view_class = $ class . 'View' ; $ this -> mvc_instance -> setView ( $ view_class ) ; } $ this -> mvc_instance -> setMethod ( $ component [ 'method' ] ) ; $ this -> mvc_instance -> outputController ( ) ; $ this -> mvc_instance -> outputView ( ) ; } return trim ( ob_get_clean ( ) ) ; }
Replace one component value with real data set in admin panel for requested page
No check for file existance in it method - for speeding up processing.
Anyway, you will receive standard php error if requested file is not found.
@param array $component
@return string
Replace one component value with real data set in admin panel for requested page No check for file existance in it method - for speeding up processing . Anyway you will receive standard php error if requested file is not found .