$link = $rg->resourceDownloadLink($resource); } else { $link = $rg->resourcePreviewLink($resource); } $markup .= "<img src=\"{$link}\" alt=\"" . $resource->getDescription() . "\" />"; } else { $markup .= $resource->getDescription(); } $markup .= "</a>"; $curItem++; if ($curItem < $numItems) { $markup .= "<br/><br/>"; } MoblogLogger::log("Adding markup {$markup}"); $postBody .= $markup; $postBody = TextFilter::autoP(trim($postBody)); $resNames .= $resource->getDescription(); } // add the article $articles = new Articles(); $article = new Article($request->getTopic(), $postBody, array($category->getId()), $userInfo->getId(), $blogInfo->getId(), POST_STATUS_PUBLISHED, 0); $article->setDateObject(new Timestamp()); // enable or disable comments by default depending on the current config $commentsEnabled = $blogSettings->getValue("comments_enabled"); $article->setCommentsEnabled($commentsEnabled); $result = $articles->addArticle($article); // add an article notification $notifications = new ArticleNotifications(); $notifications->addNotification($result, $blogInfo->getId(), $userInfo->getId()); // reset the cache in case it is enabled CacheControl::resetBlogCache($blogInfo->getId());