public function saveData($aDocumentationData)
 {
     if ($this->iDocumentationId === null) {
         $oDocumentation = new Documentation();
     } else {
         $oDocumentation = DocumentationQuery::create()->findPk($this->iDocumentationId);
     }
     $oRichtextUtil = new RichtextUtil();
     $oRichtextUtil->setTrackReferences($oDocumentation);
     $oDocumentation->setDescription($oRichtextUtil->parseInputFromEditor($aDocumentationData['description']));
     $oDocumentation->setName($aDocumentationData['name']);
     $oDocumentation->setTitle($aDocumentationData['title']);
     $oDocumentation->setKey($aDocumentationData['key']);
     if (isset($aDocumentationData['name_space'])) {
         $oDocumentation->setNameSpace($aDocumentationData['name_space']);
     }
     $oDocumentation->setVersion($aDocumentationData['version']);
     $oDocumentation->setTitle($aDocumentationData['title']);
     $oDocumentation->setIsPublished($aDocumentationData['is_published']);
     $oDocumentation->setYoutubeUrl($aDocumentationData['youtube_url']);
     if ($oDocumentation->getYoutubeUrl() == null) {
         $oDocumentation->setYoutubeUrl(null);
     }
     $this->validate($aDocumentationData, $oDocumentation);
     if (!Flash::noErrors()) {
         throw new ValidationException();
     }
     return $oDocumentation->save();
 }
 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
 }
 /** send()
  * Description:
  * • This method is called when NewsletterMailer is instanciated
  * • All newsletter, sender and recipient info are ready
  *
  * @return boolean has_invalid email addresses
  */
 public function send()
 {
     // Get newsletter email main template and template body and css by template name
     $oEmailTemplate = new Template('main', array(DIRNAME_TEMPLATES, 'newsletter'));
     $oEmailTemplate->replaceIdentifier('newsletter_template_css', new Template("{$this->oNewsletter->getTemplateName()}.css", array(DIRNAME_TEMPLATES, 'newsletter')));
     // Parse links differently in text
     RichtextUtil::$USE_ABSOLUTE_LINKS = LinkUtil::isSSL();
     $oEMailContent = RichtextUtil::parseStorageForFrontendOutput(stream_get_contents($this->oNewsletter->getNewsletterBody()));
     RichtextUtil::$USE_ABSOLUTE_LINKS = null;
     // Replace add surrounding (body.tmpl) before content if exists. Template needs to contain a newsletter_content identifier
     if (ResourceFinder::findResource(array(DIRNAME_TEMPLATES, NewsletterDetailWidgetModule::NEWSLETTER_DIRNAME, "{$this->oNewsletter->getTemplateName()}.body.tmpl")) !== null) {
         $oEmailTemplate->replaceIdentifier('newsletter_content', new Template("{$this->oNewsletter->getTemplateName()}.body", array(DIRNAME_TEMPLATES, NewsletterDetailWidgetModule::NEWSLETTER_DIRNAME)), null, Template::LEAVE_IDENTIFIERS);
     }
     $oEmailTemplate->replaceIdentifier('newsletter_content', $oEMailContent, null, Template::LEAVE_IDENTIFIERS);
     $oEmailTemplate->replaceIdentifier('subject', $this->oNewsletter->getSubject());
     $oEmailTemplate->replaceIdentifier('language', $this->oNewsletter->getLanguageId());
     $oEmailTemplate->replaceIdentifier('newsletter_link', LinkUtil::absoluteLink($this->oNewsletter->getDisplayLink()));
     $oEmailTemplate->replaceIdentifier('newsletter_date', LocaleUtil::localizeDate(null, $this->oNewsletter->getLanguageId()));
     $oEmailTemplate->replaceIdentifier('newsletter_timestamp', time());
     // Process templates with each recipient, depending on whether recipient is object and object of Subscriber or string
     foreach ($this->aRecipients as $mRecipient) {
         $this->sendNewsletter($mRecipient, clone $oEmailTemplate);
     }
     return count($this->aInvalidEmails) === 0;
 }
 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 saveData($aDocumentationPartData)
 {
     if ($this->iDocumentationPartId === null) {
         $oDocumentationPart = new DocumentationPart();
     } else {
         $oDocumentationPart = DocumentationPartQuery::create()->findPk($this->iDocumentationPartId);
     }
     $this->validate($aDocumentationPartData);
     $oDocumentationPart->setName($aDocumentationPartData['name']);
     $oDocumentationPart->setKey($aDocumentationPartData['key']);
     $oDocumentationPart->setIsOverview($aDocumentationPartData['is_overview']);
     $oDocumentationPart->setIsPublished($aDocumentationPartData['is_published']);
     $oDocumentationPart->setDocumentationId($aDocumentationPartData['documentation_id']);
     $oDocumentationPart->setLanguageId($oDocumentationPart->getDocumentation()->getLanguageId());
     $oDocumentationPart->setImageId($aDocumentationPartData['image_id'] != null ? $aDocumentationPartData['image_id'] : null);
     if ($oDocumentationPart->getTitle() == null) {
         $oDocumentationPart->setTitle(null);
     }
     $oRichtextUtil = new RichtextUtil();
     $oRichtextUtil->setTrackReferences($oDocumentationPart);
     $oDocumentationPart->setBody($oRichtextUtil->parseInputFromEditor($aDocumentationPartData['body']));
     if ($oDocumentationPart->isNew() && is_numeric($oDocumentationPart->getDocumentationId())) {
         $oDocumentationPart->setSort(DocumentationPartQuery::create()->filterByDocumentationId($oDocumentationPart->getDocumentationId())->count() + 1);
     }
     if ($aDocumentationPartData['image_id'] == null && $oDocumentationPart->getDocument()) {
         $oDocumentationPart->getDocument()->delete();
     }
     if (!Flash::noErrors()) {
         // Don't validate on file upload but set is_published to false if there are errors
         if ($aDocumentationPartData['documentation_id'] != null && $aDocumentationPartData['is_file_upload']) {
             $oDocumentationPart->setIsPublished(false);
         } else {
             throw new ValidationException();
         }
     }
     $oDocumentationPart->save();
     return $oDocumentationPart->getId();
 }
 private function renderRecentJournalEntryTeaser($mJournalId)
 {
     $oJournalEntry = FrontendJournalEntryQuery::create()->filterByJournalId($mJournalId)->mostRecentFirst()->findOne();
     if ($oJournalEntry === null) {
         return null;
     }
     $oTemplate = $this->constructTemplate('journal_entry_teaser');
     $sHref = LinkUtil::link($oJournalEntry->getLink($this->oJournalPage));
     $oTemplate->replaceIdentifier('title', TagWriter::quickTag('a', array('href' => $sHref), $oJournalEntry->getTitle()));
     $oTemplate->replaceIdentifier('link_to_detail', $sHref);
     $oTemplate->replaceIdentifier('publish_at', $oJournalEntry->getPublishAt('U'));
     $oTemplate->replaceIdentifier('user_name', $oJournalEntry->getUserRelatedByCreatedBy()->getFullName());
     $sTextShort = RichtextUtil::parseStorageForFrontendOutput($oJournalEntry->getTextShort());
     $oTemplate->replaceIdentifier('text_short', $sTextShort);
     $oTemplate->replaceIdentifier('text_short_truncated', StringUtil::truncate(strip_tags($sTextShort), 300));
     return $oTemplate;
 }
 public function __construct($aRequestPath, Page $oJournalPage = null, $aJournalIds = null)
 {
     if ($aRequestPath === false) {
         $this->oJournalPage = $oJournalPage;
         $this->aJournalIds = $aJournalIds;
     } else {
         parent::__construct($aRequestPath);
         Manager::usePath();
         //the “journal” bit
         $this->oJournalPage = PagePeer::getRootPage()->getPageOfType('journal');
         $sLanguageId = Manager::usePath();
         if (LanguagePeer::languageIsActive($sLanguageId)) {
             Session::getSession()->setLanguage($sLanguageId);
         }
     }
     header("Content-Type: application/rss+xml;charset=" . Settings::getSetting('encoding', 'db', 'utf-8'));
     RichtextUtil::$USE_ABSOLUTE_LINKS = LinkUtil::isSSL();
 }
