WPide - Version 2.0.15

Version Description

  • PHP syntax checking before saving to disk
Download this release

Release Info

Developer WPsites
Plugin Icon 128x128 WPide
Version 2.0.15
Comparing to
See all releases

Code changes from version 2.0.14 to 2.0.15

Files changed (2) hide show
  1. WPide.php +19 -1
  2. readme.txt +6 -1
WPide.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: WPide
4
  Plugin URI: https://github.com/WPsites/WPide
5
  Description: WordPress code editor with auto completion of both WordPress and PHP functions with reference, syntax highlighting, line numbers, tabbed editing, automatic backup.
6
- Version: 2.0.14
7
  Author: Simon Dunton
8
  Author URI: http://www.wpsites.co.uk
9
  */
@@ -336,6 +336,24 @@ class wpide
336
  if ( !current_user_can('edit_themes') )
337
  wp_die('<p>'.__('You do not have sufficient permissions to edit templates for this site. SORRY').'</p>');
338
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
339
  //setup wp_filesystem api
340
  global $wp_filesystem;
341
  $url = wp_nonce_url('admin.php?page=wpide','plugin-name-action_wpidenonce');
3
  Plugin Name: WPide
4
  Plugin URI: https://github.com/WPsites/WPide
5
  Description: WordPress code editor with auto completion of both WordPress and PHP functions with reference, syntax highlighting, line numbers, tabbed editing, automatic backup.
6
+ Version: 2.0.15
7
  Author: Simon Dunton
8
  Author URI: http://www.wpsites.co.uk
9
  */
336
  if ( !current_user_can('edit_themes') )
337
  wp_die('<p>'.__('You do not have sufficient permissions to edit templates for this site. SORRY').'</p>');
338
 
339
+ //check file syntax of PHP files by parsing the PHP
340
+ if ( preg_match("#\.php$#i", $_POST['filename']) ){
341
+
342
+ require('PHP-Parser/lib/bootstrap.php');
343
+ ini_set('xdebug.max_nesting_level', 2000);
344
+
345
+ $code = stripslashes($_POST['content']);
346
+
347
+ $parser = new PHPParser_Parser(new PHPParser_Lexer);
348
+
349
+ try {
350
+ $stmts = $parser->parse($code);
351
+ } catch (PHPParser_Error $e) {
352
+ echo 'Parse Error: ', $e->getMessage();
353
+ die();
354
+ }
355
+ }
356
+
357
  //setup wp_filesystem api
358
  global $wp_filesystem;
359
  $url = wp_nonce_url('admin.php?page=wpide','plugin-name-action_wpidenonce');
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: WPsites, Thomas Wieczorek
3
  Tags: code, theme editor, plugin editor, code editor
4
  Requires at least: 3.0
5
  Tested up to: 3.5
6
- Stable tag: 2.0.14
7
 
8
  WordPress code editor with auto completion of both WordPress and PHP functions with reference, syntax highlighting, line numbers, tabbed editing, automatic backup.
9
 
@@ -20,6 +20,7 @@ This plugin performs best in the Chrome web browser.
20
  = Current Features: =
21
 
22
  * Syntax highlighting
 
23
  * Line numbers
24
  * Code autocomplete for WordPress and PHP functions along with function description, arguments and return value where applicable
25
  * Colour assist - a colour picker that only shows once you double click a hex colour code in the editor. You can also drag your own image into the colour picker to use instead of the default swatch (see other notes for info).
@@ -72,6 +73,10 @@ Either the image contains no image data (its a new empty file) or the image is n
72
  4. Default colour picker image
73
 
74
  == Changelog ==
 
 
 
 
75
  = 2.0.14 =
76
  * Fixed error Warning: Creating default object from empty value in WPide.php
77
  * Updated the ace editor to current build
3
  Tags: code, theme editor, plugin editor, code editor
4
  Requires at least: 3.0
5
  Tested up to: 3.5
6
+ Stable tag: 2.0.15
7
 
8
  WordPress code editor with auto completion of both WordPress and PHP functions with reference, syntax highlighting, line numbers, tabbed editing, automatic backup.
9
 
20
  = Current Features: =
21
 
22
  * Syntax highlighting
23
+ * PHP syntax checking before saving to disk to try and banish white screen of death after uploading invalid PHP
24
  * Line numbers
25
  * Code autocomplete for WordPress and PHP functions along with function description, arguments and return value where applicable
26
  * Colour assist - a colour picker that only shows once you double click a hex colour code in the editor. You can also drag your own image into the colour picker to use instead of the default swatch (see other notes for info).
73
  4. Default colour picker image
74
 
75
  == Changelog ==
76
+
77
+ = 2.0.15 =
78
+ * PHP syntax checking before saving to disk
79
+
80
  = 2.0.14 =
81
  * Fixed error Warning: Creating default object from empty value in WPide.php
82
  * Updated the ace editor to current build