public static function createPluginByManifest(\SimpleXMLElement $manifest) {
		
		$app = Application::getInstance();
		
		// plugin tree
		$mPlugin = $manifest->plugin;
		
		$mAttributes = $mPlugin->attributes();
		
		// get class name for this plugin (Module, Template, other)
		$class = ucfirst($mAttributes->type);
		
		// add namespace for Pair classes
		if (in_array($class, array('Module', 'Template'))) {
			$class = 'Pair\\' . $class;
		}
		
		// check if plugin is already installed
		if ($class::pluginExists($mPlugin->name)) {
			$app->enqueueError('PLUGIN_IS_ALREADY_INSTALLED');
			return NULL;
		}
		
		// creates plugin object
		$plugin					= new $class();
		$plugin->name			= (string)$mPlugin->name;
		$plugin->version		= (string)$mPlugin->version;
		$plugin->dateReleased	= date('Y-m-d H:i:s', strtotime((string)$mPlugin->dateReleased));
		$plugin->appVersion		= (string)$mPlugin->appVersion;
		$plugin->installedBy	= $app->currentUser->id;
		$plugin->dateInstalled	= new \DateTime();
		
		// saves plugin object to db
		$plugin->storeByPlugin($mPlugin->options);
		
		return $plugin;
		
	}