From 5ebd11717ffd9bb84e29ed9a7498698e6156f412 Mon Sep 17 00:00:00 2001 From: William Crandell Date: Mon, 26 Oct 2015 09:44:01 -0400 Subject: [PATCH] Hotfix block id character stripping Example problem is ext/blotter uses: $page->add_block( new Block( "Welcome to the Blotter Editor!", <-- SEE --> ! $html, "main", 10)); --- core/block.class.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/core/block.class.php b/core/block.class.php index afdb23db..1fbe0e3f 100644 --- a/core/block.class.php +++ b/core/block.class.php @@ -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", "Index", "left", 0); } } -