getExtraInfos(); $title = htmlspecialchars($extraInfos['name']); $uri = htmlspecialchars($extraInfos['uri']); $donationUri = htmlspecialchars($extraInfos['donationUri']); $donationsAllowed = Configuration::getConfig('admin', 'donations'); // Dynamically build buttons for all formats (except HTML) $formatFactory = new FormatFactory(); $buttons = ''; $links = ''; foreach ($formatFactory->getFormatNames() as $format) { if (strcasecmp($format, 'HTML') === 0) { continue; } $query = str_ireplace('format=Html', 'format=' . $format, htmlentities($_SERVER['QUERY_STRING'])); $buttons .= $this->buildButton($format, $query) . PHP_EOL; $mime = $formatFactory->create($format)->getMimeType(); $links .= $this->buildLink($format, $query, $mime) . PHP_EOL; } if ($donationUri !== '' && $donationsAllowed) { $buttons .= '' . PHP_EOL; $links .= '' . PHP_EOL; } $entries = ''; foreach ($this->getItems() as $item) { $entryAuthor = $item->getAuthor() ? '

by: ' . $item->getAuthor() . '

' : ''; $entryTitle = $this->sanitizeHtml(strip_tags($item->getTitle())); $entryUri = $item->getURI() ?: $uri; $entryDate = ''; if ($item->getTimestamp()) { $entryDate = sprintf( '', date('Y-m-d H:i:s', $item->getTimestamp()), date('Y-m-d H:i:s', $item->getTimestamp()) ); } $entryContent = ''; if ($item->getContent()) { $entryContent = '
' . $this->sanitizeHtml($item->getContent()) . '
'; } $entryEnclosures = ''; if (!empty($item->getEnclosures())) { $entryEnclosures = '

Attachments:

'; foreach ($item->getEnclosures() as $enclosure) { $template = '
  • %s
  • '; $url = $this->sanitizeHtml($enclosure); $anchorText = substr($url, strrpos($url, '/') + 1); $entryEnclosures .= sprintf($template, $url, $anchorText); } $entryEnclosures .= '
    '; } $entryCategories = ''; if (!empty($item->getCategories())) { $entryCategories = '

    Categories:

    '; foreach ($item->getCategories() as $category) { $entryCategories .= '
  • ' . $this->sanitizeHtml($category) . '
  • '; } $entryCategories .= '
    '; } $entries .= <<

    {$entryTitle}

    {$entryDate} {$entryAuthor} {$entryContent} {$entryEnclosures} {$entryCategories} EOD; } $charset = $this->getCharset(); /* Data are prepared, now let's begin the "MAGIE !!!" */ $toReturn = << {$title} {$links}

    {$title}

    {$entries} EOD; // Remove invalid characters ini_set('mbstring.substitute_character', 'none'); $toReturn = mb_convert_encoding($toReturn, $this->getCharset(), 'UTF-8'); return $toReturn; } private function buildButton($format, $query) { return << EOD; } private function buildLink($format, $query, $mime) { return << EOD; } }