Example #8
0
 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;
 }
 /**
  * renderFile()
  * @return string xhtml output
  */
 public function renderFile()
 {
     $oOutput = new XHTMLOutput(XHTMLOutput::SETTING_HTML_4_TRANSITIONAL, true, null, $this->oNewsletter->getLanguageId());
     $oOutput->render();
     $oNewsletterTemplate = new Template('main_display', array(DIRNAME_TEMPLATES, 'newsletter'), false, true);
     $oNewsletterTemplate->replaceIdentifier('newsletter_template_css', new Template("{$this->oNewsletter->getTemplateName()}.css", array(DIRNAME_TEMPLATES, 'newsletter')));
     $oNewsletterContent = RichtextUtil::parseStorageForFrontendOutput(stream_get_contents($this->oNewsletter->getNewsletterBody()));
     if (ResourceFinder::findResource(array(DIRNAME_TEMPLATES, NewsletterDetailWidgetModule::NEWSLETTER_DIRNAME, "{$this->oNewsletter->getTemplateName()}.body.tmpl")) !== null) {
         $oNewsletterTemplate->replaceIdentifier('newsletter_content', new Template("{$this->oNewsletter->getTemplateName()}.body", array(DIRNAME_TEMPLATES, NewsletterDetailWidgetModule::NEWSLETTER_DIRNAME)), null, Template::LEAVE_IDENTIFIERS);
     }
     $oNewsletterTemplate->replaceIdentifier('newsletter_content', $oNewsletterContent, null, Template::LEAVE_IDENTIFIERS);
     $oNewsletterTemplate->replaceIdentifier('language', $this->oNewsletter->getLanguageId());
     if ($this->oMailing !== null) {
         $oNewsletterTemplate->replaceIdentifier('newsletter_date', LocaleUtil::localizeDate($this->oMailing->getDateSent(null)->getTimestamp(), $this->oNewsletter->getLanguageId()));
         $oNewsletterTemplate->replaceIdentifier('newsletter_timestamp', $this->oMailing->getDateSent(null)->getTimestamp());
     } else {
         $oNewsletterTemplate->replaceIdentifier('newsletter_date', LocaleUtil::localizeDate($this->oNewsletter->getCreatedAt(null)->getTimestamp(), $this->oNewsletter->getLanguageId()));
         $oNewsletterTemplate->replaceIdentifier('newsletter_timestamp', $this->oNewsletter->getCreatedAt(null)->getTimestamp());
     }
     $oNewsletterTemplate->replaceIdentifier('recipient', TranslationPeer::getString('wns.newsletter.recipient', $this->oNewsletter->getLanguageId()));
     $oNewsletterTemplate->replaceIdentifier('subject', $this->oNewsletter->getSubject());
     $oNewsletterTemplate->render();
 }
 private function contentAction()
 {
     $sLanguageId = Manager::usePath();
     $sDocumentationKey = Manager::usePath();
     $sPartKey = Manager::usePath();
     RichtextUtil::$USE_ABSOLUTE_LINKS = LinkUtil::isSSL();
     if ($sPartKey) {
         $oPart = DocumentationPartQuery::create()->filterByLanguageId($sLanguageId)->filterByKeys($sDocumentationKey, $sPartKey)->findOne();
         if (!$oPart) {
             if ($sPartKey === self::TUTORIAL_KEY) {
                 return TranslationPeer::getString('wns.documentation.video_tutorial', $sLanguageId, "Tutorial");
             }
             return null;
         }
         return RichtextUtil::parseStorageForFrontendOutput($oPart->getBody())->render();
     } else {
         $oDocumentation = DocumentationQuery::create()->filterByLanguageId($sLanguageId)->filterByKey($sDocumentationKey)->findOne();
         if (!$oDocumentation) {
             return null;
         }
         $sHtmlOutput = RichtextUtil::parseStorageForFrontendOutput($oDocumentation->getDescription())->render();
         $aParts = $oDocumentation->getDocumentationPartsOrdered();
         if (count($aParts) > 0) {
             $sHtmlOutput .= '<ul class="documentation_parts">';
             foreach ($aParts as $i => $oPart) {
                 $sHtmlOutput .= TagWriter::quickTag('li', array(), self::addPartLink($oPart));
             }
             $sHtmlOutput .= '</ul>';
         }
         $bDisplayVideo = false;
         if ($bDisplayVideo && $oDocumentation->getYoutubeUrl()) {
             $sHtmlOutput .= $this->embedVideo($oDocumentation->getYoutubeUrl());
         }
         return $sHtmlOutput;
     }
 }
 public function saveData($aNewsletterData)
 {
     $oNewsletter = NewsletterQuery::create()->findPk($this->iNewsletterId);
     if ($oNewsletter === null) {
         $oNewsletter = new Newsletter();
         $oNewsletter->setCreatedBy(Session::getSession()->getUserId());
         $oNewsletter->setCreatedAt(date('c'));
     }
     // If language is not set (not multilingual), write session language, since it is default language
     $sLanguageId = isset($aNewsletterData['language_id']) ? $aNewsletterData['language_id'] : Session::language();
     $oNewsletter->setLanguageId($sLanguageId);
     $oNewsletter->setTemplateName($aNewsletterData['template_name']);
     $oNewsletter->setSubject($aNewsletterData['subject']);
     $oRichtextUtil = new RichtextUtil();
     $oRichtextUtil->setTrackReferences($oNewsletter);
     $oNewsletter->setNewsletterBody($oRichtextUtil->parseInputFromEditor($aNewsletterData['newsletter_body']));
     $this->validate($aNewsletterData, $oNewsletter);
     if (!Flash::noErrors()) {
         throw new ValidationException();
     }
     if (isset($aNewsletterData['is_approved'])) {
         $oNewsletter->setIsApproved($aNewsletterData['is_approved']);
     }
     if (isset($aNewsletterData['template_name'])) {
         $oNewsletter->setTemplateName($aNewsletterData['template_name']);
     }
     return $oNewsletter->save();
 }
 /**
  * displayNewsletterDetail()
  *
  * @param int/array subscriber group ids
  *
  * Usage:
  * • alternative view of newsletter_body content only (instead of FileManager view '/get_file/display_newsletter)
  * • directly called by clicking a link in the newsletter_display_list
  * • configured as detail view in case the list view and detail view are displayed in different container
  *
  * @return Template
  */
 private function displayNewsletterDetail($aSubscriberGroupId)
 {
     $this->setNewsletter($aSubscriberGroupId);
     if (self::$NEWSLETTER) {
         $oTemplate = $this->constructTemplate('newsletter_display_detail');
         $oTemplate->replaceIdentifier('body', RichtextUtil::parseStorageForOutput(self::$NEWSLETTER->getNewsletterBody(), false));
         $oTemplate->replaceIdentifier('date_prefix', TranslationPeer::getString('wns.newsletter.newsletter_of_date_prefix'));
         $oTemplate->replaceIdentifier('date', self::$NEWSLETTER->getLastSent());
         return $oTemplate;
     }
 }
 private function renderEntry(JournalEntry $oEntry, Template $oEntryTemplate, $bIsAjax = false)
 {
     $oCommentQuery = JournalCommentQuery::create()->excludeUnverified();
     $oEntryTemplate->replaceIdentifier('journal_title', $oEntry->getJournal()->getName());
     $oEntryTemplate->replaceIdentifier('slug', $oEntry->getSlug());
     $oEntryTemplate->replaceIdentifier('name', $oEntry->getSlug());
     $oEntryTemplate->replaceIdentifier('user_name', $oEntry->getUserRelatedByCreatedBy()->getFullName());
     $oEntryTemplate->replaceIdentifier('id', $oEntry->getId());
     $oEntryTemplate->replaceIdentifier('date', LocaleUtil::localizeDate($oEntry->getPublishAtTimestamp()));
     $oEntryTemplate->replaceIdentifier('title', $oEntry->getTitle());
     $oEntryTemplate->replaceIdentifier('comment_count', $oEntry->countJournalComments($oCommentQuery));
     // Manager in link has to be set manually for the case when it's called asynchroneously in preview
     $sDetailLink = LinkUtil::link($oEntry->getLink($this->oPage), $this->bIsPreview ? 'PreviewManager' : 'FrontendManager');
     $oEntryTemplate->replaceIdentifier('link', LinkUtil::absoluteLink($sDetailLink), null, LinkUtil::isSSL());
     $oEntryTemplate->replaceIdentifier('detail_link_title', TranslationPeer::getString('journal_entry.add_comment_title', null, null, array('title' => $oEntry->getTitle())));
     if ($oEntryTemplate->hasIdentifier('text')) {
         $oEntryTemplate->replaceIdentifier('text', RichtextUtil::parseStorageForFrontendOutput($oEntry->getText()));
     }
     if ($oEntryTemplate->hasIdentifier('text_short')) {
         $oEntryTemplate->replaceIdentifier('text_short', RichtextUtil::parseStorageForFrontendOutput($oEntry->getTextShort()));
     }
     if ($this->oEntry !== null && $this->oEntry == $oEntry) {
         $oEntryTemplate->replaceIdentifier('current_class', ' class="current"', null, Template::NO_HTML_ESCAPE);
     }
     if ($oEntryTemplate->hasIdentifier('tags')) {
         $aTagInstances = TagInstanceQuery::create()->filterByModelName('JournalEntry')->filterByTaggedItemId($oEntry->getId())->joinTag()->find();
         foreach ($aTagInstances as $i => $oTagInstance) {
             if ($i > 0) {
                 $oEntryTemplate->replaceIdentifierMultiple('tags', ', ', null, Template::NO_NEWLINE | Template::NO_NEW_CONTEXT);
             }
             $oEntryTemplate->replaceIdentifierMultiple('tags', $oTagInstance->getTag()->getReadableName(), null, Template::NO_NEW_CONTEXT | Template::NO_NEWLINE);
         }
     }
     if ($oEntryTemplate->hasIdentifier('journal_comments')) {
         $oEntryTemplate->replaceIdentifier('journal_comments', $this->renderComments($oEntry->getJournalComments($oCommentQuery), $oEntry, $oEntry === $this->oEntry));
     }
     if ($oEntryTemplate->hasIdentifier('journal_gallery') && $oEntry->countJournalEntryImages() > 0) {
         $oEntryTemplate->replaceIdentifier('journal_gallery', $this->renderGallery($oEntry));
     }
     if ($this->bIsPreview && !$bIsAjax) {
         $oEntryTemplate = TagWriter::quickTag('div', array('class' => 'journal_entry-container filled-container', 'data-entry-id' => $oEntry->getId(), 'data-is-not-shown' => $oEntry->isNotShown(), 'data-template' => $oEntryTemplate->getTemplateName()), $oEntryTemplate);
     }
     return $oEntryTemplate;
 }
 public function saveData($aData)
 {
     $oJournalEntry = JournalEntryPeer::retrieveByPK($this->iJournalEntryId);
     if ($oJournalEntry === null) {
         $oJournalEntry = new JournalEntry();
         $oJournalEntry->setJournalId($this->iJournalId);
     }
     $this->validate($aData);
     if (!Flash::noErrors()) {
         throw new ValidationException();
     }
     $oJournalEntry->setJournalId($aData['journal_id']);
     $oJournalEntry->setTitle($aData['title']);
     $oJournalEntry->setIsPublished($aData['is_published']);
     $oJournalEntry->setPublishAt($aData['publish_at'] == null ? date('c') : $aData['publish_at']);
     $oRichtextUtil = new RichtextUtil();
     $oRichtextUtil->setTrackReferences($oJournalEntry);
     $oJournalEntry->setText($oRichtextUtil->getTagParser($aData['text']));
     $oJournalEntry->save();
     $oResult = new StdClass();
     if ($this->iJournalEntryId === null) {
         $oResult->inserted = true;
     } else {
         $oResult->updated = true;
     }
     $oResult->id = $this->iCategoryId = $oJournalEntry->getId();
     return $oResult;
 }
 public function renderDetail(Documentation $oDocumentation = null)
 {
     if (self::$DOCUMENTATION_PARTS == null) {
         self::$DOCUMENTATION_PARTS = DocumentationPartQuery::create()->filterByDocumentationId($oDocumentation->getId())->filterByIsPublished(true)->orderBySort()->find();
     }
     if ($oDocumentation) {
         $sName = $oDocumentation->getName();
         $sEmbedUrl = $oDocumentation->getYoutubeUrl();
         $sDescription = RichtextUtil::parseStorageForFrontendOutput(stream_get_contents($oDocumentation->getDescription()));
     } else {
         $sName = TranslationPeer::getString('documentations.uncategorized');
         $sEmbedUrl = null;
         $sDescription = null;
     }
     $oTemplate = $this->constructTemplate('documentation');
     // render video if exists
     if ($sEmbedUrl != null) {
         $this->embedVideo($oTemplate, $sEmbedUrl);
     }
     $oTemplate->replaceIdentifier('documentation_name', $sName);
     $oTemplate->replaceIdentifier('description', $sDescription);
     // render parts
     $oPartTmpl = $this->constructTemplate('part');
     $sLinkToSelf = LinkUtil::linkToSelf();
     $bRequiresQuicklinks = count(self::$DOCUMENTATION_PARTS) > 1;
     $oPartLinkPrototype = $this->constructTemplate('part_link');
     foreach (self::$DOCUMENTATION_PARTS as $sKey => $mPart) {
         if ($mPart === true) {
             $mPart = DocumentationPartQuery::create()->filterByKey($sKey)->findOne();
         }
         $bIsOverview = false;
         if ($mPart instanceof DocumentationPart) {
             //Internal documentation
             $sBody = RichtextUtil::parseStorageForFrontendOutput(stream_get_contents($mPart->getBody()));
             $sLinkText = $mPart->getName();
             $sTitle = $mPart->getTitle();
             $sImageUrl = null;
             if ($mPart->getDocument()) {
                 $sImageUrl = $mPart->getDocument()->getDisplayUrl();
                 if (RichtextUtil::$USE_ABSOLUTE_LINKS) {
                     $sImageUrl = LinkUtil::absoluteLink($sImageUrl);
                 }
             }
             $sKey = $mPart->getKey();
             $bIsOverview = $mPart->getIsOverview();
             $sExternalLink = null;
         } else {
             //External documentation
             $aData = DocumentationProviderTypeModule::dataForPart($sKey, Session::language());
             $sBody = new Template($aData['content'], null, true);
             $sLinkText = $aData['title'];
             $sTitle = null;
             $sImageUrl = null;
             $sExternalLink = $aData['url'];
         }
         // Add quick links
         if ($bRequiresQuicklinks) {
             $oPartLink = clone $oPartLinkPrototype;
             $oPartLink->replaceIdentifier('href', $sLinkToSelf . '#' . $sKey);
             $oPartLink->replaceIdentifier('link_text', $sLinkText);
             if ($sTitle != null) {
                 $oPartLink->replaceIdentifier('title', $sTitle);
             }
             $oTemplate->replaceIdentifierMultiple('part_links', $oPartLink, null, Template::NO_NEW_CONTEXT);
         }
         // Add documentation part
         $oPartTemplate = clone $oPartTmpl;
         $oPartTemplate->replaceIdentifier('name', $sLinkText);
         $oPartTemplate->replaceIdentifier('anchor', $sKey);
         $oPartTemplate->replaceIdentifier('href_top', $sLinkToSelf . "#top_of_page");
         $oPartTemplate->replaceIdentifier('external_link', $sExternalLink);
         if ($sImageUrl) {
             $oPartTemplate->replaceIdentifier('image', TagWriter::quickTag('img', array('class' => !$bIsOverview ? 'image_float' : "image_fullwidth", 'src' => $sImageUrl, 'alt' => 'Bildschirmfoto von ' . $sLinkText)));
             $oPartTemplate->replaceIdentifier('margin_left_class', $bIsOverview ? '' : ' margin_left_class');
         }
         $oPartTemplate->replaceIdentifier('content', $sBody);
         $oTemplate->replaceIdentifierMultiple('part', $oPartTemplate);
     }
     return $oTemplate;
 }
Example #16
0
 public static function getContentInfo($oLanguageObject)
 {
     $sText = RichtextUtil::parseStorageForFrontendOutput(stream_get_contents($oLanguageObject->getData()));
     return implode(" ", StringUtil::getWords($sText, true));
 }