WPide - Version 2.0.7

Version Description

  • Fixing issue with closing tabs not focusing onto next tab once closed.
  • Fixed issue with detecting ajax url correctly which was causing all WPide ajax requests to fail if WordPress was installed in a subdirectory.
  • Stopped autocomplete from trying to work when a js/css file is being edited.
Download this release

Release Info

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

Code changes from version 2.0.6 to 2.0.7

Files changed (3) hide show
  1. WPide.php +4 -3
  2. js/load-editor.js +15 -7
  3. 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.6
7
  Author: Simon Dunton
8
  Author URI: http://www.wpsites.co.uk
9
  */
@@ -43,9 +43,10 @@ class wpide
43
 
44
  }
45
 
 
46
  //only include this plugin if on theme editor, plugin editor or an ajax call
47
- if ( $_SERVER['PHP_SELF'] === '/wp-admin/admin-ajax.php' ||
48
- $_GET['page'] === 'wpide' ){
49
 
50
 
51
  //force local file method for testing - you could force other methods 'direct', 'ssh', 'ftpext' or 'ftpsockets'
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.7
7
  Author: Simon Dunton
8
  Author URI: http://www.wpsites.co.uk
9
  */
43
 
44
  }
45
 
46
+
47
  //only include this plugin if on theme editor, plugin editor or an ajax call
48
+ if ( (isset($_GET['page']) && $_GET['page'] === 'wpide') ||
49
+ preg_match('#admin-ajax\.php$#', $_SERVER['PHP_SELF']) ){
50
 
51
 
52
  //force local file method for testing - you could force other methods 'direct', 'ssh', 'ftpext' or 'ftpsockets'
js/load-editor.js CHANGED
@@ -15,14 +15,17 @@ var TokenIterator = require("ace/token_iterator").TokenIterator;
15
  var oHandler;
16
 
17
  function onSessionChange(e) {
18
- //don't continue with autocomplete if /n entered
 
 
 
 
 
19
  try {
20
  if ( e.data.text.charCodeAt(0) === 10 ){
21
  return;
22
  }
23
  }catch(error){}
24
-
25
-
26
 
27
  try {
28
  if ( e.data.action == 'removeText' ){
@@ -428,6 +431,9 @@ function wpide_set_file_contents(file, callback_func){
428
 
429
  var currentFilename = jQuery(this).attr('rel');
430
  var mode;
 
 
 
431
 
432
  //set the editor mode based on file name
433
  if (/\.css$/.test(currentFilename)) {
@@ -440,11 +446,14 @@ function wpide_set_file_contents(file, callback_func){
440
  mode = require("ace/mode/javascript").Mode;
441
  }
442
  else {
443
- mode = require("ace/mode/php").Mode; //default to php
 
 
444
  }
445
  editor.getSession().setMode(new mode());
446
 
447
- editor.getSession().on('change', onSessionChange);
 
448
  editor.resize();
449
  editor.focus();
450
  //make a note of current editor
@@ -472,13 +481,12 @@ function wpide_set_file_contents(file, callback_func){
472
  //clear session and undo
473
  saved_undo_manager[clicksesh] = undefined;
474
  saved_editor_sessions[clicksesh] = undefined;
475
-
476
 
477
  //Clear the active editor if all tabs closed or activate first tab if required since the active tab may have been deleted
478
  if (jQuery(".wpide_tab").length == 0){
479
  editor.getSession().setValue( "" );
480
  }else if ( activeFallback ){
481
- jQuery(".wpide_tab")[0].click();
482
  }
483
 
484
  });
15
  var oHandler;
16
 
17
  function onSessionChange(e) {
18
+
19
+ if( editor.getSession().enable_autocomplete === false){
20
+ return;
21
+ }
22
+
23
+ //don't continue with autocomplete if /n entered
24
  try {
25
  if ( e.data.text.charCodeAt(0) === 10 ){
26
  return;
27
  }
28
  }catch(error){}
 
 
29
 
30
  try {
31
  if ( e.data.action == 'removeText' ){
431
 
432
  var currentFilename = jQuery(this).attr('rel');
433
  var mode;
434
+
435
+ //turn autocomplete off initially, then enable as needed
436
+ editor.getSession().enable_autocomplete = false;
437
 
438
  //set the editor mode based on file name
439
  if (/\.css$/.test(currentFilename)) {
446
  mode = require("ace/mode/javascript").Mode;
447
  }
448
  else {
449
+ mode = require("ace/mode/php").Mode; //default to php
450
+ //only enable session change / auto complete if needed
451
+ editor.getSession().enable_autocomplete = true;
452
  }
453
  editor.getSession().setMode(new mode());
454
 
455
+ editor.getSession().on('change', onSessionChange);
456
+
457
  editor.resize();
458
  editor.focus();
459
  //make a note of current editor
481
  //clear session and undo
482
  saved_undo_manager[clicksesh] = undefined;
483
  saved_editor_sessions[clicksesh] = undefined;
 
484
 
485
  //Clear the active editor if all tabs closed or activate first tab if required since the active tab may have been deleted
486
  if (jQuery(".wpide_tab").length == 0){
487
  editor.getSession().setValue( "" );
488
  }else if ( activeFallback ){
489
+ jQuery( "#" + jQuery(".wpide_tab")[0].id ).click();
490
  }
491
 
492
  });
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.6
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,11 @@ Either the image contains no image data (its a new empty file) or the image is n
74
 
75
  == Changelog ==
76
 
 
 
 
 
 
77
  = 2.0.6 =
78
  * Cleaned up the WPide class and modified the way the class is passed to WordPress actions/filters.
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.7
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.7 =
78
+ * Fixing issue with closing tabs not focusing onto next tab once closed.
79
+ * Fixed issue with detecting ajax url correctly which was causing all WPide ajax requests to fail if WordPress was installed in a subdirectory.
80
+ * Stopped autocomplete from trying to work when a js/css file is being edited.
81
+
82
  = 2.0.6 =
83
  * Cleaned up the WPide class and modified the way the class is passed to WordPress actions/filters.
84