1
0
Fork 0
mirror of https://github.com/Oreolek/ifhub.club.git synced 2024-07-08 09:24:25 +03:00

Plugins fix

This commit is contained in:
Xmk 2013-05-12 08:35:07 +06:00
parent 0adcdc97b1
commit d241d54367
2 changed files with 10 additions and 10 deletions

View file

@ -228,7 +228,7 @@ abstract class Plugin extends LsObject {
*/ */
public function GetVersion() { public function GetVersion() {
preg_match('/^Plugin([\w]+)$/i',get_class($this),$aMatches); preg_match('/^Plugin([\w]+)$/i',get_class($this),$aMatches);
$sPluginXML = Config::Get('path.root.server').'/plugins/'.strtolower($aMatches[1]).'/'.ModulePlugin::PLUGIN_XML_FILE; $sPluginXML = Config::Get('path.root.server').'/plugins/'.func_underscore($aMatches[1]).'/'.ModulePlugin::PLUGIN_XML_FILE;
if($oXml = @simplexml_load_file($sPluginXML)) { if($oXml = @simplexml_load_file($sPluginXML)) {
return (string)$oXml->version; return (string)$oXml->version;
} }
@ -253,8 +253,8 @@ abstract class Plugin extends LsObject {
*/ */
static public function GetPath($sName) { static public function GetPath($sName) {
$sName = preg_match('/^Plugin([\w]+)(_[\w]+)?$/Ui',$sName,$aMatches) $sName = preg_match('/^Plugin([\w]+)(_[\w]+)?$/Ui',$sName,$aMatches)
? strtolower($aMatches[1]) ? func_underscore($aMatches[1])
: strtolower($sName); : func_underscore($sName);
return Config::Get('path.root.server').'/plugins/'.$sName.'/'; return Config::Get('path.root.server').'/plugins/'.$sName.'/';
} }
@ -266,8 +266,8 @@ abstract class Plugin extends LsObject {
*/ */
static public function GetWebPath($sName) { static public function GetWebPath($sName) {
$sName = preg_match('/^Plugin([\w]+)(_[\w]+)?$/Ui',$sName,$aMatches) $sName = preg_match('/^Plugin([\w]+)(_[\w]+)?$/Ui',$sName,$aMatches)
? strtolower($aMatches[1]) ? func_underscore($aMatches[1])
: strtolower($sName); : func_underscore($sName);
return Config::Get('path.root.web').'/plugins/'.$sName.'/'; return Config::Get('path.root.web').'/plugins/'.$sName.'/';
} }
@ -280,8 +280,8 @@ abstract class Plugin extends LsObject {
*/ */
static public function GetTemplatePath($sName) { static public function GetTemplatePath($sName) {
$sName = preg_match('/^Plugin([\w]+)(_[\w]+)?$/Ui',$sName,$aMatches) $sName = preg_match('/^Plugin([\w]+)(_[\w]+)?$/Ui',$sName,$aMatches)
? strtolower($aMatches[1]) ? func_underscore($aMatches[1])
: strtolower($sName); : func_underscore($sName);
if(!isset(self::$aTemplatePath[$sName])) { if(!isset(self::$aTemplatePath[$sName])) {
$aPaths=glob(Config::Get('path.root.server').'/plugins/'.$sName.'/templates/skin/*',GLOB_ONLYDIR); $aPaths=glob(Config::Get('path.root.server').'/plugins/'.$sName.'/templates/skin/*',GLOB_ONLYDIR);
$sTemplateName=($aPaths and in_array(Config::Get('view.skin'),array_map('basename',$aPaths))) $sTemplateName=($aPaths and in_array(Config::Get('view.skin'),array_map('basename',$aPaths)))
@ -302,8 +302,8 @@ abstract class Plugin extends LsObject {
*/ */
static public function GetTemplateWebPath($sName) { static public function GetTemplateWebPath($sName) {
$sName = preg_match('/^Plugin([\w]+)(_[\w]+)?$/Ui',$sName,$aMatches) $sName = preg_match('/^Plugin([\w]+)(_[\w]+)?$/Ui',$sName,$aMatches)
? strtolower($aMatches[1]) ? func_underscore($aMatches[1])
: strtolower($sName); : func_underscore($sName);
if(!isset(self::$aTemplateWebPath[$sName])) { if(!isset(self::$aTemplateWebPath[$sName])) {
$aPaths=glob(Config::Get('path.root.server').'/plugins/'.$sName.'/templates/skin/*',GLOB_ONLYDIR); $aPaths=glob(Config::Get('path.root.server').'/plugins/'.$sName.'/templates/skin/*',GLOB_ONLYDIR);
$sTemplateName=($aPaths and in_array(Config::Get('view.skin'),array_map('basename',$aPaths))) $sTemplateName=($aPaths and in_array(Config::Get('view.skin'),array_map('basename',$aPaths)))

View file

@ -254,7 +254,7 @@ class Router extends LsObject {
if(!preg_match('/^Plugin([\w]+)_Action([\w]+)$/i',$sActionClass,$aMatches)) { if(!preg_match('/^Plugin([\w]+)_Action([\w]+)$/i',$sActionClass,$aMatches)) {
require_once(Config::Get('path.root.server').'/classes/actions/'.$sActionClass.'.class.php'); require_once(Config::Get('path.root.server').'/classes/actions/'.$sActionClass.'.class.php');
} else { } else {
require_once(Config::Get('path.root.server').'/plugins/'.strtolower($aMatches[1]).'/classes/actions/Action'.ucfirst($aMatches[2]).'.class.php'); require_once(Config::Get('path.root.server').'/plugins/'.func_underscore($aMatches[1]).'/classes/actions/Action'.ucfirst($aMatches[2]).'.class.php');
} }
$sClassName=$sActionClass; $sClassName=$sActionClass;