public static function createNew($name, $content, $published, $scope = null, $options = array()) { $user_id = TBGContext::getUser() instanceof TBGUser ? TBGContext::getUser()->getID() : 0; $article = new TBGWikiArticle(); $article->setName($name); $article->setContent($content); $article->setIsPublished($published); if (!isset($options['noauthor'])) { $article->setAuthor($user_id); } else { $article->setAuthor(0); } if ($scope !== null) { $article->setScope($scope); } $article->doSave($options); return $article->getID(); }