Skip to content

Commit

Permalink
updated dependencies, removed submodules
Browse files Browse the repository at this point in the history
  • Loading branch information
nekorjira committed Dec 11, 2014
1 parent 3ecd46a commit 69f8576
Show file tree
Hide file tree
Showing 174 changed files with 9,840 additions and 24 deletions.
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

3 changes: 3 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
### 1.2.0 (11 dec 2014)
* Updated dependencies and got rid of git submodules.

### 1.1.0 (07 nov 2014)
* Added donation link/button.
* PHP Console server is now instantiated later, allowing to catch all your theme functions too.
Expand Down
13 changes: 6 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

This is an implementation of **[PHP Console](https://github.com/barbushin/php-console)** as a [WordPress](http://www.wordpress.org) plugin.


> PHP Console allows you to handle PHP errors & exceptions, dump variables, execute PHP code remotely and many other things using [Google Chrome PHP Console extension](https://chrome.google.com/webstore/detail/php-console/nfhmhhlpfleoednkpnnnkolmclajemef) and [PhpConsole server library](https://github.com/barbushin/php-console).
This implementation for WordPress allows you to test any WordPress specific function or class (including those introduced by your active theme and plugins!) from PHP Console terminal and inspect results, catch error and warnings with stack trace straight from Chrome Dev Tools console.
Expand All @@ -14,23 +13,23 @@ Follow these steps:

1. First, install **[PHP Console for Google Chrome](https://chrome.google.com/webstore/detail/php-console/nfhmhhlpfleoednkpnnnkolmclajemef)**.

2. Then, add this plugin to your WordPress installation (by placing it into your `wp-content/plugins/` directory). **Note:** If you are cloning or manually downloading this git repo from GitHub, make sure to init PHP Console git submodule (i.e. `lib\php-console` directory should not be empty - this step is not necessary if you happen to download this plugin from WordPress.org).
2. Then, add this plugin to your WordPress installation (by placing it into your `wp-content/plugins/` directory or corresponding plugins directory in your installation).

3. Once installed, activate WP PHP Console from WordPress plugins dashboard page; then go to `PHP Console` settings page from the `Settings` menu. From here you need to enter a password for the eval terminal (required, otherwise the eval terminal simply won't work).
3. Once installed, activate WP PHP Console from WordPress plugins dashboard page as you would do with any other plugin; then go to `PHP Console` settings page from the `Settings` menu. From here you need to enter a password for the eval terminal (required, otherwise the eval terminal simply won't work). You can also set other options.

### Options

In WP PHP Console settings page, you can also tick a checkbox to use the terminal only on a SSL connection (of course then if you don't have SSL the terminal simply won't work). You can also specify IP addresses to restrict the accessibility to the eval terminal (a single address eg. `192.168.0.4`; or an address mask eg. `192.168.*.*` or multiple IPs, comma separated `192.168.1.22,192.168.1.24,192.168.3.*`).
In WP PHP Console settings page, you can tick a checkbox to use the terminal only on a SSL connection (of course then if you don't actually have SSL, PHP Console simply won't work). You can also specify IP addresses to restrict the accessibility to the eval terminal (a single address eg. `192.168.0.4`; or an address mask eg. `192.168.*.*` or multiple IPs, comma separated `192.168.1.22,192.168.1.24,192.168.3.*`). In case of having issues in connecting with the PHP terminal, try entering a generic wildcard `*` in this field.


## Usage

Once you have set up a password, you can navigate any of your WordPress page (including WordPress admin) and try the console. You will se a "key" icon in your browser address bar. By clicking on it, it will prompt for the password you have set just before. After entering the correct password, you can use the eval terminal and run any PHP code from it, including WordPress own functions. Furthermore, in Chrome Dev Tools console you will also see printed any PHP errors, warnings, notices with stack trace, which will be useful to debug your plugin or theme.
Once you have set up a password, you can navigate any of your WordPress page (including WordPress admin dashboard pages) and try the console. You will se a "key" icon in your browser address bar. By clicking on it, it will prompt for the password you have set just before. After entering the correct password, you can use the eval terminal and run any PHP code from it, including WordPress own functions. Furthermore, in Chrome Dev Tools console you will also see printed any PHP errors, warnings, notices with stack trace, which will be useful to debug your plugin or theme.

### Caveats

You should not use this plugin or PHP Console library in a production environment, rather a development/testing environment. You will otherwise add more load to your server and even put your site at risk since you're exposing PHP code publicly.
You should NOT use this plugin or PHP Console library in a production environment, rather a development/testing environment. You will otherwise add more load to your server and even put your site at risk since you're exposing PHP code publicly.

### Browser support

Currently PHP Console only supports Google Chrome browser. If you're using for example Firefox or Opera this plugin won't be of much use to you at the moment.
Currently PHP Console only supports Google Chrome browser. If you're using, developing or testing with Firefox or Opera this plugin won't be of much use to you at the moment.
5 changes: 4 additions & 1 deletion README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
Tags: development, debug, debugging
Requires at least: 3.0.1
Tested up to: 4.0
Stable tag: 1.1.0
Stable tag: 1.2.0
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -50,6 +50,9 @@ No it doesn't, unless PHP Console is ported as a Firefox add-on for example.

== Changelog ==

= 1.2.0 =
* Updated dependencies

= 1.1.0 =
* Added donation link/button.
* PHP Console server is now instantiated later, allowing to catch all your theme functions too.
Expand Down
16 changes: 11 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
{
"name": "nekojira/wp-php-console",
"name": "wp-php-console",
"description": "A WordPress implementation of PHP Console.",
"version": "1.1.0",
"type": "wordpress-plugin",
"version": "1.2.0",
"keywords": [
"wordpress",
"debug",
"debugging",
"development"
"development",
"php-console"
],
"homepage": "https://github.com/nekojira/wp-php-console",
"license": "GPLv2 or later"
"license": "GPLv2 or later",
"type": "wordpress-plugin",
"require": {
"php": ">=5.3.2",
"composer/installers": "v1.0.19",
"php-console/php-console": "~3.1"
}
}
166 changes: 166 additions & 0 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 16 additions & 4 deletions lib/class-wp-php-console.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/**
* WP PHP Console Plugin Core Class
*
* @link https://github.com/wp-php-console
* @link https://github.com/nekojira/wp-php-console
* @since 1.0.0
*
* @package WP_PHP_Console
Expand Down Expand Up @@ -37,6 +37,14 @@ class WP_PHP_Console {
*/
protected $version;

/**
* Options.
*
* @since 1.0.0
* @access protected
*/
protected $options;

/**
* Construct.
*
Expand All @@ -46,6 +54,7 @@ public function __construct() {

$this->plugin_name = 'wp-php-console';
$this->version = '1.1.0';
$this->options = get_option( 'wp-php-console' );

add_action( 'plugins_loaded', array( $this, 'set_locale' ) );
add_action( 'admin_menu', array( $this, 'register_settings_page' ) );
Expand Down Expand Up @@ -256,6 +265,9 @@ public function settings_info() {
*/
public function init() {

if ( ! class_exists( 'PhpConsole\Connector' ) )
return;

$options = get_option( 'wp_php_console' );

$password = isset( $options['password'] ) ? $options['password'] : '';
Expand All @@ -269,12 +281,12 @@ public function init() {
if ( PhpConsole\Handler::getInstance()->isStarted() != true )
$handler->start();

$enableSslOnlyMode = isset( $options['ssl'] ) ? $options['ssl'] : '';
$enableSslOnlyMode = isset( $options['ssl'] ) ? ( ! empty( $options['ssl'] ) ? $options['ssl'] : '' ) : '';
if ( $enableSslOnlyMode == true )
$connector->enableSslOnlyMode();

$allowedIpMasks = isset( $options['ip'] ) ? explode( ',', $options['ip'] ) : '';
if ( $allowedIpMasks )
$allowedIpMasks = isset( $options['ip'] ) ? ( ! empty( $options['ip'] ) ? implode( ',', $options['ip'] ) : '' ) : '';
if ( ! is_array( $allowedIpMasks ) && ! empty( $allowedIpMasks ) )
$connector->setAllowedIpMasks( (array) $allowedIpMasks );

$evalProvider = $connector->getEvalDispatcher()->getEvalProvider();
Expand Down
1 change: 0 additions & 1 deletion lib/php-console
Submodule php-console deleted from 888e53
7 changes: 7 additions & 0 deletions vendor/autoload.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

// autoload.php @generated by Composer

require_once __DIR__ . '/composer' . '/autoload_real.php';

return ComposerAutoloaderInit2c64d051d18a1b25d2d528d8981e0274::getLoader();
Loading

0 comments on commit 69f8576

Please sign in to comment.