/** * Creates an object of the given type. Returns the created object. * * @param string $p_objectType * @return object */ private function createObject($p_objectType) { $p_objectType = CampContext::TranslateProperty($p_objectType); $classFullPath = $GLOBALS['g_campsiteDir'] . '/template_engine/metaclasses/' . CampContext::ObjectType($p_objectType) . '.php'; if (file_exists($classFullPath)) { require_once $classFullPath; } elseif (class_exists(CampContext::$m_objectTypes[$p_objectType]['class'])) { $className = CampContext::ObjectType($p_objectType); } else { $pluginImplementsClassFullPath = false; foreach (CampPlugin::GetEnabled() as $CampPlugin) { $pluginClassFullPath = $GLOBALS['g_campsiteDir'] . '/' . $CampPlugin->getBasePath() . '/template_engine/metaclasses/' . CampContext::ObjectType($p_objectType) . '.php'; if (file_exists($pluginClassFullPath)) { $pluginImplementsClassFullPath = $pluginClassFullPath; } } if ($pluginImplementsClassFullPath) { require_once $pluginImplementsClassFullPath; } else { throw new InvalidObjectException($p_objectType); } } $className = CampContext::ObjectType($p_objectType); $this->m_objects[$p_objectType] = new $className(); return $this->m_objects[$p_objectType]; }
public function testTranslateProperty() { $this->assertEquals('testproperty', CampContext::TranslateProperty('TestProperty')); }