]> _ Git - cubist_cms-back.git/commitdiff
done #2893 @0:15
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 17 Jul 2019 13:50:24 +0000 (15:50 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 17 Jul 2019 13:50:24 +0000 (15:50 +0200)
src/app/Markdown/InternaLink/Renderer.php

index 5db2310d9785a3076dc44696439caaeeee2e4956..f599fed7afe864a424d23602c58f5bc087364aea 100644 (file)
@@ -10,15 +10,9 @@ use League\CommonMark\HtmlElement;
 use League\CommonMark\Inline\Element\AbstractInline;
 use League\CommonMark\Inline\Element\Link;
 use League\CommonMark\Inline\Renderer\InlineRendererInterface;
-use League\CommonMark\Util\ConfigurationInterface;
-use League\CommonMark\Util\RegexHelper;
 
 class Renderer implements InlineRendererInterface
 {
-    /**
-     * @var ConfigurationInterface
-     */
-    protected $config;
 
     /**
      * @param Link $inline
@@ -34,14 +28,12 @@ class Renderer implements InlineRendererInterface
 
         $attrs = $inline->getData('attributes', []);
 
-        $forbidUnsafeLinks = !$this->config->get('allow_unsafe_links');
-        if (!($forbidUnsafeLinks && RegexHelper::isLinkPotentiallyUnsafe($inline->getUrl()))) {
-            $href = $inline->getUrl();
-            if (stristr($href, 'internal:')) {
-                $href = Menu::internalToHref($href);
-            }
-            $attrs['href'] = $href;
+
+        $href = $inline->getUrl();
+        if (stristr($href, 'internal:')) {
+            $href = Menu::internalToHref($href);
         }
+        $attrs['href'] = $href;
 
         if (isset($inline->data['title'])) {
             $attrs['title'] = $inline->data['title'];
@@ -54,11 +46,4 @@ class Renderer implements InlineRendererInterface
         return new HtmlElement('a', $attrs, $htmlRenderer->renderInlines($inline->children()));
     }
 
-    /**
-     * @param ConfigurationInterface $configuration
-     */
-    public function setConfiguration(ConfigurationInterface $configuration)
-    {
-        $this->config = $configuration;
-    }
 }