WPide - Version 2.0.4

Version Description

  • On startup the initial editor page now shows some startup info regarding file permissions to help with debugging.
Download this release

Release Info

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

Code changes from version 2.0.2 to 2.0.4

Files changed (60) hide show
  1. WPide.php +97 -3
  2. ace-0.2.0/ChangeLog.txt +0 -0
  3. ace-0.2.0/LICENSE +0 -0
  4. ace-0.2.0/Readme.md +0 -0
  5. ace-0.2.0/demo/kitchen-sink-uncompressed.js +0 -0
  6. ace-0.2.0/demo/kitchen-sink.js +0 -0
  7. ace-0.2.0/demo/logo.png +0 -0
  8. ace-0.2.0/demo/styles.css +0 -0
  9. ace-0.2.0/editor.html +0 -0
  10. ace-0.2.0/kitchen-sink.html +0 -0
  11. ace-0.2.0/textarea/ChangeLog.txt +0 -0
  12. ace-0.2.0/textarea/LICENSE +0 -0
  13. ace-0.2.0/textarea/Readme.md +0 -0
  14. ace-0.2.0/textarea/editor.html +0 -0
  15. ace-0.2.0/textarea/src/ace-uncompressed.js +0 -0
  16. ace-0.2.0/textarea/src/ace.js +0 -0
  17. ace-0.2.0/textarea/src/mode-c_cpp.js +0 -0
  18. ace-0.2.0/textarea/src/mode-clojure.js +0 -0
  19. ace-0.2.0/textarea/src/mode-coffee.js +0 -0
  20. ace-0.2.0/textarea/src/mode-csharp.js +0 -0
  21. ace-0.2.0/textarea/src/mode-css.js +0 -0
  22. ace-0.2.0/textarea/src/mode-groovy.js +0 -0
  23. ace-0.2.0/textarea/src/mode-html.js +0 -0
  24. ace-0.2.0/textarea/src/mode-java.js +0 -0
  25. ace-0.2.0/textarea/src/mode-javascript.js +0 -0
  26. ace-0.2.0/textarea/src/mode-json.js +0 -0
  27. ace-0.2.0/textarea/src/mode-ocaml.js +0 -0
  28. ace-0.2.0/textarea/src/mode-perl.js +0 -0
  29. ace-0.2.0/textarea/src/mode-php.js +0 -0
  30. ace-0.2.0/textarea/src/mode-python.js +0 -0
  31. ace-0.2.0/textarea/src/mode-ruby.js +0 -0
  32. ace-0.2.0/textarea/src/mode-scad.js +0 -0
  33. ace-0.2.0/textarea/src/mode-scala.js +0 -0
  34. ace-0.2.0/textarea/src/mode-scss.js +0 -0
  35. ace-0.2.0/textarea/src/mode-svg.js +0 -0
  36. ace-0.2.0/textarea/src/mode-textile.js +0 -0
  37. ace-0.2.0/textarea/src/mode-xml.js +0 -0
  38. ace-0.2.0/textarea/src/theme-clouds.js +0 -0
  39. ace-0.2.0/textarea/src/theme-clouds_midnight.js +0 -0
  40. ace-0.2.0/textarea/src/theme-cobalt.js +0 -0
  41. ace-0.2.0/textarea/src/theme-crimson_editor.js +0 -0
  42. ace-0.2.0/textarea/src/theme-dawn.js +0 -0
  43. ace-0.2.0/textarea/src/theme-eclipse.js +0 -0
  44. ace-0.2.0/textarea/src/theme-idle_fingers.js +0 -0
  45. ace-0.2.0/textarea/src/theme-kr_theme.js +0 -0
  46. ace-0.2.0/textarea/src/theme-merbivore.js +0 -0
  47. ace-0.2.0/textarea/src/theme-merbivore_soft.js +0 -0
  48. ace-0.2.0/textarea/src/theme-mono_industrial.js +0 -0
  49. ace-0.2.0/textarea/src/theme-monokai.js +0 -0
  50. ace-0.2.0/textarea/src/theme-pastel_on_dark.js +0 -0
  51. ace-0.2.0/textarea/src/theme-solarized_dark.js +0 -0
  52. ace-0.2.0/textarea/src/theme-solarized_light.js +0 -0
  53. ace-0.2.0/textarea/src/theme-textmate.js +0 -0
  54. ace-0.2.0/textarea/src/theme-twilight.js +0 -0
  55. ace-0.2.0/textarea/src/theme-vibrant_ink.js +0 -0
  56. ace-0.2.0/textarea/style.css +0 -0
  57. jqueryFileTree.js +6 -0
  58. js/load-editor.js +17 -1
  59. readme.txt +7 -1
  60. screenshot-1.jpg +0 -0
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.2
7
  Author: Simon Dunton
