From d979d495f53fe09fe33f6971223228de5172268e Mon Sep 17 00:00:00 2001 From: Julian Maurice <julian.maurice@biblibre.com> Date: Thu, 22 May 2014 12:20:19 +0200 Subject: [PATCH] hotline #13518 Allow span tag with class attribute Also allow audio and video tags --- VERSIONS | 1 + library/ZendAfi/View/Helper/CkEditor.php | 23 ++++++++++++++++--- .../ZendAfi/View/Helper/CkEditorTest.php | 2 +- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/VERSIONS b/VERSIONS index 4f8bbdee8bc..e4af1e652e4 100644 --- a/VERSIONS +++ b/VERSIONS @@ -1,5 +1,6 @@ ??? - v6.43.6 - ticket #13749 : Indexation temps réel des albums : prise en compte de l'option "visible" + - ticket #13578 : Autorisation des <span class="..."> dans ckeditor (+ audio, video) 21/05/2014 - v6.43.5 - ticket #13597 : Correction de la modération des tags de notices diff --git a/library/ZendAfi/View/Helper/CkEditor.php b/library/ZendAfi/View/Helper/CkEditor.php index 40e7200c4b8..24b017adf4f 100644 --- a/library/ZendAfi/View/Helper/CkEditor.php +++ b/library/ZendAfi/View/Helper/CkEditor.php @@ -52,7 +52,26 @@ class ZendAfi_View_Helper_CkEditor extends ZendAfi_View_Helper_BaseHelper ['Image','Flash','Table','Iframe','oembed','Slideshow'], ]; - $config['extraAllowedContent'] = ['map[name]', 'area[shape,coords,href,alt]']; + $config['extraAllowedContent'] = [ + 'audio video' => [ + 'attributes' => '*' + ], + 'source' => [ + 'attributes' => ['src', 'type'] + ], + 'map' => [ + 'attributes' => 'name' + ], + 'area' => [ + 'attributes' => ['shape', 'coords', 'href' , 'alt'] + ], + 'span' => [ + 'classes' => '*', + ], + '*' => [ + 'styles' => '*' + ] + ]; if (Class_AdminVar::isCmsFormulairesEnabled()) { $config['toolbar'][]=['Form', 'Checkbox', 'Radio', 'TextField', 'Textarea', 'Select', 'Button', 'ImageButton', 'HiddenField']; @@ -66,8 +85,6 @@ class ZendAfi_View_Helper_CkEditor extends ZendAfi_View_Helper_BaseHelper $config['extraPlugins'] = 'colordialog'; - // Allow all styles on all elements - $config['extraAllowedContent'] = '*{*}'; $oCKeditor = new CKeditor(CKBASEURL); $oCKeditor->returnOutput = true; diff --git a/tests/library/ZendAfi/View/Helper/CkEditorTest.php b/tests/library/ZendAfi/View/Helper/CkEditorTest.php index 55ea171771d..cb4498fae13 100644 --- a/tests/library/ZendAfi/View/Helper/CkEditorTest.php +++ b/tests/library/ZendAfi/View/Helper/CkEditorTest.php @@ -78,6 +78,6 @@ class CkEditorViewHelperTest extends ViewHelperTestCase { /** @test */ public function cmsFormulaireShouldAllowStyleAttribute() { - $this->assertContains('"extraAllowedContent":"*{*}"', $this->_html); + $this->assertContains('"extraAllowedContent":{"audio video":{"attributes":"*"},"source":{"attributes":["src","type"]},"map":{"attributes":"name"},"area":{"attributes":["shape","coords","href","alt"]},"span":{"classes":"*"},"*":{"styles":"*"}}', $this->_html); } } -- GitLab