Hotfix for better block id character filtering

This commit is contained in:
William Crandell 2015-10-26 09:20:09 -04:00
parent 4af1199ff3
commit b7114a142e
3 changed files with 8 additions and 11 deletions

View file

@ -58,7 +58,7 @@ class Block {
$this->body = $body; $this->body = $body;
$this->section = $section; $this->section = $section;
$this->position = $position; $this->position = $position;
$this->id = str_replace(' ', '_', is_null($id) ? (is_null($header) ? md5($body) : $header) . $section : $id); $this->id = preg_replace('/[^\w]/', '',str_replace(' ', '_', is_null($id) ? (is_null($header) ? md5($body) : $header) . $section : $id));
} }
/** /**
@ -94,4 +94,3 @@ class NavBlock extends Block {
parent::__construct("Navigation", "<a href='".make_link()."'>Index</a>", "left", 0); parent::__construct("Navigation", "<a href='".make_link()."'>Index</a>", "left", 0);
} }
} }

View file

@ -176,4 +176,3 @@ class BlotterTheme extends Themelet {
return $html; return $html;
} }
} }

View file

@ -233,8 +233,7 @@ EOD;
public function get_html(Block $block, $section="main", $hidable=false, $extra_class="") { public function get_html(Block $block, $section="main", $hidable=false, $extra_class="") {
$h = $block->header; $h = $block->header;
$b = $block->body; $b = $block->body;
$i = $block->id; $i = $block->id;//blotter extention id has `!`
$i = preg_replace('/[^\w-]/', '', $i);//blotter extention id has `!`
if($section == "toolbar"){ if($section == "toolbar"){
$html = "<section id='$i'>\n<nav class='mdl-navigation'>\n"; $html = "<section id='$i'>\n<nav class='mdl-navigation'>\n";