Skip to content

Commit

Permalink
Info flash outputs tags cleared text
Browse files Browse the repository at this point in the history
  • Loading branch information
b23prodtm committed Dec 16, 2018
1 parent b2e7b06 commit 657d388
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/View/E14/admin_cat.ctp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
App:uses(array('SQL', 'Page', 'Formulaire'), 'Cms');
App::uses(array('SQL', 'Page', 'Formulaire'), 'Cms');
require APP . $r->r['include__php_constantes.inc'];
require APP . $r->r['include__php_module_html.inc'];
require APP . $r->r['include__php_module_cat.inc'];
Expand Down
14 changes: 13 additions & 1 deletion app/View/Helper/InfoHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,23 @@ function getInfoFlashN($offset = 0, &$pages = array(), $characters = 160) {
$this->__getInfo($this->pageCount, $offset, $infos);
/* contenu de la page */
foreach($infos as $lastinfo) {
$c = $lastinfo->getContenu(null, true, true, $characters);
$c = $this->clearTags($lastinfo->getContenu(null, true, true, $characters));
$c = $this->md ? $this->r->view->Markdown->transform($c) : $c;

$html .= $this->r->view->HTML->para("info_flash", $lastinfo->getLien($lastinfo->getTitre()) . "<p>" . $c . "...</p>\n");
}
return $html;
}

function clearTags($text, $pattern = "|<[^>]+>(.*)</[^>]+>|U") {
$sptn = "|<[^>]+>?(.*)|U";
if(preg_match_all($pattern, $text, $match, PREG_PATTERN_ORDER) > 0) {
return $this->clearTags(implode($match[1]), $pattern);
} else if($sptn !== $pattern) {
return $this->clearTags($text, $sptn);
} else {
$text = explode(" ", $text);
return implode(" ",array_slice($text, 0, count($text) - 1));
}
}
}
2 changes: 1 addition & 1 deletion app/webroot/php_cms
Submodule php_cms updated from 7aa646 to bbc9f7

0 comments on commit 657d388

Please sign in to comment.