8
  Author URI: http://www.wpsites.co.uk
9
  */
@@ -35,6 +35,7 @@ class WPide2
35
  if ( $_SERVER['PHP_SELF'] === '/wp-admin/admin-ajax.php' ||
36
  $_GET['page'] === 'wpide' ){
37
 
 
38
  //force local file method for testing - you could force other methods 'direct', 'ssh', 'ftpext' or 'ftpsockets'
39
  define('FS_METHOD', 'direct');
40
 
@@ -55,7 +56,8 @@ class WPide2
55
  //setup ajax function to create new item (folder, file etc)
56
  add_action('wp_ajax_wpide_image_edit_key', 'WPide2::wpide_image_edit_key' );
57
 
58
-
 
59
 
60
 
61
  }
@@ -351,6 +353,98 @@ class WPide2
351
 
352
  //return;
353
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
354
 
355
 
356
  public function add_my_menu_page() {
@@ -529,4 +623,4 @@ class WPide2
529
 
530
  }
531
  add_action("init", create_function('', 'new WPide2();'));
532
- ?>
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
  */
35
  if ( $_SERVER['PHP_SELF'] === '/wp-admin/admin-ajax.php' ||
36
  $_GET['page'] === 'wpide' ){
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
 
56
  //setup ajax function to create new item (folder, file etc)
57
  add_action('wp_ajax_wpide_image_edit_key', 'WPide2::wpide_image_edit_key' );
58
 
59
+ //setup ajax function for startup to get some debug info, checking permissions etc
60
+ add_action('wp_ajax_wpide_startup_check', 'WPide2::wpide_startup_check' );
61
 
62
 
63
  }
353
 
354
  //return;
355
  }
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";
374
+
375
+ //WordPress version
376
+ if ($wp_version > 3){
377
+ echo "WordPress version = " . $wp_version . "\n\n";
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";
384
+ //wp-content user and group
385
+ echo "wp-content owner/group = " . $wp_filesystem->owner( $root ) . ":" . $wp_filesystem->group( $root ) . "\n\n";
386
+
387
+
388
+ //check we can list wp-content files
389
+ if( $wp_filesystem->exists( $root ) ){
390
+
391
+ $files = $wp_filesystem->dirlist( $root );
392
+ if ( count($files) > 0){
393
+ echo "wp-content folder exists and contains ". count($files) ." files \n";
394
+ }else{
395
+ echo "wp-content folder exists but we cannot read it's contents \n";
396
+ }
397
+ }
398
+
399
+ // $wp_filesystem->owner() $wp_filesystem->group() $wp_filesystem->is_writable() $wp_filesystem->is_readable()
400
+ echo "\nUsing the ".$wp_filesystem->method." method of the WP filesystem API\n";
401
+
402
+ //wp-content editable?
403
+ echo "The wp-content folder ". ( $wp_filesystem->is_readable( $root )==1 ? "IS":"IS NOT" ) ." readable and ". ( $wp_filesystem->is_writable( $root )==1 ? "IS":"IS NOT" ) ." writable by this method \n";
404
+
405
+
406
+ //plugins folder editable
407
+ echo "The wp-content/plugins folder ". ( $wp_filesystem->is_readable( $root."/plugins" )==1 ? "IS":"IS NOT" ) ." readable and ". ( $wp_filesystem->is_writable( $root."/plugins" )==1 ? "IS":"IS NOT" ) ." writable by this method \n";
408
+
409
+
410
+ //themes folder editable
411
+ echo "The wp-content/themes folder ". ( $wp_filesystem->is_readable( $root."/themes" )==1 ? "IS":"IS NOT" ) ." readable and ". ( $wp_filesystem->is_writable( $root."/themes" )==1 ? "IS":"IS NOT" ) ." writable by this method \n";
412
+
413
+
414
+
415
+ echo "___________________ \n\n\n\n";
416
+
417
+ echo " If the file tree to the right is empty there is a possibility that your server permissions are not compatible with this plugin. \n The startup information above may shed some light on things. \n Paste that information into the support forum for further assistance.";
418
+
419
+
420
+ die();
421
+
422
+ //set backup filename
423
+ $backup_path = ABSPATH .'wp-content/plugins/' . basename(dirname(__FILE__)) .'/backups/' . str_replace( str_replace('\\', "/", ABSPATH), '', $file_name) .'.'.date("YmdH");
424
+ //create backup directory if not there
425
+ $new_file_info = pathinfo($backup_path);
426
+ if (!$wp_filesystem->is_dir($new_file_info['dirname'])) wp_mkdir_p( $new_file_info['dirname'] ); //should use the filesytem api here but there isn't a comparable command right now
427
+
428
+ //do backup
429
+ $wp_filesystem->move( $file_name, $backup_path );
430
+
431
+
432
+ //save file
433
+ if( $wp_filesystem->put_contents( $file_name, $_POST['content']) ) {
434
+ $result = "success";
435
+ }
436
+
437
+ if ($result == "success"){
438
+ wp_die('<p>'.__('<strong>Image saved.</strong> <br />You may <a href="JavaScript:window.close();">close this window / tab</a>.').'</p>');
439
+ }else{
440
+ wp_die('<p>'.__('<strong>Problem saving image.</strong> <br /><a href="JavaScript:window.close();">Close this window / tab</a> and try editing the image again.').'</p>');
441
+ }
442
+
443
+
444
+ //return;
445
+ }
446
+
447
+
448
 
449
 
450
  public function add_my_menu_page() {
623
 
624
  }
625
  add_action("init", create_function('', 'new WPide2();'));
626
+ ?>
ace-0.2.0/ChangeLog.txt CHANGED
File without changes
ace-0.2.0/LICENSE CHANGED
File without changes
ace-0.2.0/Readme.md CHANGED
File without changes
ace-0.2.0/demo/kitchen-sink-uncompressed.js CHANGED
File without changes
ace-0.2.0/demo/kitchen-sink.js CHANGED
File without changes
ace-0.2.0/demo/logo.png CHANGED
File without changes
ace-0.2.0/demo/styles.css CHANGED
File without changes
ace-0.2.0/editor.html CHANGED
File without changes
ace-0.2.0/kitchen-sink.html CHANGED
File without changes
ace-0.2.0/textarea/ChangeLog.txt CHANGED
File without changes
ace-0.2.0/textarea/LICENSE CHANGED
File without changes
ace-0.2.0/textarea/Readme.md CHANGED
File without changes
ace-0.2.0/textarea/editor.html CHANGED
File without changes
ace-0.2.0/textarea/src/ace-uncompressed.js CHANGED
File without changes
ace-0.2.0/textarea/src/ace.js CHANGED
File without changes
ace-0.2.0/textarea/src/mode-c_cpp.js CHANGED
File without changes
ace-0.2.0/textarea/src/mode-clojure.js CHANGED
File without changes
ace-0.2.0/textarea/src/mode-coffee.js CHANGED
File without changes
ace-0.2.0/textarea/src/mode-csharp.js CHANGED
File without changes
ace-0.2.0/textarea/src/mode-css.js CHANGED
File without changes
ace-0.2.0/textarea/src/mode-groovy.js CHANGED
File without changes
ace-0.2.0/textarea/src/mode-html.js CHANGED
File without changes
ace-0.2.0/textarea/src/mode-java.js CHANGED
File without changes
ace-0.2.0/textarea/src/mode-javascript.js CHANGED
File without changes
ace-0.2.0/textarea/src/mode-json.js CHANGED
File without changes
ace-0.2.0/textarea/src/mode-ocaml.js CHANGED
File without changes
ace-0.2.0/textarea/src/mode-perl.js CHANGED
File without changes
ace-0.2.0/textarea/src/mode-php.js CHANGED
File without changes
ace-0.2.0/textarea/src/mode-python.js CHANGED
File without changes
ace-0.2.0/textarea/src/mode-ruby.js CHANGED
File without changes
ace-0.2.0/textarea/src/mode-scad.js CHANGED
File without changes
ace-0.2.0/textarea/src/mode-scala.js CHANGED
File without changes
ace-0.2.0/textarea/src/mode-scss.js CHANGED
File without changes
ace-0.2.0/textarea/src/mode-svg.js CHANGED
File without changes
ace-0.2.0/textarea/src/mode-textile.js CHANGED
File without changes
ace-0.2.0/textarea/src/mode-xml.js CHANGED
File without changes
ace-0.2.0/textarea/src/theme-clouds.js CHANGED
File without changes
ace-0.2.0/textarea/src/theme-clouds_midnight.js CHANGED
File without changes
ace-0.2.0/textarea/src/theme-cobalt.js CHANGED
File without changes
ace-0.2.0/textarea/src/theme-crimson_editor.js CHANGED
File without changes
ace-0.2.0/textarea/src/theme-dawn.js CHANGED
File without changes
ace-0.2.0/textarea/src/theme-eclipse.js CHANGED
File without changes
ace-0.2.0/textarea/src/theme-idle_fingers.js CHANGED
File without changes
ace-0.2.0/textarea/src/theme-kr_theme.js CHANGED
File without changes
ace-0.2.0/textarea/src/theme-merbivore.js CHANGED
File without changes
ace-0.2.0/textarea/src/theme-merbivore_soft.js CHANGED
File without changes
ace-0.2.0/textarea/src/theme-mono_industrial.js CHANGED
File without changes
ace-0.2.0/textarea/src/theme-monokai.js CHANGED
File without changes
ace-0.2.0/textarea/src/theme-pastel_on_dark.js CHANGED
File without changes
ace-0.2.0/textarea/src/theme-solarized_dark.js CHANGED
File without changes
ace-0.2.0/textarea/src/theme-solarized_light.js CHANGED
File without changes
ace-0.2.0/textarea/src/theme-textmate.js CHANGED
File without changes
ace-0.2.0/textarea/src/theme-twilight.js CHANGED
File without changes
ace-0.2.0/textarea/src/theme-vibrant_ink.js CHANGED
File without changes
ace-0.2.0/textarea/style.css CHANGED
File without changes
jqueryFileTree.js CHANGED
@@ -87,7 +87,13 @@ if(jQuery) (function($){
87
  // Loading message
88
  $(this).html('<ul class="jqueryFileTree start"><li class="wait">' + o.loadMessage + '<li></ul>');
89
  // Get the initial file list
 
90
  showTree( $(this), escape(o.root) );
 
 
 
 
 
91
  });
