Supprime les emojis de l'id de la page

This commit is contained in:
Fred Tempez 2020-04-23 07:49:55 +02:00
parent efed2febae
commit 2fb054cc57
3 changed files with 6 additions and 2 deletions

View File

@ -199,11 +199,15 @@ class helper {
break;
case self::FILTER_ID:
$text = mb_strtolower($text, 'UTF-8');
// Supprime les emojis et espaces en fin de chaine
$text = preg_replace('/[[:^print:]]/', '', $text);
$text = rtrim($text);
$text = strip_tags(str_replace(
explode(',', 'á,à,â,ä,ã,å,ç,é,è,ê,ë,í,ì,î,ï,ñ,ó,ò,ô,ö,õ,ú,ù,û,ü,ý,ÿ,\',", '),
explode(',', 'a,a,a,a,a,a,c,e,e,e,e,i,i,i,i,n,o,o,o,o,o,u,u,u,u,y,y,-,-,-'),
$text
));
$text = preg_replace('/([^a-z0-9-])/', '', $text);
// Cas où un identifiant est vide
if (empty($text)) {

View File

@ -36,7 +36,7 @@ class common {
const THUMBS_WIDTH = 640;
// Numéro de version
const ZWII_VERSION = '10.0.067';
const ZWII_VERSION = '10.0.068';
const ZWII_UPDATE_CHANNEL = "v10";
public static $actions = [];

View File

@ -187,7 +187,7 @@ class page extends common {
$pageId = $this->getInput('pageEditTitle', helper::FILTER_ID, true);
// un dossier existe du même nom (erreur en cas de redirection)
if (file_exists($pageId)) {
$pageId = uniqid($pageId . '-');
$pageId = uniqid($pageId);
}
// Si l'id a changée
if ($pageId !== $this->getUrl(2)) {