WP Editor - Version 1.2.2

Version Description

  • Fixed issues with PHP 5.4+
  • Fixed issue with selecting theme file types not working
  • Fixed issue with double scrollbar
  • Fixed issue with error message appearing when trying to save a post/page
  • Fixed issue with settings link not appearing for symlink installs
Download this release

Release Info

Developer benjaminprojas
Plugin Icon 128x128 WP Editor
Version 1.2.2
Comparing to
See all releases

Code changes from version 1.2.1 to 1.2.2

classes/WPEditorAdmin.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  class WPEditorAdmin {
3
 
4
- public function buildAdminMenu() {
5
  $page_roles = WPEditorSetting::getValue('admin_page_roles');
6
  $page_roles = unserialize($page_roles);
7
  if(WPEditorSetting::getValue('hide_wpeditor_menu')) {
@@ -30,7 +30,7 @@ class WPEditorAdmin {
30
  }
31
  }
32
 
33
- public function addThemesPage() {
34
  global $wpeditor_themes;
35
 
36
  $page_title = __('Theme Editor', 'wpeditor');
@@ -45,12 +45,12 @@ class WPEditorAdmin {
45
  }
46
  }
47
 
48
- public function addSettingsPage() {
49
  $view = WPEditor::getView('views/settings.php');
50
  echo $view;
51
  }
52
 
53
- public function editorStylesheetAndScripts() {
54
  wp_enqueue_style('wpeditor');
55
  wp_enqueue_script('wpeditor');
56
  wp_enqueue_style('fancybox');
@@ -70,12 +70,12 @@ class WPEditorAdmin {
70
  wp_enqueue_script('codemirror_searchcursor');
71
  }
72
 
73
- public function defaultStylesheetAndScript() {
74
  wp_enqueue_style('wpeditor');
75
  wp_enqueue_script('wpeditor');
76
  }
77
 
78
- public function removeDefaultEditorMenus() {
79
  // Remove default plugin editor
80
  if(WPEditorSetting::getValue('hide_default_plugin_editor') == 1) {
81
  global $submenu;
1
  <?php
2
  class WPEditorAdmin {
3
 
4
+ public static function buildAdminMenu() {
5
  $page_roles = WPEditorSetting::getValue('admin_page_roles');
6
  $page_roles = unserialize($page_roles);
7
  if(WPEditorSetting::getValue('hide_wpeditor_menu')) {
30
  }
31
  }
32
 
33
+ public static function addThemesPage() {
34
  global $wpeditor_themes;
35
 
36
  $page_title = __('Theme Editor', 'wpeditor');
45
  }
46
  }
47
 
48
+ public static function addSettingsPage() {
49
  $view = WPEditor::getView('views/settings.php');
50
  echo $view;
51
  }
52
 
53
+ public static function editorStylesheetAndScripts() {
54
  wp_enqueue_style('wpeditor');
55
  wp_enqueue_script('wpeditor');
56
  wp_enqueue_style('fancybox');
70
  wp_enqueue_script('codemirror_searchcursor');
71
  }
72
 
73
+ public static function defaultStylesheetAndScript() {
74
  wp_enqueue_style('wpeditor');
75
  wp_enqueue_script('wpeditor');
76
  }
77
 
78
+ public static function removeDefaultEditorMenus() {
79
  // Remove default plugin editor
80
  if(WPEditorSetting::getValue('hide_default_plugin_editor') == 1) {
81
  global $submenu;
classes/WPEditorBrowser.php CHANGED
@@ -203,7 +203,12 @@ class WPEditorBrowser {
203
  $slash = '\\';
204
  }
205
  $output = true;
206
- $allowed_extensions = explode('~', WPEditorSetting::getValue('plugin_editor_allowed_extensions'));
 
 
 
 
 
207
 
208
  if(is_dir($dir . $slash . $file)) {
209
  $output = true;
203
  $slash = '\\';
204
  }
205
  $output = true;
206
+ if(strstr($dir, 'plugins')) {
207
+ $allowed_extensions = explode('~', WPEditorSetting::getValue('plugin_editor_allowed_extensions'));
208
+ }
209
+ elseif(strstr($dir, 'themes')) {
210
+ $allowed_extensions = explode('~', WPEditorSetting::getValue('theme_editor_allowed_extensions'));
211
+ }
212
 
213
  if(is_dir($dir . $slash . $file)) {
214
  $output = true;
classes/WPEditorPlugins.php CHANGED
@@ -78,7 +78,7 @@ class WPEditorPlugins {
78
  echo WPEditor::getView('views/plugin-editor.php', $data);
79
  }
80
 
81
- public function pluginsHelpTab() {
82
  global $wpeditor_plugin;
83
  $screen = get_current_screen();
84
  if(function_exists('add_help_tab')) {
78
  echo WPEditor::getView('views/plugin-editor.php', $data);
79
  }
80
 
81
+ public static function pluginsHelpTab() {
82
  global $wpeditor_plugin;
83
  $screen = get_current_screen();
84
  if(function_exists('add_help_tab')) {
classes/WPEditorPosts.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  class WPEditorPosts {
3
 
4
- public function addPostsJquery($editor) {
5
  if(WPEditorSetting::getValue('enable_post_editor')) {
6
  $theme = WPEditorSetting::getValue('post_editor_theme') ? WPEditorSetting::getValue('post_editor_theme') : 'default';
7
  $activeLine = WPEditorSetting::getValue('enable_post_active_line') == 1 ? 'activeline-' . $theme : false;
@@ -19,8 +19,7 @@ class WPEditorPosts {
19
  'editorHeight' => WPEditorSetting::getValue('enable_post_editor_height') ? WPEditorSetting::getValue('enable_post_editor_height') : false,
20
  'fontSize' => WPEditorSetting::getValue("change_post_editor_font_size") ? WPEditorSetting::getValue("change_post_editor_font_size") . "px" : "12px"
21
  );
22
- $admin = new WPEditorAdmin();
23
- $admin->editorStylesheetAndScripts();
24
  wp_enqueue_script('wp-editor-posts-jquery');
25
  wp_localize_script('wp-editor-posts-jquery', 'WPEPosts', $post_editor_settings);
26
  }
1
  <?php
2
  class WPEditorPosts {
3
 
4
+ public static function addPostsJquery($editor) {
5
  if(WPEditorSetting::getValue('enable_post_editor')) {
6
  $theme = WPEditorSetting::getValue('post_editor_theme') ? WPEditorSetting::getValue('post_editor_theme') : 'default';
7
  $activeLine = WPEditorSetting::getValue('enable_post_active_line') == 1 ? 'activeline-' . $theme : false;
19
  'editorHeight' => WPEditorSetting::getValue('enable_post_editor_height') ? WPEditorSetting::getValue('enable_post_editor_height') : false,
20
  'fontSize' => WPEditorSetting::getValue("change_post_editor_font_size") ? WPEditorSetting::getValue("change_post_editor_font_size") . "px" : "12px"
21
  );
22
+ WPEditorAdmin::editorStylesheetAndScripts();
 
23
  wp_enqueue_script('wp-editor-posts-jquery');
24
  wp_localize_script('wp-editor-posts-jquery', 'WPEPosts', $post_editor_settings);
25
  }
classes/WPEditorThemes.php CHANGED
@@ -122,7 +122,7 @@ class WPEditorThemes {
122
  echo WPEditor::getView('views/theme-editor.php', $data);
123
  }
124
 
125
- public function themesHelpTab() {
126
  global $wpeditor_themes;
127
  $screen = get_current_screen();
128
  if(function_exists('add_help_tab') && function_exists('set_help_sidebar')) {
122
  echo WPEditor::getView('views/theme-editor.php', $data);
123
  }
124
 
125
+ public static function themesHelpTab() {
126
  global $wpeditor_themes;
127
  $screen = get_current_screen();
128
  if(function_exists('add_help_tab') && function_exists('set_help_sidebar')) {
extensions/codemirror/codemirror.css CHANGED
@@ -14,8 +14,8 @@
14
  .CodeMirror-scrollbar {
15
  position: absolute;
16
  right: 0; top: 0;
17
- overflow-x: hidden;
18
- overflow-y: scroll;
19
  z-index: 5;
20
  }
21
  .CodeMirror-scrollbar-inner {
14
  .CodeMirror-scrollbar {
15
  position: absolute;
16
  right: 0; top: 0;
17
+ overflow: hidden;
18
+ /*overflow-y: scroll;*/
19
  z-index: 5;
20
  }
21
  .CodeMirror-scrollbar-inner {
js/posts-jquery.js CHANGED
@@ -194,7 +194,8 @@ tags = {};
194
  return false;
195
  }
196
  })
197
- $('#publish').click(function(e) {
 
198
  var scrollPosition = editor.getScrollInfo();
199
  document.cookie="scrollPositionX=" + scrollPosition.x;
200
  document.cookie="scrollPositionY=" + scrollPosition.y;
194
  return false;
195
  }
196
  })
197
+ $('#post').submit(function(e) {
198
+ changeReset();
199
  var scrollPosition = editor.getScrollInfo();
200
  document.cookie="scrollPositionX=" + scrollPosition.x;
201
  document.cookie="scrollPositionY=" + scrollPosition.y;
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: benjaminprojas
3
  Donate link: http://wpeditor.net/
4
  Tags: code editor, plugin editor, theme editor, page editor, post editor, pages, posts, html, codemirror, plugins, themes, editor, fancybox, post.php, post-new.php, ajax, syntax highlighting, html syntax highlighting
5
  Requires at least: 3.0
6
- Tested up to: 3.5
7
- Stable tag: 1.2.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -69,6 +69,13 @@ Yes! While we don't have a need for further developers at this time, any financi
69
 
70
  == Changelog ==
71
 
 
 
 
 
 
 
 
72
  = 1.2.1 =
73
  * Added feature to preserve scroll position in post editor on save and toggle between Visual/Text views
74
  * Added z-index fix for gutter when WordPress menu is collapsed
@@ -132,6 +139,12 @@ Yes! While we don't have a need for further developers at this time, any financi
132
 
133
  == Upgrade Notice ==
134
 
 
 
 
 
 
 
135
  = 1.2.1 =
136
  Added feature to preserve scroll position in post editor on save and toggle between Visual/Text views
137
  Added z-index fix for gutter when WordPress menu is collapsed
3
  Donate link: http://wpeditor.net/
4
  Tags: code editor, plugin editor, theme editor, page editor, post editor, pages, posts, html, codemirror, plugins, themes, editor, fancybox, post.php, post-new.php, ajax, syntax highlighting, html syntax highlighting
5
  Requires at least: 3.0
6
+ Tested up to: 3.6
7
+ Stable tag: 1.2.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
69
 
70
  == Changelog ==
71
 
72
+ = 1.2.2 =
73
+ * Fixed issues with PHP 5.4+
74
+ * Fixed issue with selecting theme file types not working
75
+ * Fixed issue with double scrollbar
76
+ * Fixed issue with error message appearing when trying to save a post/page
77
+ * Fixed issue with settings link not appearing for symlink installs
78
+
79
  = 1.2.1 =
80
  * Added feature to preserve scroll position in post editor on save and toggle between Visual/Text views
81
  * Added z-index fix for gutter when WordPress menu is collapsed
139
 
140
  == Upgrade Notice ==
141
 
142
+ = 1.2.2 =
143
+ Fixed issues with PHP 5.4+
144
+ Fixed issue with selecting theme file types not working
145
+ Fixed issue with double scrollbar
146
+ Fixed issue with error message appearing when trying to save a post/page
147
+
148
  = 1.2.1 =
149
  Added feature to preserve scroll position in post editor on save and toggle between Visual/Text views
150
  Added z-index fix for gutter when WordPress menu is collapsed
wpeditor.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: WP Editor
4
  Plugin URI: http://wpeditor.net
5
  Description: This plugin modifies the default behavior of the WordPress plugin and theme editors.
6
- Version: 1.2.1
7
  Author: Benjamin Rojas
8
  Author URI: http://benjaminrojas.net
9
  Text Domain: wpeditor
@@ -37,8 +37,18 @@ if(!class_exists('WPEditor')) {
37
  define('WP_34', $wp_34);
38
 
39
  // Define the default path and URL for the WP Editor plugin
40
- define('WPEDITOR_PATH', plugin_dir_path( __FILE__ ));
41
- define('WPEDITOR_URL', plugins_url() . '/' . basename(dirname(__FILE__)));
 
 
 
 
 
 
 
 
 
 
42
 
43
  // Define the WP Editor version number
44
  define('WPEDITOR_VERSION_NUMBER', wpEditorVersionNumber());
@@ -77,7 +87,7 @@ if(!class_exists('WPEditor')) {
77
  }
78
 
79
  function wpEditorSettingsLink($links, $file) {
80
- $thisFile = plugin_basename(__FILE__);
81
  if($file == $thisFile) {
82
  $settings = '<a href="' . admin_url('admin.php?page=wpeditor_admin') . '" title="' . __('Open the settings page for this plugin', 'wpeditor') . '">' . __('Settings', 'wpeditor') . '</a>';
83
  array_unshift($links, $settings);
3
  Plugin Name: WP Editor
4
  Plugin URI: http://wpeditor.net
5
  Description: This plugin modifies the default behavior of the WordPress plugin and theme editors.
6
+ Version: 1.2.2
7
  Author: Benjamin Rojas
8
  Author URI: http://benjaminrojas.net
9
  Text Domain: wpeditor
37
  define('WP_34', $wp_34);
38
 
39
  // Define the default path and URL for the WP Editor plugin
40
+ $plugin_file = __FILE__;
41
+ if(isset($plugin)) {
42
+ $plugin_file = $plugin;
43
+ }
44
+ elseif(isset($mu_plugin)) {
45
+ $plugin_file = $mu_plugin;
46
+ }
47
+ elseif(isset($network_plugin)) {
48
+ $plugin_file = $network_plugin;
49
+ }
50
+ define('WPEDITOR_PATH', WP_PLUGIN_DIR . '/' . basename(dirname($plugin_file)) . '/');
51
+ define('WPEDITOR_URL', plugin_dir_url(WPEDITOR_PATH) . basename(dirname($plugin_file)) . '/');
52
 
53
  // Define the WP Editor version number
54
  define('WPEDITOR_VERSION_NUMBER', wpEditorVersionNumber());
87
  }
88
 
89
  function wpEditorSettingsLink($links, $file) {
90
+ $thisFile = plugin_basename(WPEDITOR_PATH) . '/' . basename(__FILE__);
91
  if($file == $thisFile) {
92
  $settings = '<a href="' . admin_url('admin.php?page=wpeditor_admin') . '" title="' . __('Open the settings page for this plugin', 'wpeditor') . '">' . __('Settings', 'wpeditor') . '</a>';
93
  array_unshift($links, $settings);