Esempio n. 1
0
 private function render($parms)
 {
     if (!$this->get_wdir() || !$this->get_name()) {
         return null;
     }
     if (!mapi_include_abs_path($this->get_name(), $this->get_wdir())) {
         return null;
     }
     $function = 'mwidget_' . $this->get_name();
     if (!function_exists($function)) {
         return null;
     }
     ob_start();
     if (is_array($parms)) {
         call_user_func_array($function, $parms);
     } elseif (!empty($parms)) {
         $function($parms);
     } else {
         $function();
     }
     if (isset($this->object)) {
         $module->object = $this->object;
     }
     $this->content = ob_get_contents();
     ob_end_clean();
 }
Esempio n. 2
0
 private function mapibin($path)
 {
     if (!mapi_include_abs_path($path, 'bin')) {
         return null;
     }
     return true;
 }
Esempio n. 3
0
 private function recaptcha($path)
 {
     if (!mapi_include_abs_path($path, 'lib')) {
         return false;
     }
     return true;
 }
Esempio n. 4
0
 static function check_widget($widget)
 {
     if (!MValidate::ext_name($widget)) {
         return false;
     }
     if (!mapi_include_abs_path($widget, 'widgets/' . $widget)) {
         return false;
     }
     $widget_function = 'mwidget_' . strtolower($widget);
     if (!function_exists($widget_function)) {
         return false;
     }
     $markdown = self::markdown('widget', $widget);
     if (!isset($markdown['title']) || !strlen($markdown['title']) > 1) {
         return false;
     }
     if (!isset($markdown['version']) || !strlen($markdown['version']) > 0) {
         return false;
     }
     return true;
 }
Esempio n. 5
0
 private function run()
 {
     if (!$this->get_wdir() || !$this->get_name()) {
         die('M_ERROR (00202): Cannot load module: Module details are missing');
     }
     if (!mapi_include_abs_path($this->get_name(), $this->get_wdir())) {
         die('M_ERROR (00203): Cannot load module: Init file missing or not readable');
     }
     $controller_class = 'MModule_' . $this->get_name();
     if (!class_exists($controller_class)) {
         die('M_ERROR (00204): Cannot load module: Controller is missing');
     }
     $default_function = $this->get_name();
     if (!method_exists($controller_class, $default_function)) {
         die('M_ERROR (00205): Cannot load module: Controller function is missing');
     }
     $module = new $controller_class();
     $this->set_child_details($module);
     ob_start();
     $module->prerun();
     if (isset($this->task)) {
         $module->task = $this->task;
     }
     if (isset($this->object)) {
         $module->object = $this->object;
     }
     $module->{$default_function}();
     $this->run_task($module, $controller_class);
     $module->output = ob_get_contents();
     ob_end_clean();
     return $module;
 }