From: <var...@us...> - 2009-01-02 20:38:05
|
Revision: 6369 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=6369&view=rev Author: vargenau Date: 2009-01-02 20:38:01 +0000 (Fri, 02 Jan 2009) Log Message: ----------- Allow lang attribute for <abbr> and <acronym> Modified Paths: -------------- trunk/lib/InlineParser.php Modified: trunk/lib/InlineParser.php =================================================================== --- trunk/lib/InlineParser.php 2009-01-02 12:31:22 UTC (rev 6368) +++ trunk/lib/InlineParser.php 2009-01-02 20:38:01 UTC (rev 6369) @@ -794,7 +794,8 @@ { //rurban: abbr|acronym need an optional title tag. //sf.net bug #728595 - var $_start_regexp = "<(?: abbr|acronym )(?: \stitle=[^>]*)?>"; + // allowed attributes: title and lang + var $_start_regexp = "<(?: abbr|acronym )(?: [^>]*)?>"; function getEndRegexp ($match) { if (substr($match,1,4) == 'abbr') @@ -809,12 +810,16 @@ $tag = 'abbr'; else $tag = 'acronym'; - $rest = substr($match,1+strlen($tag),-1); - if (!empty($rest)) { - list($key,$val) = explode("=",$rest); - $args = array($key => $val); - } else $args = array(); - return new HtmlElement($tag, $args, $body); + $rest = substr($match,1+strlen($tag),-1); + $attrs = parse_attributes($rest); + // Remove attributes other than title and lang + $allowedargs = array(); + foreach ($attrs as $key => $value) { + if (in_array ($key, array("title", "lang"))) { + $allowedargs[$key] = $value; + } + } + return new HtmlElement($tag, $allowedargs, $body); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |