1
0
mirror of https://github.com/e107inc/e107.git synced 2025-03-14 01:19:44 +01:00

Closes #4804 - Conversion of diacritics in name2id()

This commit is contained in:
camer0n 2023-09-28 09:36:31 -07:00
parent 720ea0c03d
commit dd9c011fdd
2 changed files with 11 additions and 2 deletions

View File

@ -4374,7 +4374,8 @@ var_dump($select_options);*/
public function name2id($name)
{
$name = strtolower($name);
return rtrim(str_replace(array('[]', '[', ']', '_', '/', ' ','.', '(', ')', '::', ':', '?','=',"'"), array('-', '-', '', '-', '-', '-', '-','','','-','','-','-',''), $name), '-');
$name = $this->tp->toASCII($name);
return rtrim(str_replace(array('[]', '[', ']', '_', '/', ' ','.', '(', ')', '::', ':', '?','=',"'",','), array('-', '-', '', '-', '-', '-', '-','','','-','','-','-','',''), $name), '-');
}
/**

View File

@ -1041,6 +1041,14 @@ class e_formTest extends \Codeception\Test\Unit
$result = $this->_frm->name2id($text);
$this->assertEquals($expected, $result);
// Test with diacritics
$text = "Façade, Jalapeño, Frappé";
$expected = 'facade-jalapeno-frappe';
$result = $this->_frm->name2id($text);
$this->assertEquals($expected, $result);
}
/*
public function testFormat_options()
@ -1100,7 +1108,7 @@ class e_formTest extends \Codeception\Test\Unit
'number_001' => 555,
'number_002' => "<a class='e-tip e-editable editable-click' data-name='number_002' title=\"Edit Number 002\" data-type='text' data-pk='0' data-url='".e_SELF."?mode=&action=inline&id=0&ajax_used=1' href='#'>444</a>",
'bool_001' => ADMIN_TRUE_ICON,
'bool_001' => constant('ADMIN_TRUE_ICON'),
'bool_002' => "<a class='e-tip e-editable editable-click e-editable-boolean' data-name='bool_002' data-source='{\"0\":\"\u0026cross;\",\"1\":\"\u0026check;\"}' title=\"Edit Bool 002\" data-type='select' data-inputclass='x-editable-bool-002 e-editable-boolean' data-value=\"1\" href='#' data-class='e-editable-boolean' data-url='".e_SELF."?mode=&amp;action=inline&amp;id=0&amp;ajax_used=1'>&check;</a>",
'dropdown_001' => 'Label 2',