public function onAnyError($aOptions, $bNeverPrint = false, $bNeverNotifyDeveloper = false) { if ($bNeverNotifyDeveloper) { return; } $aProwlConfig = Settings::getSetting('prowl', 'users', array()); $aKeys = array(); foreach ($aProwlConfig as $aConfig) { if (in_array(ErrorHandler::getEnvironment(), $aConfig['environments'])) { $aKeys[] = $aConfig['key']; } } if (count($aKeys) == 0) { return; } $aError =& $aOptions[0]; $aProwlParams = array(); $aProwlParams['apikey'] = implode(',', $aKeys); $aProwlParams['application'] = "Rapila on " . $aError['host']; $aProwlParams['event'] = "Error on in " . $aError['path']; $aProwlParams['url'] = 'http://' . $aError['host'] . $aError['path']; $aProwlParams['description'] = StringUtil::truncate($aError['message'], 800); $sParams = http_build_query($aProwlParams); $rCurl = curl_init('https://api.prowlapp.com/publicapi/add'); curl_setopt($rCurl, CURLOPT_POSTFIELDS, $sParams); curl_setopt($rCurl, CURLOPT_POST, 1); curl_exec($rCurl); }
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; }
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 truncate($oTemplateIdentifier, &$iFlags) { $iFlags |= Template::NO_HTML_ESCAPE; $iLength = 20; if ($oTemplateIdentifier->hasParameter('length')) { $iLength = $oTemplateIdentifier->getParameter('length'); } $sPostfix = "…"; if ($oTemplateIdentifier->hasParameter('postfix')) { $sPostfix = $oTemplateIdentifier->getParameter('postfix'); } $iTolerance = 3; if ($oTemplateIdentifier->hasParameter('tolerance')) { $iTolerance = $oTemplateIdentifier->getParameter('tolerance'); } return StringUtil::truncate($oTemplateIdentifier->getValue(), $iLength, $sPostfix, $iTolerance); }
public function getName($iLength = 20) { $sNewsletterName = $this->getNewsletter() ? $this->getNewsletter()->getSubject() : 'oNewsletter missing!'; return $this->getDateSentFormatted() . StringUtil::truncate($sNewsletterName, $iLength); }
public function getName($iLength = 35) { return StringUtil::truncate($this->getSubject(), $iLength); }
public function getNameTruncated() { return StringUtil::truncate($this->getName(), 50); }
public function getDescriptionTruncated($iLength = 40) { return StringUtil::truncate($this->getDescription(), $iLength); }
/** * renderRecentCommentsWidget() * * description: renders a comments teaser list * change limit count by overwriting the config param "recent_comments_limit" in your site/config/config.yml * @return Template object */ private function renderRecentCommentsWidget() { $oTemplate = $this->constructTemplate('widget_recent_comments'); $oItemPrototype = $this->constructTemplate('widget_recent_comment_item'); $iLimit = Settings::getSetting('journal', 'recent_comments_limit', 3); $oQuery = JournalCommentQuery::create()->excludeUnverified()->mostRecentFirst()->limit($iLimit)->useJournalEntryQuery()->filterByJournalId($this->aJournalIds)->endUse()->groupByJournalEntryId(); foreach ($oQuery->find() as $oComment) { $oCommentTemplate = clone $oItemPrototype; if ($oEntry = $oComment->getJournalEntry()) { $oCommentTemplate->replaceIdentifier('title', $oEntry->getTitle()); $oDetailLink = TagWriter::quickTag('a', array('rel' => 'internal', 'class' => 'read_more', 'href' => LinkUtil::link($oEntry->getLink($this->oPage)) . '#comments'), TranslationPeer::getString('journal_entry_teaser.read_more')); $oCommentTemplate->replaceIdentifier('link_to_detail', $oDetailLink); } $oCommentTemplate->replaceIdentifier('name', $oComment->getUsername()); $oCommentTemplate->replaceIdentifier('date', $oComment->getCreatedAtLocalized()); $oCommentTemplate->replaceIdentifier('text_stripped', StringUtil::truncate(strip_tags($oComment->getText()), 45)); $oCommentTemplate->replaceIdentifier('text', $oComment->getText()); $oTemplate->replaceIdentifierMultiple('comments', $oCommentTemplate); } return $oTemplate; }
public function setTitle($sTitle) { if ($this->isNew() || $this->getSlug() == null) { $this->setSlug(StringUtil::truncate(StringUtil::normalizePath($sTitle), 50, '', 0)); } return parent::setTitle($sTitle); }