diff --git a/e107_handlers/bbcode_handler.php b/e107_handlers/bbcode_handler.php index ac787d23e..af33ee1b2 100644 --- a/e107_handlers/bbcode_handler.php +++ b/e107_handlers/bbcode_handler.php @@ -375,10 +375,10 @@ class e_bbcode //echo "Preprocess: ".htmlspecialchars($code_text).", params: {$param1}
"; return $this->bbList[$code]->bbPreSave($code_text, $param1); } - if($this->preProcess == 'toWYSIWYG')//XXX FixMe NOT working - messes with default toHTML behavior. - { + // if($this->preProcess == 'toWYSIWYG')//XXX FixMe NOT working - messes with default toHTML behavior. + // { // return $this->bbList[$code]->bbWYSIWYG($code_text, $param1); - } + // } return $this->bbList[$code]->bbPreDisplay($code_text, $param1); } if ($this->preProcess == 'toDB') return $full_text; // No change @@ -406,17 +406,19 @@ class e_bbcode * @var string $type - bbcode eg. 'img' or 'youtube' * @var string $text - text to be processed for bbcode content * @var string $path - optional path to prepend to output if http or {e_xxxx} is not found. - * @return array + * @return array|null */ function getContent($type,$text,$path='') { + if(!in_array($type,$this->core_bb)) { - return; + return null; } if(substr(ltrim($text),0,6) == '[html]' && $type == 'img') // support for html img tags inside [html] bbcode. { + $tmp = e107::getParser()->getTags($text,'img'); if(!empty($tmp['img'])) @@ -436,7 +438,7 @@ class e_bbcode preg_match_all("/\[".$type."(?:[^\]]*)?]([^\[]*)(?:\[\/".$type."])/im",$text,$mtch); } - + $ret = array(); diff --git a/e107_handlers/e_parse_class.php b/e107_handlers/e_parse_class.php index 60464a770..7d692641c 100644 --- a/e107_handlers/e_parse_class.php +++ b/e107_handlers/e_parse_class.php @@ -3898,7 +3898,7 @@ class e_parser */ public function __construct() { - + $this->domObj = new DOMDocument('1.0', 'utf-8'); $this->init(); $this->compileAttributeDefaults(); @@ -5544,7 +5544,7 @@ return; $html = ''.$html.''; } - $this->domObj = $doc = new DOMDocument('1.0', 'utf-8'); + if($this->scriptAccess === false) { @@ -5569,7 +5569,7 @@ return; // $fragment->appendXML($html); // $doc->appendChild($fragment); // $doc->encoding = 'utf-8'; - + $doc = $this->domObj; $opts = defined('LIBXML_HTML_NOIMPLIED') ? LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD : 0; $doc->loadHTML($html, $opts); diff --git a/e107_tests/tests/unit/e_parseTest.php b/e107_tests/tests/unit/e_parseTest.php index d1d27562a..8636a8b40 100644 --- a/e107_tests/tests/unit/e_parseTest.php +++ b/e107_tests/tests/unit/e_parseTest.php @@ -787,12 +787,32 @@ while($row = $sql->fetch()) { } - +*/ public function testGetTags() { + $html = "
whatever
"; + $result = $this->tp->getTags($html, 'img'); + $expected = array ( + 'img' => + array ( + 0 => + array ( + 'src' => '#', + 'alt' => 'whatever', + '@value' => 'whatever', + ), + ), + ); + if(empty($expected['img'][0])) + { + $this->assertTrue(false, "getTags() didn't return the correct value"); + } + + $this->assertSame($expected['img'][0]['src'], $result['img'][0]['src']); + $this->assertSame($expected['img'][0]['alt'], $result['img'][0]['alt']); } -*/ + public function testToGlyph() {