WPide - Version 2.0.5

Version Description

  • On startup the editor page now shows extra debuggin information for the filesystem API initialisation.
Download this release

Release Info

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

Code changes from version 2.0.4 to 2.0.5

Files changed (2) hide show
  1. WPide.php +44 -17
  2. readme.txt +4 -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.4
7
  Author: Simon Dunton
8
  Author URI: http://www.wpsites.co.uk
9
  */
@@ -17,15 +17,15 @@ class WPide2
17
  public $site_url, $plugin_url;
18
 
19
  function __construct() {
20
-
21
- //add WPide to the menu
22
  add_action( 'admin_menu', array( &$this, 'add_my_menu_page' ) );
23
 
24
  //hook for processing incoming image saves
25
  if ( isset($_GET['wpide_save_image']) ){
26
 
27
  //force local file method for testing - you could force other methods 'direct', 'ssh', 'ftpext' or 'ftpsockets'
28
- define('FS_METHOD', 'direct');
29
 
30
  add_action('admin_init', array($this, 'wpide_save_image'));
31
 
@@ -37,7 +37,7 @@ class WPide2
37
 
38
 
39
  //force local file method for testing - you could force other methods 'direct', 'ssh', 'ftpext' or 'ftpsockets'
40
- define('FS_METHOD', 'direct');
41
 
42
  // Uncomment any of these calls to add the functionality that you need.
43
  //add_action('admin_head', 'WPide2::add_admin_head');
@@ -72,6 +72,20 @@ class WPide2
72
  }
73
 
74
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
75
 
76
  public static function add_admin_head()
77
  {
@@ -356,18 +370,7 @@ class WPide2
356
 
357
 
358
  public static function wpide_startup_check() {
359
-
360
- //check the user has the permissions
361
- check_admin_referer('plugin-name-action_wpidenonce');
362
- if ( !current_user_can('edit_themes') )
363
- wp_die('<p>'.__('You do not have sufficient permissions to edit templates for this site. SORRY').'</p>');
364
-
365
- //setup wp_filesystem api
366
- global $wp_filesystem, $wp_version;
367
- if ( ! WP_Filesystem($creds) )
368
- return false;
369
-
370
- $root = WP_CONTENT_DIR;
371
 
372
  echo "\n\n\n\nWPIDE STARUP CHECKS \n";
373
  echo "___________________ \n\n";
@@ -378,6 +381,30 @@ class WPide2
378
  }else{
379
  echo "WordPress version = " . $wp_version . " (which is too old to run WPide) \n\n";
380
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
381
 
382
  //Running webservers user and group
383
  echo "Web server user/group = " . getenv('APACHE_RUN_USER') . ":" . getenv('APACHE_RUN_GROUP') . "\n";
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.5
7
  Author: Simon Dunton
8
  Author URI: http://www.wpsites.co.uk
9
  */
17
  public $site_url, $plugin_url;
18
 
19
  function __construct() {
20
+
21
+ //add WPide to the menu
22
  add_action( 'admin_menu', array( &$this, 'add_my_menu_page' ) );
23
 
24
  //hook for processing incoming image saves
25
  if ( isset($_GET['wpide_save_image']) ){
26
 
27
  //force local file method for testing - you could force other methods 'direct', 'ssh', 'ftpext' or 'ftpsockets'
28
+ $this->override_fs_method('direct');
29
 
30
  add_action('admin_init', array($this, 'wpide_save_image'));
31
 
37
 
38
 
39
  //force local file method for testing - you could force other methods 'direct', 'ssh', 'ftpext' or 'ftpsockets'
40
+ $this->override_fs_method('direct');
41
 
42
  // Uncomment any of these calls to add the functionality that you need.
43
  //add_action('admin_head', 'WPide2::add_admin_head');
72
  }
73
 
74
 
75
+ public function override_fs_method($method = 'direct'){
76
+
77
+
78
+ if ( defined('FS_METHOD') ){
79
+
80
+ define('WPIDE_FS_METHOD_FORCED', FS_METHOD); //make a note of the forced method
81
+
82
+ }else{
83
+
84
+ define('FS_METHOD', $method); //force direct
85
+
86
+ }
87
+
88
+ }
89
 
90
  public static function add_admin_head()
91
  {
370
 
371
 
372
  public static function wpide_startup_check() {
373
+ global $wp_filesystem, $wp_version;
 
 
 
 
 
 
 
 
 
 
 
374
 
375
  echo "\n\n\n\nWPIDE STARUP CHECKS \n";
376
  echo "___________________ \n\n";
381
  }else{
382
  echo "WordPress version = " . $wp_version . " (which is too old to run WPide) \n\n";
383
  }
384
+
385
+ //check the user has the permissions
386
+ check_admin_referer('plugin-name-action_wpidenonce');
387
+ if ( !current_user_can('edit_themes') )
388
+ wp_die('<p>'.__('You do not have sufficient permissions to edit templates for this site. SORRY').'</p>');
389
+
390
+ if ( defined( 'WPIDE_FS_METHOD_FORCED' ) ){
391
+ echo "WordPress filesystem API has been forced to use the " . WPIDE_FS_METHOD_FORCED . " method by another plugin/WordPress. \n\n";
392
+ }
393
+
394
+ //setup wp_filesystem api
395
+ $wpide_filesystem_before = $wp_filesystem;
396
+ if ( ! WP_Filesystem($creds) ) {
397
+
398
+ echo "There has been a problem initialising the filesystem API \n\n";
399
+ echo "Filesystem API before this plugin ran: \n\n" . print_r($wpide_filesystem_before, true);
400
+ echo "Filesystem API now: \n\n" . print_r($wp_filesystem, true);
401
+
402
+ }
403
+ unset($wpide_filesystem_before);
404
+
405
+
406
+ $root = WP_CONTENT_DIR;
407
+
408
 
409
  //Running webservers user and group
410
  echo "Web server user/group = " . getenv('APACHE_RUN_USER') . ":" . getenv('APACHE_RUN_GROUP') . "\n";
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.3.2
6
- Stable tag: 2.0.4
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
 
@@ -74,6 +74,9 @@ Either the image contains no image data (its a new empty file) or the image is n
74
 
75
  == Changelog ==
76
 
 
 
 
77
  = 2.0.4 =
78
  * On startup the initial editor page now shows some startup info regarding file permissions to help with debugging.
79
 
3
  Tags: code, theme editor, plugin editor, code editor
4
  Requires at least: 3.0
5
  Tested up to: 3.3.2
6
+ Stable tag: 2.0.5
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
 
74
 
75
  == Changelog ==
76
 
77
+ = 2.0.5 =
78
+ * On startup the editor page now shows extra debuggin information for the filesystem API initialisation.
79
+
80
  = 2.0.4 =
81
  * On startup the initial editor page now shows some startup info regarding file permissions to help with debugging.
82