From b60ef9165432a34f2ccc6504261a0606c3372f48 Mon Sep 17 00:00:00 2001 From: Mzhelskiy Maxim Date: Wed, 11 Aug 2010 11:36:33 +0000 Subject: [PATCH] add new methods --- engine/classes/Engine.class.php | 36 +++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/engine/classes/Engine.class.php b/engine/classes/Engine.class.php index d999ade3..d713223b 100644 --- a/engine/classes/Engine.class.php +++ b/engine/classes/Engine.class.php @@ -516,6 +516,42 @@ class Engine extends Object { $oEntity=new $sClass($aParams); return $oEntity; } + + + + public static function GetPluginName($oModule) { + if (preg_match('/Plugin([^_]+)/',is_string($oModule) ? $oModule : get_class($oModule),$aMatches)) { + if(isset($aMatches[1])) { + return $aMatches[1]; + } + } + return null; + } + + public static function GetPluginPrefix($oModule) { + if($sPluginName = self::GetPluginName($oModule)) { + return 'Plugin'.$sPluginName.'_'; + } + return ''; + } + + public static function GetModuleName($oModule) { + if (preg_match('/Module([^_]+)/',is_string($oModule) ? $oModule : get_class($oModule),$aMatches)) { + if(isset($aMatches[1])) { + return $aMatches[1]; + } + } + return null; + } + + public static function GetEntityName($oEntity) { + if (preg_match('/Entity([^_]+)/',is_string($oModule) ? $oModule : get_class($oModule),$aMatches)) { + if(isset($aMatches[1])) { + return $aMatches[1]; + } + } + return null; + } } /**