public function widgetData() { $sData = $this->getData(); if ($sData) { return RichtextUtil::parseStorageForBackendOutput($sData)->render(); } return ''; }
public function getBodyTruncated($iLength = 70) { $sText = ''; if (is_resource($this->getBody())) { $sText = RichtextUtil::parseStorageForBackendOutput(stream_get_contents($this->getBody()))->render(); $sText = strip_tags($sText); } if ($iLength) { return StringUtil::truncate($sText, $iLength); } return $sText; }
public function postUp($manager) { foreach (JournalEntryQuery::create()->find() as $oEntry) { $sOldText = $oEntry->getText(); $sText = RichtextUtil::parseStorageForBackendOutput($sOldText); $oUtil = new RichtextUtil(); $oEntry->setText($oUtil->getTagParser($sText)); assert($sOldText === $oEntry->getText()); $oEntry->save(); } // add the post-migration code here }
public function loadData() { $oDocumentation = DocumentationQuery::create()->findPk($this->iDocumentationId); $aResult = $oDocumentation->toArray(); $aResult['CreatedInfo'] = Util::formatCreatedInfo($oDocumentation); $aResult['UpdatedInfo'] = Util::formatUpdatedInfo($oDocumentation); $sDescription = ''; if (is_resource($oDocumentation->getDescription())) { $sDescription = RichtextUtil::parseStorageForBackendOutput(stream_get_contents($oDocumentation->getDescription()))->render(); } else { $sDescription = $oDocumentation->getDescription(); } $aResult['Description'] = $sDescription; return $aResult; }
public function loadData() { $oDocumentationPart = DocumentationPartQuery::create()->findPk($this->iDocumentationPartId); if ($oDocumentationPart === null) { return array(); } $aResult = $oDocumentationPart->toArray(); $aResult['CreatedInfo'] = Util::formatCreatedInfo($oDocumentationPart); $aResult['UpdatedInfo'] = Util::formatUpdatedInfo($oDocumentationPart); $sBody = ''; if (is_resource($oDocumentationPart->getBody())) { $sBody = RichtextUtil::parseStorageForBackendOutput(stream_get_contents($oDocumentationPart->getBody()))->render(); } $aResult['Body'] = $sBody; return $aResult; }
public function getRssAttributes($oJournalPage = null, $bIsForRpc = false) { $aResult = array(); $aResult['title'] = $this->getTitle(); $aJournalPageLink = $this->getLink($oJournalPage); $aResult['link'] = LinkUtil::absoluteLink(LinkUtil::link($aJournalPageLink, 'FrontendManager'), null, LinkUtil::isSSL()); if ($bIsForRpc) { $aResult['description'] = RichtextUtil::parseStorageForBackendOutput($this->getText())->render(); } else { $aResult['description'] = RichtextUtil::parseStorageForFrontendOutput($this->getText())->render(); } $aResult['author'] = $this->getUserRelatedByCreatedBy()->getEmail() . ' (' . $this->getUserRelatedByCreatedBy()->getFullName() . ')'; $aTags = TagPeer::tagInstancesForObject($this); $aCategories = array(); foreach ($aTags as $oTag) { $aCategories[] = $oTag->getTagName(); } $aResult[$bIsForRpc ? 'categories' : 'category'] = $aCategories; if ($aJournalPageLink) { $aResult['guid'] = $aResult['link']; } else { $aResult['guid'] = array('isPermaLink' => 'false', '__content' => $this->getId() . "-" . $this->getJournal()->getId()); } $aResult['pubDate'] = date(DATE_RSS, (int) $this->getCreatedAtTimestamp()); if ($bIsForRpc) { $aResult['dateCreated'] = new xmlrpcval(iso8601_encode((int) $this->getCreatedAtTimestamp()), 'dateTime.iso8601'); $aResult['date_created_gmt'] = new xmlrpcval(iso8601_encode((int) $this->getCreatedAtTimestamp(), 1), 'dateTime.iso8601'); $aResult['postid'] = $this->getId(); } else { $aEnclosures = array(); foreach ($this->getImages() as $oImage) { $oDocument = $oImage->getDocument(); $aEnclosures[] = array('length' => $oDocument->getDataSize(), 'type' => $oDocument->getMimetype(), 'url' => LinkUtil::absoluteLink($oDocument->getLink(), null, LinkUtil::isSSL())); } $aResult['enclosure'] = $aEnclosures; } return $aResult; }
public function loadData() { $oJournalEntry = JournalEntryPeer::retrieveByPK($this->iJournalEntryId); if (!$oJournalEntry) { return; } $aResult = array(); $aResult = $oJournalEntry->toArray(); $aResult['Text'] = RichtextUtil::parseStorageForBackendOutput($aResult['Text'])->render(); $aResult['PublishAt'] = $oJournalEntry->getPublishAt('d.m.Y'); $aResult['CreatedInfo'] = Util::formatCreatedInfo($oJournalEntry); $aResult['UpdatedInfo'] = Util::formatUpdatedInfo($oJournalEntry); $aResult['comments'] = array(); foreach (JournalCommentQuery::create()->filterByJournalEntryId($this->iJournalEntryId)->orderByCreatedAt(Criteria::DESC)->find() as $oComment) { $aComment = array(); $aComment['CreatedAtFormatted'] = $oComment->getCreatedAtFormatted(); $aComment['Id'] = $oComment->getId(); $aComment['Email'] = $oComment->getEmail(); $aComment['Text'] = strip_tags($oComment->getText()); $aComment['IsPublished'] = $oComment->getIsPublished(); $aResult['comments'][] = $aComment; } return $aResult; }
public function getNewsletterBody($sTemplateName = null) { if ($sTemplateName) { return self::getNewsletterBodyTemplateByName($sTemplateName)->__toString(); } $oNewsletter = NewsletterQuery::create()->findPk($this->iNewsletterId); if ($oNewsletter !== null && $oNewsletter->getNewsletterBody() !== null) { return RichtextUtil::parseStorageForBackendOutput(stream_get_contents($oNewsletter->getNewsletterBody()))->__toString(); } else { if ($oNewsletter !== null) { $sTemplateName = $oNewsletter->getTemplateName(); return self::getNewsletterBodyTemplateByName($sTemplateName)->__toString(); } } return null; }