unfulvio /
wp-php-console
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | /** |
||
| 3 | * Plugin Name: WP PHP Console |
||
| 4 | * Plugin URI: https://github.com/unfulvio/wp-php-console/ |
||
| 5 | * Description: An implementation of PHP Console for WordPress. Easily debug and trace PHP errors and warnings from your Chrome dev tools console using a Google Chrome extension. |
||
| 6 | * |
||
| 7 | * Version: 1.5.1 |
||
| 8 | * |
||
| 9 | * Author: Fulvio Notarstefano |
||
| 10 | * Author URI: https://github.com/unfulvio/ |
||
| 11 | * |
||
| 12 | * License: GPL-2.0+ |
||
| 13 | * License URI: http://www.gnu.org/licenses/gpl-2.0.txt |
||
| 14 | * |
||
| 15 | * Text Domain: wp-php-console |
||
| 16 | * Domain Path: /languages |
||
| 17 | */ |
||
| 18 | |||
| 19 | defined( 'ABSPATH' ) or exit; |
||
|
0 ignored issues
–
show
|
|||
| 20 | |||
| 21 | /** |
||
| 22 | * WP PHP Console |
||
| 23 | * Copyright (c) 2014-2016 Fulvio Notarstefano <[email protected]> |
||
| 24 | * and contributors https://github.com/unfulvio/wp-php-console/graphs/contributors |
||
| 25 | * |
||
| 26 | * PhpConsole server library |
||
| 27 | * Copyright (c) 2011-2016 by Barbushin Sergey <[email protected]> |
||
| 28 | * |
||
| 29 | * This program is free software; you can redistribute it and/or modify |
||
| 30 | * it under the terms of the GNU General Public License, version 2 or, at |
||
| 31 | * your discretion, any later version, as published by the Free |
||
| 32 | * Software Foundation. |
||
| 33 | * |
||
| 34 | * This program is distributed in the hope that it will be useful, |
||
| 35 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
| 36 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
| 37 | * GNU General Public License for more details. |
||
| 38 | * |
||
| 39 | * You should have received a copy of the GNU General Public License |
||
| 40 | * along with this program; if not, write to the Free Software |
||
| 41 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
||
| 42 | */ |
||
| 43 | |||
| 44 | // Composer fallback for PHP < 5.3.0. |
||
| 45 | if ( -1 === version_compare( PHP_VERSION, '5.3.0' ) ) { |
||
| 46 | require_once dirname( __FILE__ ) . '/vendor/autoload_52.php'; |
||
| 47 | } else { |
||
| 48 | require_once dirname( __FILE__ ) . '/vendor/autoload.php'; |
||
| 49 | } |
||
| 50 | |||
| 51 | /** |
||
| 52 | * WP PHP Console requires PHP 5.4.0 minimum. |
||
| 53 | * @link https://make.wordpress.org/plugins/2015/06/05/policy-on-php-versions/ |
||
| 54 | * @link https://github.com/unfulvio/wp-requirements |
||
| 55 | */ |
||
| 56 | $this_plugin_checks = new WP_Requirements( |
||
| 57 | 'WP PHP Console', |
||
| 58 | plugin_basename( __FILE__ ), |
||
| 59 | array( |
||
| 60 | 'PHP' => '5.4.0', |
||
| 61 | ) |
||
| 62 | ); |
||
| 63 | |||
| 64 | if ( false === $this_plugin_checks->pass() ) { |
||
| 65 | // Stop. |
||
| 66 | $this_plugin_checks->halt(); |
||
| 67 | return; |
||
| 68 | } else { |
||
| 69 | // Load the main class of this plugin. |
||
| 70 | require_once dirname( __FILE__ ) . '/includes/class-wp-php-console.php'; |
||
| 71 | return new \WP_PHP_Console\Plugin(); |
||
| 72 | } |
||
| 73 |
PHP has two types of connecting operators (logical operators, and boolean operators):
and&&or||The difference between these is the order in which they are executed. In most cases, you would want to use a boolean operator like
&&, or||.Let’s take a look at a few examples:
Logical Operators are used for Control-Flow
One case where you explicitly want to use logical operators is for control-flow such as this:
Since
dieintroduces problems of its own, f.e. it makes our code hardly testable, and prevents any kind of more sophisticated error handling; you probably do not want to use this in real-world code. Unfortunately, logical operators cannot be combined withthrowat this point:These limitations lead to logical operators rarely being of use in current PHP code.