for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace HDNET\Calendarize\ViewHelpers\Format;
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
/**
* EscapeIcalTextViewHelper.
*/
class EscapeIcalTextViewHelper extends AbstractViewHelper
{
* @var bool
protected $escapeChildren = false;
* Disable the output escaping interceptor so that the value is not htmlspecialchar'd twice.
*
protected $escapeOutput = false;
public function initializeArguments()
parent::initializeArguments();
$this->registerArgument('value', 'string', 'Value to format');
}
* Escapes special characters for ICalendar TEXT defined in RFC 5545 - 3.3.11.
* @return string the altered string
* @see https://tools.ietf.org/html/rfc5545#section-3.3.11
* @api
public function render()
$value = $this->arguments['value'];
if (null === $value) {
$value = $this->renderChildren();
// Note: The string syntax use double and single quotes!
return str_replace(["\\", "\n", "\r", ",", ";"], ['\\\\', '\n', '\r', '\,', '\;'], $value);