mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Convert FQCNs to html safe strings
Convert namespaced class names to html safe strings in `LeftAndMain.php` `CMSMenu.php` and `LeftAndMain.Main.js` by replacing backslashes (\) with dashes (\) and removing special characters with `Convert::raw2htmlname()`
This commit is contained in:
parent
2549fa8a93
commit
b17b186e93
@ -142,7 +142,7 @@ class CMSMenu extends Object implements IteratorAggregate, i18nEntityProvider {
|
||||
$cmsClasses = self::get_cms_classes();
|
||||
foreach($cmsClasses as $cmsClass) {
|
||||
$menuItem = self::menuitem_for_controller($cmsClass);
|
||||
if($menuItem) $menuItems[$cmsClass] = $menuItem;
|
||||
if($menuItem) $menuItems[Convert::raw2htmlname(str_replace('\\', '-', $cmsClass))] = $menuItem;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -556,7 +556,7 @@ class LeftAndMain extends Controller implements PermissionProvider {
|
||||
public static function menu_icon_for_class($class) {
|
||||
$icon = Config::inst()->get($class, 'menu_icon', Config::FIRST_SET);
|
||||
if (!empty($icon)) {
|
||||
$class = strtolower($class);
|
||||
$class = strtolower(Convert::raw2htmlname(str_replace('\\', '-', $class)));
|
||||
return ".icon.icon-16.icon-{$class} { background: url('{$icon}'); } ";
|
||||
}
|
||||
return '';
|
||||
|
@ -92,7 +92,7 @@
|
||||
updateMenuFromResponse: function(xhr) {
|
||||
var controller = xhr.getResponseHeader('X-Controller');
|
||||
if(controller) {
|
||||
var item = this.find('li#Menu-' + controller);
|
||||
var item = this.find('li#Menu-' + controller.replace(/\\/g, '-').replace(/[^a-zA-Z0-9\-_:.]+/, ''));
|
||||
if(!item.hasClass('current')) item.select();
|
||||
}
|
||||
this.updateItems();
|
||||
|
Loading…
Reference in New Issue
Block a user