diff --git a/library/Class/AdminVar.php b/library/Class/AdminVar.php index cd6b9b510c6d3bc17b5cadadacb655091ebf7a52..e25078334ef894aad10e892c1b24daaadaca5fa2 100644 --- a/library/Class/AdminVar.php +++ b/library/Class/AdminVar.php @@ -716,7 +716,6 @@ class Class_AdminVar extends Storm_Model_Abstract { public function validate() { - xdebug_break(); $this->getMeta()->validate($this); } diff --git a/library/ZendAfi/View/Helper/Avis.php b/library/ZendAfi/View/Helper/Avis.php index 315ba30fbeace3e4dad9d00ffbd3ff4bfd858e93..5a93253f3ed75782a297ba76452cacd8742a93c1 100644 --- a/library/ZendAfi/View/Helper/Avis.php +++ b/library/ZendAfi/View/Helper/Avis.php @@ -284,7 +284,7 @@ class ZendAfi_View_Helper_Avis extends ZendAfi_View_Helper_BaseHelper { protected function _formatTextAvis($avis) { - return $this->_formatWithTruncate($this->view->escape(strip_tags($avis->getAvis()))); + return $this->_formatWithTruncate($this->view->escape(strip_tags(str_replace(['<br>', '<br/>', '<br />'], "\n", $avis->getAvis())))); } @@ -298,9 +298,4 @@ class ZendAfi_View_Helper_Avis extends ZendAfi_View_Helper_BaseHelper { return ['text_avis' => nl2br($txt_avis) . ' [...]', 'lire_la_suite' => true]; } - - - protected function _is_html($value) { - return preg_match('/<[^<]+>/', $value); - } } \ No newline at end of file diff --git a/tests/library/ZendAfi/View/Helper/Accueil/CritiquesTest.php b/tests/library/ZendAfi/View/Helper/Accueil/CritiquesTest.php index d36e4dedff759e2c972c56fb0278e34a2ba67484..a83ac6a2d7c8fb0c77d7015035f5ef7df9b6cb51 100644 --- a/tests/library/ZendAfi/View/Helper/Accueil/CritiquesTest.php +++ b/tests/library/ZendAfi/View/Helper/Accueil/CritiquesTest.php @@ -106,6 +106,16 @@ abstract class CritiquesAvisTestCase extends ViewHelperTestCase { 'statut' => 1, 'notices' => [$millenium]]); + $avis_millenium_from_suplo_with_html = $this->fixture('Class_AvisNotice', + ['id' => 2342, + 'entete' => 'Excellent<br> !', + 'avis' => '<div class="should not be present"><br>Tout au long de ce livre<br>, le suspense est intense.</div>', + 'note' => 5, + 'date_avis' => '2010-03-18 13:00:00', + 'user' => $super_lolo, + 'statut' => 1, + 'notices' => [$millenium]]); + $avis_orphan = $this->fixture('Class_AvisNotice', ['id' => 34, 'entete' => 'J\'ai oublié', @@ -159,6 +169,14 @@ class CritiquesWithVignettesTest extends CritiquesAvisTestCase { } + /** @test */ + public function superLoloCommentWithHtmlShouldBeCutAfterToutAu() { + $this->assertXPathContentContains($this->html, + '//p', ' +Tout au [...]'); + } + + /** @test */ public function loloCommentShouldBeCutAfterSuspenceIntence() { $this->assertXPathContentContains($this->html,