Fix api inconsistency for Contao 3.5 (See #37).

This commit is contained in:
David Molineus
2015-07-22 13:56:37 +02:00
parent ff8cda1371
commit 3c983e86bc
3 changed files with 49 additions and 9 deletions

View File

@@ -0,0 +1,40 @@
<?php
/**
* @package dev
* @author David Molineus <david.molineus@netzmacht.de>
* @copyright 2015 netzmacht creative David Molineus
* @license LGPL 3.0
* @filesource
*
*/
namespace Netzmacht\Contao\Leaflet\Frontend\Helper;
/**
* This class is a helper to replace insert tags.
*
* @package Netzmacht\Contao\Leaflet\Frontend\Helper
*/
class InsertTagReplacer
{
/**
* Replace insert tags with their values.
*
* @param string $buffer The text with the tags to be replaced.
* @param boolean $cache If false, non-cacheable tags will be replaced.
*
* @return string
*/
public function replace($buffer, $cache = true)
{
if (version_compare(VERSION, '3.5', '<')) {
$frontendApi = new FrontendApi();
return $frontendApi->replaceInsertTags($buffer, $cache);
}
$replacer = new \InsertTags();
return $replacer->replace($buffer, $cache);
}
}