Commit a5e2c5fd authored by speedprogs_de's avatar speedprogs_de

added CDATA view helper to wrap rss contents

git-svn-id: https://svn.typo3.org/TYPO3v4/Extensions/terfe/branches/ter_fe2@46076 735d13b6-9817-0410-8766-e36946ffe9aa
parent dc08bc25
<?php
/*******************************************************************
* Copyright notice
*
* (c) 2011 Kai Vogel <kai.vogel@speedprogs.de>, Speedprogs.de
*
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
******************************************************************/
/**
* CDATA Wrapper View Helper
*
* @version $Id$
* @copyright Copyright belongs to the respective authors
* @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3 or later
*/
class Tx_TerFe2_ViewHelpers_CdataViewHelper extends Tx_Fluid_Core_ViewHelper_AbstractViewHelper {
/**
* @var string CDATA wrap
*/
protected $cdataWrap = '<![CDATA[|]]>';
/**
* Renders an extension icon of given extension and version
*
* @param string $content Content to wrap with CDATA
* @return string Wrapped content
*/
public function render($content = NULL) {
if ($content === NULL) {
$content = $this->renderChildren();
}
return str_replace('|', $content, $this->cdataWrap);
}
}
?>
\ No newline at end of file
......@@ -50,11 +50,10 @@
* @param boolean $absolute If set, the URI of the rendered link is absolute
* @param boolean $addQueryString If set, the current query parameters will be kept in the URI
* @param array $argumentsToBeExcludedFromQueryString arguments to be removed from the URI. Only active if $addQueryString = TRUE
* @param boolean $makeAbsolute Add host to URL
* @return string Rendered link
* @see Tx_Fluid_ViewHelpers_Link_ActionViewHelper::render
*/
public function render($action = NULL, array $arguments = array(), $controller = NULL, $extensionName = NULL, $pluginName = NULL, $pageUid = NULL, $pageType = 0, $noCache = FALSE, $noCacheHash = FALSE, $section = '', $format = '', $linkAccessRestrictedPages = FALSE, array $additionalParams = array(), $absolute = FALSE, $addQueryString = FALSE, array $argumentsToBeExcludedFromQueryString = array(), $makeAbsolute = FALSE) {
public function render($action = NULL, array $arguments = array(), $controller = NULL, $extensionName = NULL, $pluginName = NULL, $pageUid = NULL, $pageType = 0, $noCache = FALSE, $noCacheHash = FALSE, $section = '', $format = '', $linkAccessRestrictedPages = FALSE, array $additionalParams = array(), $absolute = FALSE, $addQueryString = FALSE, array $argumentsToBeExcludedFromQueryString = array()) {
$uriBuilder = $this->controllerContext->getUriBuilder();
$uri = $uriBuilder
->reset()
......@@ -71,7 +70,7 @@
->setArgumentsToBeExcludedFromQueryString($argumentsToBeExcludedFromQueryString)
->uriFor($action, $arguments, $controller, $extensionName, $pluginName);
return ($makeAbsolute ? t3lib_div::locationHeaderUrl($uri) : $uri);
return $uri;
}
}
......
......@@ -3,10 +3,10 @@
<f:for each="{extensions}" as="extension">
<item>
<title>{extension.lastVersion.title}</title>
<link><![CDATA[<terfe2:url action="show" arguments="{extension : extension}" makeAbsolute="1"></terfe2:url>]]></link>
<guid><![CDATA[<terfe2:url action="download" arguments="{extension : extension, version : extension.lastVersion}" makeAbsolute="1"></terfe2:url>]]></guid>
<description><![CDATA[{extension.lastVersion.description}]]></description>
<content:encoded><![CDATA[]]></content:encoded>
<link><terfe2:cdata><terfe2:url action="show" arguments="{extension : extension}" absolute="1"></terfe2:url></terfe2:cdata></link>
<guid><terfe2:cdata><terfe2:url action="download" arguments="{extension : extension, version : extension.lastVersion}" absolute="1"></terfe2:url></terfe2:cdata></guid>
<description><terfe2:cdata>{extension.lastVersion.description}</terfe2:cdata></description>
<content:encoded><terfe2:cdata></terfe2:cdata></content:encoded>
<pubDate><terfe2:dateTime format="{settings.rssOutput.dateFormat}">{extension.lastVersion.uploadDate}</terfe2:dateTime></pubDate>
</item>
</f:for>
\ No newline at end of file
......@@ -30,6 +30,7 @@
'tx_terfe2_utility_zip' => $extensionClassesPath . 'Utility/Zip.php',
'tx_terfe2_view_extension_listjson' => $extensionClassesPath . 'View/Extension/ListJson.php',
'tx_terfe2_view_extension_listlatestjson' => $extensionClassesPath . 'View/Extension/ListLatestJson.php',
'tx_terfe2_viewhelpers_cdataviewhelper' => $extensionClassesPath . 'ViewHelpers/CdataViewHelper.php',
'tx_terfe2_viewhelpers_datetimeviewhelper' => $extensionClassesPath . 'ViewHelpers/DateTimeViewHelper.php',
'tx_terfe2_viewhelpers_extensioniconviewhelper' => $extensionClassesPath . 'ViewHelpers/ExtensionIconViewHelper.php',
'tx_terfe2_viewhelpers_urlviewhelper' => $extensionClassesPath . 'ViewHelpers/UrlViewHelper.php',
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment