From 8a148ffaf8a3fa9821bb6df5330a3b9624030b7f Mon Sep 17 00:00:00 2001 From: David Molineus Date: Sat, 1 Aug 2015 00:16:03 +0200 Subject: [PATCH] Get sick and tired to work around api changes. Yet another insert tag fix. --- .../Leaflet/Frontend/Helper/FrontendApi.php | 17 ++++++++++++----- .../Frontend/Helper/InsertTagReplacer.php | 7 +------ 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/Netzmacht/Contao/Leaflet/Frontend/Helper/FrontendApi.php b/src/Netzmacht/Contao/Leaflet/Frontend/Helper/FrontendApi.php index b6919a7..32322e4 100644 --- a/src/Netzmacht/Contao/Leaflet/Frontend/Helper/FrontendApi.php +++ b/src/Netzmacht/Contao/Leaflet/Frontend/Helper/FrontendApi.php @@ -19,12 +19,19 @@ namespace Netzmacht\Contao\Leaflet\Frontend\Helper; class FrontendApi extends \Frontend { /** - * {@inheritdoc} + * Call a Contao method no matter if it's protected. + * + * Inspired by Haste. + * + * @param string $method The method name. + * @param array $arguments The arguments. + * + * @see https://github.com/codefog/contao-haste/commits/master/library/Haste/Haste.php + * + * @return mixed */ - // @codingStandardsIgnoreStart - public function replaceInsertTags($strBuffer, $blnCache = true) + public function call($method, array $arguments = array()) { - return parent::replaceInsertTags($strBuffer, $blnCache); + return call_user_func_array(array($this, $method), $arguments); } - // @codingStandardsIgnoreEnd } diff --git a/src/Netzmacht/Contao/Leaflet/Frontend/Helper/InsertTagReplacer.php b/src/Netzmacht/Contao/Leaflet/Frontend/Helper/InsertTagReplacer.php index b07b07e..0774c8f 100644 --- a/src/Netzmacht/Contao/Leaflet/Frontend/Helper/InsertTagReplacer.php +++ b/src/Netzmacht/Contao/Leaflet/Frontend/Helper/InsertTagReplacer.php @@ -28,13 +28,8 @@ class InsertTagReplacer */ public function replace($buffer, $cache = true) { - if (class_exists('InsertTags')) { - $replacer = new \InsertTags(); - return $replacer->replace($buffer, $cache); - } - $frontendApi = new FrontendApi(); - return $frontendApi->replaceInsertTags($buffer, $cache); + return $frontendApi->call('replaceInsertTags', array($buffer, $cache)); } }