* @copyright 2004 by http://wombat.exit0.net * @package wombatSite * @subpackage factory */ /** * creator class * * implement specialized create function. * * @version 0.1 */ class wbFactory_patTemplate { /** * special creator for Image manager * * @static * @access private * @param array $params mixed parameter to modify the creation process * @return object $obj reference to the created object * @see create() */ function &create( $params ) { $obj = new patTemplate(); $obj->setOption( 'maintainBc', false ); $baseDir = wbFactory::getParam( 'baseDir' ); // set template folder $tmplDir = $baseDir . '/templates'; if( isset( $params['tmplDir'] ) ) { $tmplDir = $params['tmplDir']; } $obj->setRoot( $tmplDir ); // ignore notice for reloading templates patErrorManager::addIgnore( 6051 ); // register custom module folders $systemDir = wbFactory::getParam( 'systemDir' ); $incDirs = array( $baseDir ); if( $baseDir != $systemDir ) { $incDirs[] = $systemDir; } foreach( $incDirs as $incDir ) { // configure include dir $moduleDir = $incDir . '/include' . '/patExtension/Template'; $obj->addModuleDir( 'Function', $moduleDir . '/Function' ); $obj->addModuleDir( 'Modifier', $moduleDir . '/Modifier' ); $obj->addModuleDir( 'TemplateCache', $moduleDir . '/TemplateCache' ); } // enable caching if( wbFactory::getParam( 'useCache' ) ) { $cacheDir = $baseDir . '/' . wbFactory::getParam( 'varDir' ) . '/cache/patTemplate/' . $tmplDir; wbFactory::includeClass( 'wbFile' ); wbFile::mkDir( $cacheDir ); $obj->useTemplateCache( 'FileLocale', array( 'cacheFolder' => $cacheDir, 'lifetime' => 'auto', 'filemode' => 0666 ) ); } return $obj; } } ?>