AceIDE - Version 2.5.4

Version Description

  • Fixed broken SumoPaint image manipulation functionality (see github issue #3)
  • Strips noise from other plugins upon opening files (see github issue #5)
  • Fixed broken zipping functionality with ZipArchive (see github issue #6)
Download this release

Release Info

Developer shanept
Plugin Icon 128x128 AceIDE
Version 2.5.4
Comparing to
See all releases

Code changes from version 2.5.3 to 2.5.4

Files changed (5) hide show
  1. AceIDE.php +1 -1
  2. readme.txt +6 -1
  3. src/IDE.php +22 -20
  4. src/Modules/FileOps.php +2 -0
  5. src/js/load-editor.js +3 -0
AceIDE.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: AceIDE
4
  * Plugin URI: https://github.com/AceIDE/AceIDE
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.5.3
7
  * Author: AceIDE
8
  **/
9
 
3
  * Plugin Name: AceIDE
4
  * Plugin URI: https://github.com/AceIDE/AceIDE
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.5.4
7
  * Author: AceIDE
8
  **/
9
 
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: shanept, WPsites, Thomas Wieczorek
3
  Tags: code, theme editor, plugin editor, code editor
4
  Requires at least: 3.0
5
  Tested up to: 4.6
6
- Stable tag: 2.5.3
7
 
8
  A fork of the WPide project, AceIDE is a code editor with the long term goal of becoming the ultimate environment to develop themes and plugins.
9
 
@@ -61,6 +61,11 @@ AceIDE on GitHub: https://github.com/AceIDE/editor/
61
  1. Default colour picker image
62
 
63
  == Changelog ==
 
 
 
 
 
64
  = 2.5.3 =
65
  * Added autocomplete for taxonomy functions add_term_meta, get_term_meta, update_term_meta and delete_term_meta
66
  * Fixed broken zipping functionality (see github issue #2)
3
  Tags: code, theme editor, plugin editor, code editor
4
  Requires at least: 3.0
5
  Tested up to: 4.6
6
+ Stable tag: 2.5.4
7
 
8
  A fork of the WPide project, AceIDE is a code editor with the long term goal of becoming the ultimate environment to develop themes and plugins.
9
 
61
  1. Default colour picker image
62
 
63
  == Changelog ==
64
+ = 2.5.4 =
65
+ * Fixed broken SumoPaint image manipulation functionality (see github issue #3)
66
+ * Strips noise from other plugins upon opening files (see github issue #5)
67
+ * Fixed broken zipping functionality with ZipArchive (see github issue #6)
68
+
69
  = 2.5.3 =
70
  * Added autocomplete for taxonomy functions add_term_meta, get_term_meta, update_term_meta and delete_term_meta
71
  * Fixed broken zipping functionality (see github issue #2)
src/IDE.php CHANGED
@@ -264,10 +264,10 @@ class IDE
264
  public function save_image() {
265
  global $wp_filesystem;
266
 
267
- self::check_perms();
268
 
269
- $_POST['content'] = base64_decode( $_POST["data"] ); // image content
270
- $_POST['filename'] = start( split( '::', $_POST['opt'] ) ); // filename
271
 
272
  // setup wp_filesystem api
273
  $url = wp_nonce_url( 'admin.php?page=aceide', 'plugin-name-action_aceidenonce' );
@@ -284,11 +284,7 @@ class IDE
284
  }
285
 
286
  // save a copy of the file and create a backup just in case
287
- $root = apply_filters( 'aceide_filesystem_root', WP_CONTENT_DIR );
288
- $file_name = $root . stripslashes( $_POST['filename'] );
289
-
290
- // set backup filename
291
- $backup_path = 'backups' . preg_replace( "#\.php$#i", "_" . date( "Y-m-d-H" ) . ".php", $_POST['filename'] );
292
  $backup_path = plugin_dir_path( __FILE__ ) . $backup_path;
293
 
294
  // create backup directory if not there
@@ -297,15 +293,19 @@ class IDE
297
  wp_mkdir_p( $new_file_info['dirname'] ); // should use the filesytem api here but there isn't a comparable command right now
298
  }
299
 
 
 
 
 
300
  // do backup
301
- $wp_filesystem->move( $file_name, $backup_path );
302
 
303
- // save file
304
- if ( $wp_filesystem->put_contents( $file_name, $_POST['content'] ) ) {
305
- $result = "success";
306
- }
307
 
308
- if ( $result == "success" ) {
 
309
  wp_die( sprintf(
310
  '<p><strong>%s</strong> <br /><a href="JavaScript:window.close();">%s</a>.</p>',
311
  __( 'Image saved.' ),
@@ -518,9 +518,11 @@ class IDE
518
  $app_url = str_replace( "http:", "https:", $app_url );
519
  }
520
 
521
- $url = trailingslashit( site_url() );
522
- $root = apply_filters( "aceide_file_root_url", WP_CONTENT_URL );
523
- $root = str_replace( ABSPATH, $url, $root );
 
 
524
 
525
  do_action('pre_output_aceide_menu_page');
526
  do_action('pre_output_aceide_menu_page_scripts');
@@ -576,7 +578,7 @@ class IDE
576
  });
577
  jQuery.ajaxSetup({async:true});// enable async again
578
 
579
- window.open('http://www.sumopaint.com/app/?key=ebcdaezjeojbfgih&url=<?php echo plugins_url( $root ); ?>' + file + '&opt=' + image_data + '&title=' + image_title + '&service=Save back to AceIDE&target=<?php echo urlencode( $app_url . "/wp-admin/admin.php?aceide_save_image=yes" ) ; ?>');
580
  }
581
  } else {
582
  jQuery(parent).addClass('wait');
@@ -739,12 +741,12 @@ class IDE
739
  <label class="left"> <?php esc_html_e( 'Find' ); ?><input type="search" name="find" /></label>
740
  <label class="left"> <?php esc_html_e( 'Replace' ); ?><input type="search" name="replace" /></label>
741
  <div class="clear" style="height: 33px;"></div>
742
-
743
  <label><input type="checkbox" name="wrap" checked="checked" /> <?php esc_html_e( 'Wrap Around' ); ?></label>
744
  <label><input type="checkbox" name="case" /> <?php esc_html_e( 'Case Sensitive' ); ?></label>
745
  <label><input type="checkbox" name="whole" /> <?php esc_html_e( 'Match Whole Word' ); ?></label>
746
  <label><input type="checkbox" name="regexp" /> <?php esc_html_e( 'Regular Expression' ); ?></label>
747
-
748
  <div class="search_direction">
749
  <?php esc_html_e( 'Direction:' ); ?>
750
  <label><input type="radio" name="direction" value="0" /> <?php esc_html_e( 'Up' ); ?></label>
264
  public function save_image() {
265
  global $wp_filesystem;
266
 
267
+ self::check_perms(false);
268
 
269
+ $filename = explode( '::', $_POST['opt'] );
270
+ $filename = reset( $filename ); // filename
271
 
272
  // setup wp_filesystem api
273
  $url = wp_nonce_url( 'admin.php?page=aceide', 'plugin-name-action_aceidenonce' );
284
  }
285
 
286
  // save a copy of the file and create a backup just in case
287
+ $backup_path = 'backups' . preg_replace( "#\.php$#i", "_" . date( "Y-m-d-H" ) . ".php", $filename );
 
 
 
 
288
  $backup_path = plugin_dir_path( __FILE__ ) . $backup_path;
289
 
290
  // create backup directory if not there
293
  wp_mkdir_p( $new_file_info['dirname'] ); // should use the filesytem api here but there isn't a comparable command right now
294
  }
295
 
296
+ // Find absolute path to save to
297
+ $root = apply_filters( 'aceide_filesystem_root', WP_CONTENT_DIR );
298
+ $filename = $root . stripslashes( $filename );
299
+
300
  // do backup
301
+ $wp_filesystem->move( $filename, $backup_path );
302
 
303
+ // retrieve new file
304
+ $edited = wp_remote_get( $_POST['url'] );
305
+ $edited = wp_remote_retrieve_body( $edited );
 
306
 
307
+ // save file
308
+ if ( $wp_filesystem->put_contents( $filename, $edited ) ) {
309
  wp_die( sprintf(
310
  '<p><strong>%s</strong> <br /><a href="JavaScript:window.close();">%s</a>.</p>',
311
  __( 'Image saved.' ),
518
  $app_url = str_replace( "http:", "https:", $app_url );
519
  }
520
 
521
+ $url = trailingslashit( site_url() );
522
+ $root = apply_filters( "aceide_filesystem_root", WP_CONTENT_DIR );
523
+ $root = trailingslashit( $root );
524
+ $root = str_replace( ABSPATH, $url, $root );
525
+ $root = untrailingslashit( $root );
526
 
527
  do_action('pre_output_aceide_menu_page');
528
  do_action('pre_output_aceide_menu_page_scripts');
578
  });
579
  jQuery.ajaxSetup({async:true});// enable async again
580
 
581
+ window.open('http://www.sumopaint.com/app/?key=ebcdaezjeojbfgih&url=<?php echo $root; ?>' + file + '&opt=' + image_data + '&title=' + image_title + '&service=Save back to AceIDE&target=<?php echo urlencode( $app_url . "/wp-admin/admin.php?aceide_save_image=yes" ) ; ?>');
582
  }
583
  } else {
584
  jQuery(parent).addClass('wait');
741
  <label class="left"> <?php esc_html_e( 'Find' ); ?><input type="search" name="find" /></label>
742
  <label class="left"> <?php esc_html_e( 'Replace' ); ?><input type="search" name="replace" /></label>
743
  <div class="clear" style="height: 33px;"></div>
744
+
745
  <label><input type="checkbox" name="wrap" checked="checked" /> <?php esc_html_e( 'Wrap Around' ); ?></label>
746
  <label><input type="checkbox" name="case" /> <?php esc_html_e( 'Case Sensitive' ); ?></label>
747
  <label><input type="checkbox" name="whole" /> <?php esc_html_e( 'Match Whole Word' ); ?></label>
748
  <label><input type="checkbox" name="regexp" /> <?php esc_html_e( 'Regular Expression' ); ?></label>
749
+
750
  <div class="search_direction">
751
  <?php esc_html_e( 'Direction:' ); ?>
752
  <label><input type="radio" name="direction" value="0" /> <?php esc_html_e( 'Up' ); ?></label>
src/Modules/FileOps.php CHANGED
@@ -7,6 +7,7 @@ use AceIDE\Editor\IDE;
7
  use PHPParser_Lexer;
8
  use PHPParser_Parser;
9
  use PclZip;
 
10
 
11
  class FileOps implements Module
12
  {
@@ -48,6 +49,7 @@ class FileOps implements Module
48
  $root = apply_filters( 'aceide_filesystem_root', WP_CONTENT_DIR );
49
  $file_name = $root . stripslashes($_POST['filename']);
50
 
 
51
  echo $wp_filesystem->get_contents($file_name);
52
  die(); // this is required to return a proper result
53
  }
7
  use PHPParser_Lexer;
8
  use PHPParser_Parser;
9
  use PclZip;
10
+ use ZipArchive;
11
 
12
  class FileOps implements Module
13
  {
49
  $root = apply_filters( 'aceide_filesystem_root', WP_CONTENT_DIR );
50
  $file_name = $root . stripslashes($_POST['filename']);
51
 
52
+ echo '===FILE_CONTENTS_START===';
53
  echo $wp_filesystem->get_contents($file_name);
54
  die(); // this is required to return a proper result
55
  }
src/js/load-editor.js CHANGED
@@ -472,6 +472,9 @@ function aceide_set_file_contents(file, callback_func){
472
 
473
  jQuery("#aceide_toolbar_tabs").append('<span id="'+the_id+'" sessionrel="'+last_added_editor_session+'" title=" '+file+' " rel="'+file+'" class="aceide_tab">'+ the_path +'<a class="close_tab" href="#">x</a></span>');
474
 
 
 
 
475
  saved_editor_sessions[last_added_editor_session] = new EditSession(response);//set saved session
476
  saved_editor_sessions[last_added_editor_session].on('change', onSessionChange);
477
  saved_undo_manager[last_added_editor_session] = new UndoManager(editor.getSession().getUndoManager());//new undo manager for this session
472
 
473
  jQuery("#aceide_toolbar_tabs").append('<span id="'+the_id+'" sessionrel="'+last_added_editor_session+'" title=" '+file+' " rel="'+file+'" class="aceide_tab">'+ the_path +'<a class="close_tab" href="#">x</a></span>');
474
 
475
+ //trim everything before, and including, the start of file marker
476
+ response = response.substring(response.indexOf('===FILE_CONTENTS_START===') + 25);
477
+
478
  saved_editor_sessions[last_added_editor_session] = new EditSession(response);//set saved session
479
  saved_editor_sessions[last_added_editor_session].on('change', onSessionChange);
480
  saved_undo_manager[last_added_editor_session] = new UndoManager(editor.getSession().getUndoManager());//new undo manager for this session