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

@ -20,7 +20,7 @@ class Block {
*/
public $body;
/**
/**
* Where the block should be placed. The default theme supports
* "main" and "left", other themes can add their own areas.
*
@ -58,7 +58,7 @@ class Block {
$this->body = $body;
$this->section = $section;
$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);
}
}

View file

@ -62,7 +62,7 @@ class BlotterTheme extends Themelet {
if($entries[$i]['important'] == 'Y') { $important = 'Y'; } else { $important = 'N'; }
// Add the new table row(s)
$table_rows .=
$table_rows .=
"<tr>
<td>$entry_date</td>
<td>$entry_text</td>
@ -114,7 +114,7 @@ class BlotterTheme extends Themelet {
$i_open = "<font color='#{$i_color}'>";
$i_close="</font>";
}
$html .= "{$i_open}{$clean_date} - {$entry_text}{$i_close}<br /><br />";
$html .= "{$i_open}{$clean_date} - {$entry_text}{$i_close}<br /><br />";
}
$html .= "</pre>";
return $html;
@ -139,9 +139,9 @@ class BlotterTheme extends Themelet {
$entry_text = $entries[$i]['entry_text'];
if($entries[$i]['important'] == 'Y') {
$i_open = "<font color='#{$i_color}'>";
$i_close="</font>";
$i_close="</font>";
}
$entries_list .= "<li>{$i_open}{$clean_date} - {$entry_text}{$i_close}</li>";
$entries_list .= "<li>{$i_open}{$clean_date} - {$entry_text}{$i_close}</li>";
}
$pos_break = "";
@ -149,7 +149,7 @@ class BlotterTheme extends Themelet {
if($position === "left") {
$pos_break = "<br />";
$pos_align = "";
$pos_align = "";
}
if(count($entries) === 0) {
@ -176,4 +176,3 @@ class BlotterTheme extends Themelet {
return $html;
}
}

View file

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