Пример #1
0
 function checkVendor($vendor)
 {
     if (strlen($vendor) <= 0) {
         return false;
     }
     $cachePath = _metaCache("VENDORS", $vendor);
     if (!$cachePath || !file_exists($cachePath)) {
         $vendorPath = getLoaderFolders('vendorPath', "vendors");
         $fpath = "";
         foreach ($vendorPath as $a) {
             $f1 = ROOT . $a . $vendor . "/boot.php";
             if (file_exists($f1)) {
                 $fpath = $f1;
                 break;
             } else {
                 $fpath = "";
             }
         }
         if (strlen($fpath) > 0) {
             _metaCacheUpdate("VENDORS", $vendor, $fpath);
             return $fpath;
         } else {
             return false;
         }
     } else {
         return $cachePath;
     }
 }
Пример #2
0
 function checkService($scmd, $supportedEngines = array("php"))
 {
     if (strlen($scmd) <= 0) {
         return false;
     }
     $cachePath = _metaCache("SERVICES", $scmd);
     if (!$cachePath || !file_exists($cachePath)) {
         $modulesFolder = getPluginFolders("modules");
         $cmdArr = array();
         $cmdArr[] = ROOT . APPS_FOLDER . SITENAME . "/services/" . $scmd;
         $cmdArr[] = ROOT . APPS_FOLDER . SITENAME . "/" . APPS_PLUGINS_FOLDER . "modules/" . $scmd . "/service";
         $cmdArr[] = SERVICE_ROOT . "cmds/" . $scmd;
         foreach ($modulesFolder as $path) {
             $cmdArr[] = ROOT . $path . $scmd . "/service";
         }
         $cmdArr = array_unique($cmdArr);
         foreach ($cmdArr as $fl) {
             foreach ($supportedEngines as $ext) {
                 $fpath = "{$fl}.{$ext}";
                 if (file_exists($fpath)) {
                     _metaCacheUpdate("SERVICES", $scmd, $fpath);
                     return array("src" => $fpath, "ext" => $ext);
                 }
             }
         }
     } else {
         $ext = explode(".", $cachePath);
         $ext = end($ext);
         return array("src" => $cachePath, "ext" => $ext);
     }
     return false;
 }
Пример #3
0
 function loadMedia($name, $relativeOnly = false, $defaultMedia = null)
 {
     if (strlen($name) <= 0) {
         return "";
     }
     $cachePath = _metaCache("MEDIA:SITE", $name);
     if (!$cachePath) {
         $paths = getLoaderFolders('mediaPaths', "");
         if (count($paths) > 0) {
             foreach ($paths as $a) {
                 if (file_exists(ROOT . $a . $name)) {
                     _metaCacheUpdate("MEDIA:SITE", $name, $a . $name);
                     if (!$relativeOnly) {
                         return SiteLocation . $a . $name;
                     } else {
                         return $a . $name;
                     }
                 }
             }
         }
         if ($defaultMedia == null) {
             return $name;
         } else {
             $defaultMedia;
         }
     } else {
         if (!$relativeOnly) {
             return SiteLocation . $cachePath;
         } else {
             return $cachePath;
         }
     }
 }
Пример #4
0
 function checkWidget($widget)
 {
     if (strlen($widget) <= 0) {
         return false;
     }
     $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);
                 return $f1;
             } elseif (file_exists($f2)) {
                 _metaCacheUpdate("WIDGETS", $widget, $f2);
                 return $f2;
             }
         }
         return false;
     } else {
         return $cachePath;
     }
 }
Пример #5
0
 function checkModule($module)
 {
     if (strlen($module) <= 0) {
         return false;
     }
     $cachePath = _metaCache("MODULES", $module);
     if (!$cachePath || !file_exists($cachePath)) {
         $modulespath = getLoaderFolders('pluginPaths', "modules");
         $fpath = "";
         foreach ($modulespath as $a) {
             $f1 = ROOT . $a . $module . "/index.php";
             if (file_exists($f1)) {
                 $fpath = $f1;
                 break;
             } else {
                 $fpath = "";
             }
         }
         if (strlen($fpath) > 0) {
             _metaCacheUpdate("MODULES", $module, $fpath);
             return $fpath;
         } else {
             return false;
         }
     } else {
         return $cachePath;
     }
 }
Пример #6
0
 function helper_exists($helper)
 {
     if (is_array($helper)) {
         $helperPath = getAllHelpersFolders();
         $helperArr = array_flip($helper);
         foreach ($helperArr as $ha => $n) {
             $cachePath = _metaCache("HELPERS", $ha);
             if (!$cachePath) {
                 $fpath = "";
                 $b = false;
                 $ext = substr($ha, strlen($ha) - 4);
                 foreach ($helperPath as $path) {
                     $p = ROOT . $path . $ha;
                     if (file_exists($p . ".php")) {
                         $fpath = $p . ".php";
                         $b = true;
                     } elseif (file_exists($p . ".inc")) {
                         $fpath = $p . ".inc";
                         $b = true;
                     }
                 }
                 if ($b) {
                     _metaCacheUpdate("HELPERS", $ha, $fpath);
                     $helperArr[$ha] = $fpath;
                 } else {
                     $helperArr[$ha] = $b;
                 }
             } else {
                 $helperArr[$ha] = $cachePath;
             }
         }
         return $helperArr;
     } else {
         $cachePath = _metaCache("HELPERS", $helper);
         if (!$cachePath) {
             $helperArr = getAllHelpersFolders();
             $b = false;
             $ext = substr($helper, strlen($helper) - 4);
             foreach ($helperArr as $path) {
                 $p = ROOT . $path . $helper;
                 if (file_exists($p . ".php")) {
                     _metaCacheUpdate("HELPERS", $helper, $p . ".php");
                     $cachePath = $p . ".php";
                     $b = true;
                 } elseif (file_exists($p . ".inc")) {
                     _metaCacheUpdate("HELPERS", $helper, $p . ".inc");
                     $cachePath = $p . ".inc";
                     $b = true;
                 }
             }
             if ($b) {
                 return $cachePath;
             } else {
                 return $b;
             }
         } else {
             return $cachePath;
         }
     }
     return false;
 }