WPide - Version 2.0.6

Version Description

  • Cleaned up the WPide class and modified the way the class is passed to WordPress actions/filters.
Download this release

Release Info

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

Code changes from version 2.0.5 to 2.0.6

Files changed (2) hide show
  1. WPide.php +31 -16
  2. readme.txt +4 -1
WPide.php CHANGED
@@ -3,23 +3,35 @@
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
  */
10
 
 
 
11
 
12
 
13
- class WPide2
 
14
 
15
  {
16
 
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']) ){
@@ -27,7 +39,7 @@ class WPide2
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
 
32
  }
33
 
@@ -40,24 +52,23 @@ class WPide2
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');
44
- add_action('admin_init', 'WPide2::add_admin_js');
45
- add_action('admin_init', 'WPide2::add_admin_styles');
46
 
47
  //setup jqueryFiletree list callback
48
- add_action('wp_ajax_jqueryFileTree', 'WPide2::jqueryFileTree_get_list');
49
  //setup ajax function to get file contents for editing
50
- add_action('wp_ajax_wpide_get_file', 'WPide2::wpide_get_file' );
51
  //setup ajax function to save file contents and do automatic backup if needed
52
- add_action('wp_ajax_wpide_save_file', 'WPide2::wpide_save_file' );
53
  //setup ajax function to create new item (folder, file etc)
54
- add_action('wp_ajax_wpide_create_new', 'WPide2::wpide_create_new' );
55
 
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
  }
@@ -77,7 +88,7 @@ class WPide2
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
 
@@ -387,7 +398,7 @@ class WPide2
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
 
@@ -649,5 +660,9 @@ class WPide2
649
  }
650
 
651
  }
652
- add_action("init", create_function('', 'new WPide2();'));
 
 
 
 
653
  ?>
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
  */
10
 
11
+ // Exit if accessed directly
12
+ if ( !defined( 'ABSPATH' ) ) exit;
13
 
14
 
15
+ if ( !class_exists( 'wpide' ) ) :
16
+ class wpide
17
 
18
  {
19
 
20
  public $site_url, $plugin_url;
21
+
22
+ /**
23
+ * The main WPide loader (PHP4 compatable)
24
+ *
25
+ * @uses wpide::__construct() Setup the globals needed
26
+ */
27
+ public function wpide() {
28
+ $this->__construct();
29
+ }
30
 
31
  function __construct() {
32
 
33
  //add WPide to the menu
34
+ add_action( 'admin_menu', array( $this, 'add_my_menu_page' ) );
35
 
36
  //hook for processing incoming image saves
37
  if ( isset($_GET['wpide_save_image']) ){
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
+ add_action('admin_init', array( $this, 'wpide_save_image') );
43
 
44
  }
45
 
52
  $this->override_fs_method('direct');
53
 
54
  // Uncomment any of these calls to add the functionality that you need.
55
+ add_action('admin_init', array( $this, 'add_admin_js' ) );
56
+ add_action('admin_init', array( $this, 'add_admin_styles' ) );
 
57
 
58
  //setup jqueryFiletree list callback
59
+ add_action('wp_ajax_jqueryFileTree', array( $this, 'jqueryFileTree_get_list' ) );
60
  //setup ajax function to get file contents for editing
61
+ add_action('wp_ajax_wpide_get_file', array( $this, 'wpide_get_file' ) );
62
  //setup ajax function to save file contents and do automatic backup if needed
63
+ add_action('wp_ajax_wpide_save_file', array( $this, 'wpide_save_file' ) );
64
  //setup ajax function to create new item (folder, file etc)
65
+ add_action('wp_ajax_wpide_create_new', array( $this, 'wpide_create_new' ) );
66
 
67
  //setup ajax function to create new item (folder, file etc)
68
+ add_action('wp_ajax_wpide_image_edit_key', array( $this, 'wpide_image_edit_key' ) );
69
 
70
  //setup ajax function for startup to get some debug info, checking permissions etc
71
+ add_action('wp_ajax_wpide_startup_check', array( $this, 'wpide_startup_check' ) );
72
 
73
 
74
  }
88
 
89
  if ( defined('FS_METHOD') ){
90
 
91
+ define('WPIDE_FS_METHOD_FORCED_ELSEWHERE', FS_METHOD); //make a note of the forced method
92
 
93
  }else{
94
 
398
  if ( !current_user_can('edit_themes') )
399
  wp_die('<p>'.__('You do not have sufficient permissions to edit templates for this site. SORRY').'</p>');
400
 
401
+ if ( defined( 'WPIDE_FS_METHOD_FORCED_ELSEWHERE' ) ){
402
  echo "WordPress filesystem API has been forced to use the " . WPIDE_FS_METHOD_FORCED . " method by another plugin/WordPress. \n\n";
403
  }
404
 
660
  }
661
 
662
  }
663
+
664
+ $wpide = new wpide();
665
+
666
+ endif; // class_exists check
667
+
668
  ?>
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.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,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.5 =
78
  * On startup the editor page now shows extra debuggin information for the filesystem API initialisation.
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.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
 
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
+
80
  = 2.0.5 =
81
  * On startup the editor page now shows extra debuggin information for the filesystem API initialisation.
82