92
  }
93
  });
87
  // Loading message
88
  $(this).html('<ul class="jqueryFileTree start"><li class="wait">' + o.loadMessage + '<li></ul>');
89
  // Get the initial file list
90
+ jQuery.ajaxSetup({async:false}); //we need to wait until we get the response
91
  showTree( $(this), escape(o.root) );
92
+
93
+ //if nothing returned then let user know something wrong with permissions
94
+ if ( $(this).children('.jqueryFileTree').length==0 ){
95
+ alert('WPide is having trouble accessing your files.');
96
+ }
97
  });
98
  }
99
  });
js/load-editor.js CHANGED
@@ -551,7 +551,23 @@ jQuery(document).ready(function($) {
551
  //get a copy of the initial file contents (the file being edited)
552
  //var intialData = $('#newcontent').val()
553
  var intialData = "Use the file manager to find a file you wish edit, click the file name to edit. \n\n";
554
- editor.getSession().setValue( intialData );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
555
 
556
  //make initial editor read only
557
  $('#fancyeditordiv textarea').attr("disabled", "disabled");
551
  //get a copy of the initial file contents (the file being edited)
552
  //var intialData = $('#newcontent').val()
553
  var intialData = "Use the file manager to find a file you wish edit, click the file name to edit. \n\n";
554
+
555
+
556
+ //startup info - usefull for debugging
557
+ var data = { action: 'wpide_startup_check', _wpnonce: jQuery('#_wpnonce').val(), _wp_http_referer: jQuery('#_wp_http_referer').val() };
558
+
559
+ jQuery.post(ajaxurl, data, function(response) {
560
+ if (response == "-1"){
561
+ intialData = intialData + "Permission/security problem with ajax request. Refresh WPide and try again. \n\n";
562
+ }else{
563
+ intialData = intialData + response;
564
+ }
565
+
566
+ editor.getSession().setValue( intialData );
567
+
568
+ });
569
+
570
+
571
 
572
  //make initial editor read only
573
  $('#fancyeditordiv textarea').attr("disabled", "disabled");
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.2
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,12 @@ Either the image contains no image data (its a new empty file) or the image is n
74
 
75
  == Changelog ==
76
 
 
 
 
 
 
 
77
  = 2.0.2 =
78
  * Image editing is now available using the SumoPaint image editor and drawing application http://www.sumopaint.com/
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.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
 
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
+
80
+ = 2.0.3 =
81
+ * If WPide cannot access your files due to permissions then when it starts up it will give you an alert to say this.
82
+
83
  = 2.0.2 =
84
  * Image editing is now available using the SumoPaint image editor and drawing application http://www.sumopaint.com/
85
 
screenshot-1.jpg CHANGED
File without changes