Re: Text_Wiki Xhtml external link force popups
| From: | Justin Patrin | Date: | Wed, 27 Sep 2006 20:43:35 +0000 |
| Subject: | Re: Text_Wiki Xhtml external link force popups | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-44122@lists.php.net to get a copy of this message | ||
On 9/27/06, Jay Taylor <outtatime@gmail.com> wrote:
Apparently the default behavior of Text_Wiki regarding the rendering of Xhtml external url links is to insert javascript which forces the links to open in a new window (popup links).Hmmm...I'm not seeing any javascript in the Url renderer for Xhtml. Are you sure it's not just a target tag?
Call me crazy, but this behavior seems like something that should should be decided by the user of the class rather than being hard coded. There is in fact a $conf variable in the Text_Wiki_Render_Xhtml_Url class, however I am unable to see any straightforward way of changing it's 'target' value.It is, of course, settable by the calling code. This is why it's in a conf array. Setting these values is very straightforward: $wiki->setRenderConf('XHtml', 'Url', 'target', '');
Relevant file: see lines 100-101 of PEAR/Text/Wiki/Render/Xhtml/Url.php I went ahead and created a fix. Diff: http://wi-fizzle.com/PEAR/Text/Wiki/Render/Xhtml/Url.php.diff source: http://wi-fizzle.com/PEAR/Text/Wiki/Render/Xhtml/Url.phps I made a public static variable for class Text_Wiki_Render_Xhtml_Url called $default_conf. People can now, if they wish, easily alter the default configuration for this class ahead of time if they want. Whenever a new Text_Wiki_Render_Xhtml_Url's constructor runs, the datamember $conf will be initialized based on the current values of the static array self::$default_conf.2 reasons we wouldn't accept this. 1) It's a PHP5-ism, PHP4 doesn't have static class variables. This is a PHP4 package. 2) There's already an established way to set configuration, as above. There's no reason to have a static var set in this specific class. *All* renderer classes use the same configuration method in the parent class.
This is my first code submission to PEAR so I apologize if it violates your standards. This seemed like a better solution than passing in even more insane arrays, though.Arrays aren't inherently insane, I don't know why you're saying that they are. One of PHP's major strengths is its intrinsic associative array capabilities.
Hope you guys accept it.Thanks for the effort, but you should have just asked how to set configuration first (or checked the docs). -- Justin Patrin