Last active
August 29, 2015 14:15
-
-
Save theodorocaliari/f0184b92958cd921def2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Include the following code in your theme functions.php; | |
* but first you need to include PHP Console library using one of the methods | |
* described in PHP Console documentation. | |
*/ | |
$phpConsole = PhpConsole\Handler::getInstance()->isStarted(); | |
// This check makes sure PHP Console is instantiated only once. | |
if ( $phpConsole == false ) { | |
$handler = PhpConsole\Handler::getInstance(); | |
$handler->start(); | |
$connector = PhpConsole\Connector::getInstance(); | |
// You can set your own password here | |
$connector->setPassword('your_password_here'); | |
$connector->setSourcesBasePath(__DIR__); | |
$evalProvider = $connector->getEvalDispatcher()->getEvalProvider(); | |
// You can share more variables too if you want, follow the two examples below: | |
$evalProvider->addSharedVar('uri', $_SERVER['REQUEST_URI']); | |
$evalProvider->addSharedVarReference('post', $_POST); | |
// The setting below deals with paths where your application is; | |
// the following values should include functions from WordPress core, every active plugin and the active theme. | |
$evalProvider->setOpenBaseDirs(array(__DIR__, WP_CONTENT_DIR)); | |
$connector->startEvalRequestsListener(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment