Changeset 938
- Timestamp:
- 06/06/10 17:46:03 (20 months ago)
- Location:
- trunk/engine/classes
- Files:
-
- 2 modified
-
Engine.class.php (modified) (3 diffs)
-
Router.class.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/engine/classes/Engine.class.php
r926 r938 43 43 protected $iTimeInit=null; 44 44 45 /** 46 * Массив содержит меппер кастомизации сущностей 47 * 48 * @var arrat 49 */ 50 static protected $aEntityCustoms=array(); 51 45 52 46 /** 53 47 * При создании объекта делаем инициализацию … … 486 480 throw new Exception("Unknown entity '{$sName}' given."); 487 481 } 488 489 /** 490 * Проверяем наличие сущности в меппере кастомизации 491 */ 492 if(array_key_exists($sName,self::$aEntityCustoms)) { 493 $sEntity = (self::$aEntityCustoms[$sName]=='custom') 494 ? $sEntity.'_custom' 495 : $sEntity; 496 } else { 497 $sFileDefaultClass=isset($sPlugin) 498 ? Config::get('path.root.server').'/plugins/'.strtolower($sPlugin).'/classes/modules/'.strtolower($sModule).'/entity/'.$sEntity.'.entity.class.php' 499 : Config::get('path.root.server').'/classes/modules/'.strtolower($sModule).'/entity/'.$sEntity.'.entity.class.php'; 500 501 $sFileCustomClass=isset($sPlugin) 502 ? Config::get('path.root.server').'/plugins/'.strtolower($sPlugin).'/classes/modules/'.strtolower($sModule).'/entity/'.$sEntity.'.entity.class.custom.php' 503 : Config::get('path.root.server').'/classes/modules/'.strtolower($sModule).'/entity/'.$sEntity.'.entity.class.custom.php'; 504 505 /** 506 * Пытаемся найти кастомизированную сущность 507 */ 508 if(file_exists($sFileCustomClass)) { 509 $sFileClass=$sFileCustomClass; 510 $sEntity.='_custom'; 511 self::$aEntityCustoms[$sName]='custom'; 512 } elseif(file_exists($sFileDefaultClass)) { 513 $sFileClass=$sFileDefaultClass; 514 self::$aEntityCustoms[$sName]='default'; 515 } else { 516 throw new Exception('Entity class not found'); 517 return null; 518 } 519 /** 520 * Подгружаем нужный файл 521 */ 522 require_once($sFileClass); 523 } 524 482 525 483 $sClass=isset($sPlugin) 526 484 ? 'Plugin'.$sPlugin.'_Module'.$sModule.'_Entity'.$sEntity … … 549 507 $tm1=microtime(true); 550 508 551 $sFileClass= (substr($aMatch[2],-7)=='_custom') 552 ? Config::get('path.root.server').'/classes/modules/'.strtolower($aMatch[1]).'/entity/'.substr($aMatch[2],0,strlen($aMatch[2])-7).'.entity.class.custom.php' 553 : Config::get('path.root.server').'/classes/modules/'.strtolower($aMatch[1]).'/entity/'.$aMatch[2].'.entity.class.php'; 509 $sFileClass=Config::get('path.root.server').'/classes/modules/'.strtolower($aMatch[1]).'/entity/'.$aMatch[2].'.entity.class.php'; 554 510 555 511 if (file_exists($sFileClass)) { -
trunk/engine/classes/Router.class.php
r915 r938 180 180 if(!preg_match('/^Plugin([\w]+)_Action([\w]+)$/i',$sActionClass,$aMatches)) { 181 181 require_once(Config::Get('path.root.server').'/classes/actions/'.$sActionClass.'.class.php'); 182 $sPrefixCustom='';183 if (file_exists(Config::Get('path.root.server')."/classes/actions/".$sActionClass.'.class.custom.php')) {184 require_once(Config::Get('path.root.server')."/classes/actions/".$sActionClass.'.class.custom.php');185 $sPrefixCustom='_custom';186 }187 182 } else { 188 183 require_once(Config::Get('path.root.server').'/plugins/'.strtolower($aMatches[1]).'/classes/actions/Action'.ucfirst($aMatches[2]).'.class.php'); 189 $sPrefixCustom=''; 190 } 191 192 $sClassName=$sActionClass.$sPrefixCustom; 184 } 185 186 $sClassName=$sActionClass; 193 187 $this->oAction=new $sClassName($this->oEngine,self::$sAction); 194 188
