setAuthor(trim($match[1])); if(preg_match("#@author\s(.+)\s\<([a-z\@\.A-Z\s\-]+)\>#", $fileLines, $match)) $plugin->setMail(strtolower($match[2])); if(preg_match("#@name\s(.+)[\r\n]#", $fileLines, $match)) $plugin->setName($match[1]); if(preg_match("#@licence\s(.+)[\r\n]#", $fileLines, $match)) $plugin->setLicence($match[1]); if(preg_match("#@version\s(.+)[\r\n]#", $fileLines, $match)) $plugin->setVersion($match[1]); if(preg_match("#@link\s(.+)[\r\n]#", $fileLines, $match)) $plugin->setLink(trim($match[1])); if(preg_match("#@type\s(.+)[\r\n]#", $fileLines, $match)) $plugin->setType(trim($match[1])); if(preg_match("#@description\s(.+)[\r\n]#", $fileLines, $match)) $plugin->setDescription(trim($match[1])); if(Plugin::loadState($pluginFile) || $plugin->getType()=='component'){ $plugin->setState(1); }else{ $plugin->setState(0); } $plugin->setPath($pluginFile); return $plugin; } public static function getAll(){ $pluginFiles = Plugin::getFiles(); $plugins = array(); if(is_array($pluginFiles)) { foreach($pluginFiles as $pluginFile) { $plugin = Plugin::getObject($pluginFile); $plugins[]=$plugin; } } usort($plugins, "Plugin::sortPlugin"); return $plugins; } public static function getFiles($onlyActivated=false){ $enabled = $disabled = array(); $files = glob(dirname(dirname(__FILE__)). Plugin::FOLDER .'/*/*.plugin*.php'); $plugins = array(); foreach($files as $file){ $plugins[] = Plugin::getObject($file); } usort($plugins, "Plugin::sortPlugin"); foreach($plugins as $plugin){ if($plugin->getState() || $plugin->getType() =='component'){ $enabled [] = $plugin->getPath(); }else{ $disabled [] = $plugin->getPath(); } } if(!$onlyActivated)$enabled = array_merge($enabled,$disabled); return $enabled; } public static function addHook($hookName, $functionName) { $GLOBALS['hooks'][$hookName][] = $functionName; } public static function callCss(){ $return=''; if(isset($GLOBALS['hooks']['css_files'])) { foreach($GLOBALS['hooks']['css_files'] as $css_file) { $return .=''."\n"; } } return $return; } public static function addLink($rel, $link) { $GLOBALS['hooks']['head_link'][] = array("rel"=>$rel, "link"=>$link); } public static function callLink(){ $return=''; if(isset($GLOBALS['hooks']['head_link'])) { foreach($GLOBALS['hooks']['head_link'] as $head_link) { $return .=''."\n"; } } return $return; } public static function path(){ $bt = debug_backtrace(); return Functions::relativePath(str_replace('\\','/',dirname(dirname(__FILE__))),str_replace('\\','/',dirname($bt[0]['file']))).'/'; } public static function addCss($css,$force = false) { $bt = debug_backtrace(); $module = isset($_GET['module'])?$_GET['module']:''; $module = isset($_GET['section']) && $module==''?$_GET['section']:$module; $module = isset($_GET['block']) && $module==''?$_GET['block']:$module; $path = Functions::relativePath(str_replace('\\','/',dirname(dirname(__FILE__))),str_replace('\\','/',dirname($bt[0]['file']).$css)); if(strcasecmp(basename(dirname($bt[0]['file'])), $module) == 0 || $force) $GLOBALS['hooks']['css_files'][] = $path; } public static function addJs($js,$force = false){ global $_; $bt = debug_backtrace(); $module = isset($_GET['module'])?$_GET['module']:''; $module = isset($_GET['section']) && $module==''?$_GET['section']:$module; $module = isset($_GET['block']) && $module==''?$_GET['block']:$module; $path = Functions::relativePath(str_replace('\\','/',dirname(dirname(__FILE__))),str_replace('\\','/',dirname($bt[0]['file']).$js)); if(strcasecmp(basename(dirname($bt[0]['file'])), $module) == 0 || $force) $GLOBALS['hooks']['js_files'][] = $path; } public static function callJs(){ $return=''; if(isset($GLOBALS['hooks']['js_files'])) { foreach($GLOBALS['hooks']['js_files'] as $js_file) { $return .=''."\n"; } } return $return; } public static function callHook($hookName, $hookArguments) { //echo '