Example #1
0
 public function show_content($show_content = true)
 {
     //this function run from page class.
     // this function load plugin and run controller
     //checking for that plugin is enabled
     if ($this->obj_plugin->is_enabled($this->plugin)) {
         $PluginName = '\\core\\plugin\\' . $this->plugin;
         $plugin = new $PluginName();
         //run action directly
         if (method_exists($plugin, $this->action)) {
             $content = call_user_func(array($plugin, $this->action), 'content');
         } else {
             if (method_exists($plugin, 'default')) {
                 $content = call_user_func(array($plugin, 'default'), 'content');
             }
             //show 404 page not found page
             $plugin = new plugin\msg();
             $content = call_user_func(array($plugin, 'msg_404'));
             //jump user to 404 page
             $this->jump_page(array('service', '1', 'plugin', 'msg', 'action', 'msg404'));
         }
     } else {
         //plugin is not enabled
         //show 404 page not found page
         $plugin = new plugin\msg();
         $content = call_user_func(array($plugin, 'msg_404'));
         //jump user to 404 page
         $this->jump_page(array('service', '1', 'plugin', 'msg', 'action', 'msg404'));
     }
     browser\page::set_page_tittle($content[0]);
     //show header in up of content or else
     if (sizeof($content) == 3 && $content[2] == false) {
         $output_content = browser\page::show_block('', $content[1], 'MAIN');
     } else {
         $output_content = browser\page::show_block($content[0], $content[1], 'MAIN');
     }
     //show content id show_content was set
     if ($show_content) {
         echo $output_content;
     }
     return $content;
 }