From d68e9ec2a16bac8f7e128f4e0423e30aeeea98ea Mon Sep 17 00:00:00 2001
From: Tarje Lavik <tarje.lavik@gmail.com>
Date: Wed, 8 Nov 2017 09:31:58 +0100
Subject: [PATCH] Add possibility for embedding video in body text.

---
 components/services/exhibition/html.template                 | 4 ++--
 components/services/exhibitions/html.template                | 2 +-
 lib/Haanga/lib/Haanga/Extension/Filter/Decodedescription.php | 5 +++--
 3 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/components/services/exhibition/html.template b/components/services/exhibition/html.template
index d3c6df99..fcc41a09 100644
--- a/components/services/exhibition/html.template
+++ b/components/services/exhibition/html.template
@@ -18,7 +18,7 @@
 	    <h1><span itemprop="name">{% for row in models.main %}{% if row.title && row.title.value != "" %}{{row.title.value}}{% else %}{% if row.label && row.label.value != "" %}{{row.label.value}}{% else %} {{row.identifier.value}}{%endif%}{%endif%}{% endfor %}</span> <span class="badge">{{ first.count.total.value }}</span></h1>
 	    
 		  <div class="row">
-				<div class="col-sm-8 col-md-8">
+				<div class="col-sm-7 col-md-7">
   				{% for row in models.main %}
     	    	{% if row.alternative %}
     			    <h2 itemprop="alternativeHeadline"><small>{{first.main.alternative.value}}</small></h2>
@@ -28,7 +28,7 @@
           <div class="decode-description" itemprop="description">{% autoescape off %}{{ first.description.descriptions.value|decodedescription }}{% endautoescape %}</div>
         </div>
         
-        <div class="col-sm-3 col-md-3">
+        <div class="col-sm-5 col-md-5">
           {% if first.main.logo != null %}
   				<div class="col-md-12">
   					<img itemprop="primaryImageOfPage" class="collection-logo img-circle img-border img-responsive" src="{{first.main.logo.value}}">
diff --git a/components/services/exhibitions/html.template b/components/services/exhibitions/html.template
index b16c2f34..0c5d5be3 100644
--- a/components/services/exhibitions/html.template
+++ b/components/services/exhibitions/html.template
@@ -37,7 +37,7 @@
 			        	<div class="{% if row.logo %}col-md-9 col-sm-9 col-lg-9{% else %}col-sm-10 col-md-10{% endif %}">
 				        	<h3><a href="{{ row.uri.value }}">{{ row.label.value }}</a></h3>
 				        	{% if row.alternative %}<h4>{{ row.alternative.value }}</h4>{% endif %}
-				        	<div class="decode-description">{% autoescape off %}{{ row.description.value|decodedescription }}{% endautoescape %}</div>
+				        	<div class="decode-description">{% autoescape off %}{{ row.description.value|decodedescription|truncatewords:28}}{% endautoescape %}</div>
 			        	</div>
 		        	</div>
 		        	<div class="clearfix"></div>
diff --git a/lib/Haanga/lib/Haanga/Extension/Filter/Decodedescription.php b/lib/Haanga/lib/Haanga/Extension/Filter/Decodedescription.php
index dee5cbe2..14685d50 100644
--- a/lib/Haanga/lib/Haanga/Extension/Filter/Decodedescription.php
+++ b/lib/Haanga/lib/Haanga/Extension/Filter/Decodedescription.php
@@ -3,11 +3,12 @@
 class Haanga_Extension_Filter_Decodedescription
 {
     static function main($text) {
-    $allowed_tags ="<u><b><i><strong><br><p><ul><ol><li>";
+    $allowed_tags ="<u><b><i><strong><br><p><ul><ol><li><iframe><a>";
     $allowed_tags_regex= preg_replace('/\|$/','',preg_replace('/<([^>^\s]+)>/','$1|',$allowed_tags));
     $allowed_tags_regex_strip_not_name = "/<(". $allowed_tags_regex . ")\s+[^>]+>/"; 
     
-    $description= preg_replace($allowed_tags_regex_strip_not_name,'<$1>',strip_tags(html_entity_decode(htmlspecialchars(html_entity_decode($text,ENT_QUOTES,"UTF-8"),ENT_QUOTES,"UTF-8"),ENT_QUOTES,"UTF-8"),$allowed_tags));    
+    $description= strip_tags(html_entity_decode(htmlspecialchars(html_entity_decode($text,ENT_QUOTES,"UTF-8"),ENT_QUOTES,"UTF-8"),ENT_QUOTES,"UTF-8"),$allowed_tags); 
+
     preg_match("/<p(\s[^>]*)?>/i",$description,$matches);
     if ($matches)
    {} 
-- 
GitLab