brianhaveri/Underscore.php

__ Naming conflict with Wordpress

Opened this issue · 2 comments

I'm trying to use underscore.php with a Wordpress installation and unfortunately Wordpress uses the __() function call as part of it's translation/localisation functions. Is there a simple and tested way to move underscore into a non-conflicting namespace?

I implemented the noConflict method. I think it solves the problem.

zealotrunner/Underscore.php@c401d9d

@zealotrunner How is noConflict supposed to be used?
Like this?

include_once "underscore.php";
$_ = Underscore::noConflict();
$_::whatever( ... );

If so, it doesn't quite solve the problem because the conflict occures right after I include the file 'underscore.php. Wordpress already has __ function, so I get an error:

Cannot redeclare __() (previously declared in /wp-includes/l10n.php:172)