Exemplo n.º 1
0
 function loadWidget($widget, $params = array())
 {
     if (strlen($widget) <= 0) {
         return;
     }
     if (!Widgets::isEnabled($widget)) {
         return;
     }
     $widget = str_replace(".", "/", str_replace("/", "", $widget));
     $cachePath = _metaCache("WIDGETS", $widget);
     if (!$cachePath) {
         $path = getAllWidgetsFolders();
         foreach ($path as $a) {
             $f1 = ROOT . $a . $widget . "/index.php";
             $f2 = ROOT . $a . $widget . ".php";
             if (file_exists($f1)) {
                 _metaCacheUpdate("WIDGETS", $widget, $f1);
                 Widgets::printWidget($widget, $f1, $params);
                 return false;
             } elseif (file_exists($f2)) {
                 _metaCacheUpdate("WIDGETS", $widget, $f2);
                 Widgets::printWidget($widget, $f2, $params);
                 return false;
             }
         }
         if (MASTER_DEBUG_MODE == 'true') {
             trigger_logikserror("Widget Not Found :: " . $widget, E_LOGIKS_ERROR, 404);
         }
     } else {
         Widgets::printWidget($widget, $cachePath, $params);
         return false;
     }
 }