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; } }
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; } }
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; }
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; } } }
function loadHelpers($helperNames, $path = "*", $type = "include_once") { if (is_array($helperNames)) { foreach ($helperNames as $x => $a) { $b = loadHelpers($a); } } else { $cachePath = _metaCache("HELPERS", $helperNames); if (!$cachePath || !file_exists($cachePath)) { $helperPath = helper_exists($helperNames); } else { $helperPath = $cachePath; } if (file_exists($helperPath)) { if ($type == "require_once") { require_once $helperPath; } elseif ($type == "require") { require $helperPath; } elseif ($type == "include_once") { include_once $helperPath; } else { include $helperPath; } } else { trigger_logikserror("Helper Not Found :: " . $helperNames, E_LOGIKS_ERROR, 404); } } }
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; } }