3 Ноябрь 2012 г. 2:00:47 пользователь Platonides
(Platonides(a)gmail.com) написал:
On 01/11/12 06:37, Dmitriy Sintsov wrote:
Also I wish it was possible to extend (and perhaps to define) classes
via variable values:
class $myParser extends $wgParserConf['class'] {
...
}
$wgParserConf['class'] = $myParser;
Such way, multiple extensions could nest (override) default class. Even
monkey patching is not so much needed then.
Should probably be possible via eval(), however eval() is a hacky way.
Perhaps a great idea for PHP 5.5.
Dmitriy
We have one eval in MediaWiki for doing something like that.
(tests/phpunit/includes/parser/MediaWikiParserTest.php)
Interesting, thanks for the path.
If properly argued, it _should_ be simple to get a new
hook added, though.
Monkey patching or dynamic class names (if were properly available w/o eval)
probably will have better performance than adding more hooks.
Also I wish another classes would be instantiated as fiexible as Parser, via $wg*
setting.
Dmitriy