WP Editor Widget - Version 0.5.0

Version Description

  • This is a big change, please file an issue on Github if you find anything weird!
  • Changes for WP 3.9.0 (editor now works on the admin customization page as well as on the admin widgets page)
  • Most of the following changes thanks to @cfoellmann:
  • Added filter wp_editor_widget_ops
  • Added filter wp_editor_widget_update_instance
  • Added action wp_editor_widget_update
  • Removed constant variable textdomain
  • Changed textdomain to wordpress.org plugin id name
  • Split widget class into it's own file
  • Limited asset loading to widgets.php
  • Changed PHP code style to WP standard
Download this release

Release Info

Developer feedmeastraycat
Plugin Icon wp plugin WP Editor Widget
Version 0.5.0
Comparing to
See all releases

Code changes from version 0.4.1 to 0.5.0

assets/css/admin.css CHANGED
@@ -4,7 +4,7 @@
4
  left: 30px;
5
  right: 30px;
6
  bottom: 30px;
7
- z-index: 151000;
8
  background: #fff;
9
  }
10
  #wp-editor-widget-backdrop {
@@ -16,7 +16,7 @@
16
  min-height: 360px;
17
  background: #000;
18
  opacity: .7;
19
- z-index: 150000;
20
  }
21
  #wp-editor-widget-container .close {
22
  position: absolute;
4
  left: 30px;
5
  right: 30px;
6
  bottom: 30px;
7
+ z-index: 50100;
8
  background: #fff;
9
  }
10
  #wp-editor-widget-backdrop {
16
  min-height: 360px;
17
  background: #000;
18
  opacity: .7;
19
+ z-index: 50000;
20
  }
21
  #wp-editor-widget-container .close {
22
  position: absolute;
assets/js/admin.js CHANGED
@@ -7,6 +7,16 @@ WPEditorWidget = {
7
  * @var string
8
  */
9
  currentContentId: '',
 
 
 
 
 
 
 
 
 
 
10
 
11
  /**
12
  * Show the editor
@@ -17,6 +27,12 @@ WPEditorWidget = {
17
  jQuery('#wp-editor-widget-container').show();
18
 
19
  this.currentContentId = contentId;
 
 
 
 
 
 
20
 
21
  this.setEditorContent(contentId);
22
  },
@@ -27,6 +43,10 @@ WPEditorWidget = {
27
  hideEditor: function() {
28
  jQuery('#wp-editor-widget-backdrop').hide();
29
  jQuery('#wp-editor-widget-container').hide();
 
 
 
 
30
  },
31
 
32
  /**
@@ -47,13 +67,26 @@ WPEditorWidget = {
47
  */
48
  updateWidgetAndCloseEditor: function() {
49
  var editor = tinyMCE.EditorManager.get('wp-editor-widget');
 
50
  if (typeof editor == "undefined") {
51
  jQuery('#'+ this.currentContentId).val(jQuery('#wp-editor-widget').val());
52
  }
53
  else {
54
  jQuery('#'+ this.currentContentId).val(editor.getContent());
55
  }
56
- wpWidgets.save(jQuery('#'+ this.currentContentId).closest('div.widget'), 0, 1, 0);
 
 
 
 
 
 
 
 
 
 
 
 
57
  this.hideEditor();
58
  }
59
 
7
  * @var string
8
  */
9
  currentContentId: '',
10
+
11
+ /**
12
+ * @var string
13
+ */
14
+ currentEditorPage: '',
15
+
16
+ /**
17
+ * @var int
18
+ */
19
+ wpFullOverlayOriginalZIndex: 0,
20
 
21
  /**
22
  * Show the editor
27
  jQuery('#wp-editor-widget-container').show();
28
 
29
  this.currentContentId = contentId;
30
+ this.currentEditorPage = ( jQuery('body').hasClass('wp-customizer') ? 'wp-customizer':'wp-widgets');
31
+
32
+ if (this.currentEditorPage == "wp-customizer") {
33
+ this.wpFullOverlayOriginalZIndex = parseInt(jQuery('.wp-full-overlay').css('zIndex'));
34
+ jQuery('.wp-full-overlay').css({ zIndex: 49000 });
35
+ }
36
 
37
  this.setEditorContent(contentId);
38
  },
43
  hideEditor: function() {
44
  jQuery('#wp-editor-widget-backdrop').hide();
45
  jQuery('#wp-editor-widget-container').hide();
46
+
47
+ if (this.currentEditorPage == "wp-customizer") {
48
+ jQuery('.wp-full-overlay').css({ zIndex: this.wpFullOverlayOriginalZIndex });
49
+ }
50
  },
51
 
52
  /**
67
  */
68
  updateWidgetAndCloseEditor: function() {
69
  var editor = tinyMCE.EditorManager.get('wp-editor-widget');
70
+
71
  if (typeof editor == "undefined") {
72
  jQuery('#'+ this.currentContentId).val(jQuery('#wp-editor-widget').val());
73
  }
74
  else {
75
  jQuery('#'+ this.currentContentId).val(editor.getContent());
76
  }
77
+
78
+ // customize.php
79
+ if (this.currentEditorPage == "wp-customizer") {
80
+ var widget_id = jQuery('#'+ this.currentContentId).closest('div.form').find('input.widget-id').val();
81
+ var widget_form_control = wp.customize.Widgets.getWidgetFormControlForWidget( widget_id )
82
+ widget_form_control.updateWidget();
83
+ }
84
+
85
+ // widgets.php
86
+ else {
87
+ wpWidgets.save(jQuery('#'+ this.currentContentId).closest('div.widget'), 0, 1, 0);
88
+ }
89
+
90
  this.hideEditor();
91
  }
92
 
classes/class-widget.php ADDED
@@ -0,0 +1,129 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ //avoid direct calls to this file
3
+ if ( !defined( 'ABSPATH' ) ) {
4
+ header( 'Status: 403 Forbidden' );
5
+ header( 'HTTP/1.1 403 Forbidden' );
6
+ exit();
7
+ }
8
+
9
+ /**
10
+ * Adds WP_Editor_Widget widget.
11
+ */
12
+ class WP_Editor_Widget extends WP_Widget {
13
+
14
+ /**
15
+ * Register widget with WordPress.
16
+ */
17
+ public function __construct() {
18
+
19
+ $widget_ops = apply_filters(
20
+ 'wp_editor_widget_ops',
21
+ array(
22
+ 'classname' => 'WP_Editor_Widget',
23
+ 'description' => __( 'Arbitrary text, HTML or rich text through the standard WordPress visual editor.', 'wp-editor-widget' ),
24
+ )
25
+ );
26
+
27
+ parent::__construct(
28
+ 'WP_Editor_Widget',
29
+ __( 'Rich text', 'wp-editor-widget' ),
30
+ $widget_ops
31
+ );
32
+
33
+ } // END __construct()
34
+
35
+ /**
36
+ * Front-end display of widget.
37
+ *
38
+ * @see WP_Widget::widget()
39
+ *
40
+ * @param array $args Widget arguments.
41
+ * @param array $instance Saved values from database.
42
+ */
43
+ public function widget( $args, $instance ) {
44
+
45
+ extract( $args );
46
+
47
+ $title = apply_filters( 'wp_editor_widget_title', $instance['title'] );
48
+ $output_title = apply_filters( 'wp_editor_widget_output_title', $instance['output_title'] );
49
+ $content = apply_filters( 'wp_editor_widget_content', $instance['content'] );
50
+
51
+ echo $before_widget;
52
+
53
+ if ( $output_title == "1" && !empty($title) ) {
54
+ echo $before_title . $title . $after_title;
55
+ }
56
+
57
+ echo $content;
58
+
59
+ echo $after_widget;
60
+
61
+ } // END widget()
62
+
63
+ /**
64
+ * Back-end widget form.
65
+ *
66
+ * @see WP_Widget::form()
67
+ *
68
+ * @param array $instance Previously saved values from database.
69
+ */
70
+ public function form( $instance ) {
71
+
72
+ if ( isset($instance['title']) ) {
73
+ $title = $instance['title'];
74
+ }
75
+ else {
76
+ $title = __( 'New title', 'wp-editor-widget' );
77
+ }
78
+
79
+ if ( isset($instance['content']) ) {
80
+ $content = $instance['content'];
81
+ }
82
+ else {
83
+ $content = "";
84
+ }
85
+
86
+ $output_title = ( isset($instance['output_title']) && $instance['output_title'] == "1" ? true : false );
87
+ ?>
88
+ <input type="hidden" id="<?php echo $this->get_field_id('content'); ?>" name="<?php echo $this->get_field_name( 'content' ); ?>" value="<?php echo esc_attr($content); ?>">
89
+ <p>
90
+ <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title', 'wp-editor-widget' ); ?>:</label>
91
+ <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr($title); ?>" />
92
+ </p>
93
+ <p>
94
+ <a href="javascript:WPEditorWidget.showEditor('<?php echo $this->get_field_id( 'content' ); ?>');" class="button"><?php _e( 'Edit content', 'wp-editor-widget' ) ?></a>
95
+ </p>
96
+ <p>
97
+ <label for="<?php echo $this->get_field_id('output_title'); ?>">
98
+ <input type="checkbox" id="<?php echo $this->get_field_id('output_title'); ?>" name="<?php echo $this->get_field_name('output_title'); ?>" value="1" <?php checked($output_title, true) ?>> <?php _e( 'Output title', 'wp-editor-widget' ); ?>
99
+ </label>
100
+ </p>
101
+ <?php
102
+
103
+ } // END form()
104
+
105
+ /**
106
+ * Sanitize widget form values as they are saved.
107
+ *
108
+ * @see WP_Widget::update()
109
+ *
110
+ * @param array $new_instance Values just sent to be saved.
111
+ * @param array $old_instance Previously saved values from database.
112
+ *
113
+ * @return array Updated safe values to be saved.
114
+ */
115
+ public function update( $new_instance, $old_instance ) {
116
+
117
+ $instance = array();
118
+
119
+ $instance['title'] = ( !empty($new_instance['title']) ? strip_tags( $new_instance['title']) : '' );
120
+ $instance['content'] = ( !empty($new_instance['content']) ? $new_instance['content'] : '' );
121
+ $instance['output_title'] = ( isset($new_instance['output_title']) && $new_instance['output_title'] == "1" ? 1 : 0 );
122
+
123
+ do_action( 'wp_editor_widget_update', $new_instance, $instance );
124
+
125
+ return apply_filters( 'wp_editor_widget_update_instance', $instance, $new_instance );
126
+
127
+ } // END update()
128
+
129
+ } // END class WP_Editor_Widget
langs/{wpeditorwidget-sv_SE.mo → wp-editor-widget-sv_SE.mo} RENAMED
File without changes
langs/{wpeditorwidget-sv_SE.po → wp-editor-widget-sv_SE.po} RENAMED
File without changes
license.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2013 David M�rtensson <david.martensson@gmail.com>
2
 
3
  Permission is hereby granted, free of charge, to any person obtaining a copy
4
  of this software and associated documentation files (the "Software"), to deal
1
+ Copyright (c) 2013-2014 David Mårtensson <david.martensson@gmail.com>
2
 
3
  Permission is hereby granted, free of charge, to any person obtaining a copy
4
  of this software and associated documentation files (the "Software"), to deal
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: feedmeastraycat
3
  Tags: widget, wysiwyg, editor, rich text
4
  Requires at least: 3.5.1
5
- Tested up to: 3.8.1
6
- Stable tag: 0.4.1
7
  License: MIT
8
 
9
  WP Editor Widget adds a rich text widget where the content is edited using the standard WordPress visual editor.
@@ -32,6 +32,19 @@ Feel free to help with developement or issue reporting on [Github](https://githu
32
 
33
  == Changelog ==
34
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
  = 0.4.1 =
36
  * Lowered the z-index of the WP Editor overlay modal because image buttons (in the editor) wasn't showing because they had lower z-index (thanks nbspjr on WordPress.org http://wordpress.org/support/topic/edit-mediagallery-buttons-are-not-shown-1)
37
 
2
  Contributors: feedmeastraycat
3
  Tags: widget, wysiwyg, editor, rich text
4
  Requires at least: 3.5.1
5
+ Tested up to: 3.9.0
6
+ Stable tag: 0.5.0
7
  License: MIT
8
 
9
  WP Editor Widget adds a rich text widget where the content is edited using the standard WordPress visual editor.
32
 
33
  == Changelog ==
34
 
35
+ = 0.5.0 =
36
+ * *This is a big change, please file an issue on [Github](https://github.com/feedmeastraycat/wp-editor-widget) if you find anything weird!*
37
+ * Changes for WP 3.9.0 (editor now works on the admin customization page as well as on the admin widgets page)
38
+ * *Most of the following changes thanks to [@cfoellmann](https://github.com/cfoellmann):*
39
+ * Added filter `wp_editor_widget_ops`
40
+ * Added filter `wp_editor_widget_update_instance`
41
+ * Added action `wp_editor_widget_update`
42
+ * Removed constant variable textdomain
43
+ * Changed textdomain to wordpress.org plugin id name
44
+ * Split widget class into it's own file
45
+ * Limited asset loading to widgets.php
46
+ * Changed PHP code style to WP standard
47
+
48
  = 0.4.1 =
49
  * Lowered the z-index of the WP Editor overlay modal because image buttons (in the editor) wasn't showing because they had lower z-index (thanks nbspjr on WordPress.org http://wordpress.org/support/topic/edit-mediagallery-buttons-are-not-shown-1)
50
 
wp-editor-widget.php CHANGED
@@ -1,215 +1,115 @@
1
  <?php
2
  /*
3
  Plugin Name: WP Editor Widget
4
- Plugin URI: http://oddalice.com/
5
  Description: WP Editor Widget adds a WYSIWYG widget using the wp_editor().
6
  Author: David M&aring;rtensson, Odd Alice
7
- Version: 0.4.1
8
  Author URI: http://www.feedmeastraycat.net/
 
 
9
  */
10
 
 
 
 
 
 
 
11
 
 
12
 
13
- // Setup actions
14
- add_action('init', array('WPEditorWidget', 'init'));
15
- add_action('admin_init', array('WPEditorWidget', 'admin_init'));
16
- add_action('plugins_loaded', array('WPEditorWidget', 'plugins_loaded'));
17
- add_action('widgets_admin_page', array('WPEditorWidget', 'widgets_admin_page'), 100);
18
- add_action('widgets_init', array('WPEditorWidget', 'widgets_init'));
19
- // Setup filters
20
- add_filter('wp_editor_widget_content', 'wptexturize');
21
- add_filter('wp_editor_widget_content', 'convert_smilies');
22
- add_filter('wp_editor_widget_content', 'convert_chars');
23
- add_filter('wp_editor_widget_content', 'wpautop');
24
- add_filter('wp_editor_widget_content', 'shortcode_unautop');
25
- add_filter('wp_editor_widget_content', 'prepend_attachment');
26
- add_filter('wp_editor_widget_content', 'do_shortcode', 11);
27
-
28
-
29
-
30
- /**
31
  * WP Editor Widget singelton
32
  */
33
- class WPEditorWidget
34
- {
35
-
36
- /**
37
- * @var string
38
- */
39
- const VERSION = "0.4.1";
40
-
41
  /**
42
  * @var string
43
  */
44
- const TEXTDOMAIN = "wpeditorwidget";
45
-
46
  /**
47
  * Action: init
48
  */
49
- public static function init()
50
- {
51
- }
52
-
 
 
 
 
 
 
 
53
  /**
54
- * Action: admin_init
 
55
  */
56
- public static function admin_init()
57
- {
58
- wp_register_script('wp-editor-widget-js', plugins_url('assets/js/admin.js', __FILE__), array('jquery'), self::VERSION);
59
- wp_enqueue_script('wp-editor-widget-js');
60
-
61
- wp_register_style('wp-editor-widget-css', plugins_url('assets/css/admin.css', __FILE__), array(), self::VERSION);
62
- wp_enqueue_style('wp-editor-widget-css');
63
- }
64
-
 
 
 
 
 
 
 
 
65
  /**
66
  * Action: plugins_loaded
67
  */
68
- public static function plugins_loaded()
69
- {
70
  // Load translations
71
- load_plugin_textdomain(self::TEXTDOMAIN, false, dirname(plugin_basename(__FILE__)).'/langs/');
72
- }
 
73
 
74
  /**
75
  * Action: widgets_admin_page
 
76
  */
77
- public static function widgets_admin_page() {
 
78
  ?>
79
  <div id="wp-editor-widget-container" style="display: none;">
80
- <a class="close" href="javascript:WPEditorWidget.hideEditor();" title="<?php esc_attr_e('Close', self::TEXTDOMAIN) ?>"><span class="icon"></span></a>
81
  <div class="editor">
82
  <?php
83
  $settings = array(
84
- 'textarea_rows' => 15
85
  );
86
- wp_editor('', 'wp-editor-widget', $settings);
87
  ?>
88
  <p>
89
- <a href="javascript:WPEditorWidget.updateWidgetAndCloseEditor(true);" class="button button-primary"><?php _e('Save and close', self::TEXTDOMAIN) ?></a>
90
  </p>
91
  </div>
92
  </div>
93
  <div id="wp-editor-widget-backdrop" style="display: none;"></div>
94
  <?php
95
- }
96
-
97
- /**
98
- * Action: widgets_init
99
- */
100
- public static function widgets_init()
101
- {
102
- register_widget('WP_Editor_Widget');
103
- }
104
-
105
- }
106
-
107
-
108
-
109
- /**
110
- * Adds WP_Editor_Widget widget.
111
- */
112
- class WP_Editor_Widget extends WP_Widget
113
- {
114
-
115
- /**
116
- * Register widget with WordPress.
117
- */
118
- public function __construct() {
119
- parent::__construct(
120
- 'wp_editor_widget',
121
- __('Rich text', WPEditorWidget::TEXTDOMAIN),
122
- array('description' => __('Arbitrary text, HTML or rich text through the standard WordPress visual editor.', WPEditorWidget::TEXTDOMAIN))
123
- );
124
- }
125
-
126
- /**
127
- * Front-end display of widget.
128
- *
129
- * @see WP_Widget::widget()
130
- *
131
- * @param array $args Widget arguments.
132
- * @param array $instance Saved values from database.
133
- */
134
- public function widget($args, $instance)
135
- {
136
- extract( $args );
137
-
138
- $title = apply_filters('wp_editor_widget_title', $instance['title']);
139
- $output_title = apply_filters('wp_editor_widget_output_title', $instance['output_title']);
140
- $content = apply_filters('wp_editor_widget_content', $instance['content']);
141
-
142
- echo $before_widget;
143
 
144
- if ($output_title == "1" && !empty($title)) {
145
- echo $before_title.$title.$after_title;
146
- }
147
-
148
- echo $content;
149
-
150
- echo $after_widget;
151
- }
152
 
153
  /**
154
- * Back-end widget form.
155
- *
156
- * @see WP_Widget::form()
157
- *
158
- * @param array $instance Previously saved values from database.
159
  */
160
- public function form($instance)
161
- {
162
- if (isset($instance['title'])) {
163
- $title = $instance['title'];
164
- }
165
- else {
166
- $title = __('New title', WPEditorWidget::TEXTDOMAIN);
167
- }
168
-
169
- if (isset($instance['content'])) {
170
- $content = $instance['content'];
171
- }
172
- else {
173
- $content = "";
174
- }
175
-
176
- $output_title = (isset($instance['output_title']) && $instance['output_title'] == "1" ? true:false);
177
- ?>
178
- <input type="hidden" id="<?php echo $this->get_field_id('content'); ?>" name="<?php echo $this->get_field_name('content'); ?>" value="<?php echo esc_attr($content); ?>">
179
- <p>
180
- <label for="<?php echo $this->get_field_name('title'); ?>"><?php _e('Title', WPEditorWidget::TEXTDOMAIN); ?>:</label>
181
- <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>" />
182
- </p>
183
- <p>
184
- <a href="javascript:WPEditorWidget.showEditor('<?php echo $this->get_field_id('content'); ?>');"><?php _e('Edit content', WPEditorWidget::TEXTDOMAIN) ?></a>
185
- </p>
186
- <p>
187
- <label for="<?php echo $this->get_field_id('output_title'); ?>">
188
- <input type="checkbox" id="<?php echo $this->get_field_id('output_title'); ?>" name="<?php echo $this->get_field_name('output_title'); ?>" value="1" <?php checked($output_title, true) ?>> <?php _e('Output title', WPEditorWidget::TEXTDOMAIN); ?>
189
- </label>
190
- </p>
191
- <?php
192
- }
193
 
194
- /**
195
- * Sanitize widget form values as they are saved.
196
- *
197
- * @see WP_Widget::update()
198
- *
199
- * @param array $new_instance Values just sent to be saved.
200
- * @param array $old_instance Previously saved values from database.
201
- *
202
- * @return array Updated safe values to be saved.
203
- */
204
- public function update($new_instance, $old_instance)
205
- {
206
- $instance = array();
207
-
208
- $instance['title'] = (!empty($new_instance['title']) ? strip_tags( $new_instance['title']):'');
209
- $instance['content'] = (!empty($new_instance['content']) ? $new_instance['content']:'');
210
- $instance['output_title'] = (isset($new_instance['output_title']) && $new_instance['output_title'] == "1" ? 1:0);
211
 
212
- return $instance;
213
- }
214
 
215
- }
 
1
  <?php
2
  /*
3
  Plugin Name: WP Editor Widget
4
+ Plugin URI: https://github.com/feedmeastraycat/wp-editor-widget
5
  Description: WP Editor Widget adds a WYSIWYG widget using the wp_editor().
6
  Author: David M&aring;rtensson, Odd Alice
7
+ Version: 0.5.0
8
  Author URI: http://www.feedmeastraycat.net/
9
+ Text Domain: wp-editor-widget
10
+ Domain Path: /langs
11
  */
12
 
13
+ //avoid direct calls to this file
14
+ if ( !defined( 'ABSPATH' ) ) {
15
+ header( 'Status: 403 Forbidden' );
16
+ header( 'HTTP/1.1 403 Forbidden' );
17
+ exit();
18
+ }
19
 
20
+ include 'classes/class-widget.php';
21
 
22
+ /**
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
  * WP Editor Widget singelton
24
  */
25
+ class WPEditorWidget {
26
+
 
 
 
 
 
 
27
  /**
28
  * @var string
29
  */
30
+ const VERSION = "0.5.0";
31
+
32
  /**
33
  * Action: init
34
  */
35
+ public function __construct() {
36
+
37
+ add_action( 'widgets_init', array( $this, 'widgets_init' ) );
38
+ add_action( 'load-widgets.php', array( $this, 'load_admin_assets' ) );
39
+ add_action( 'load-customize.php', array( $this, 'load_admin_assets' ) );
40
+ add_action( 'widgets_admin_page', array( $this, 'output_wp_editor_widget_html' ), 100 );
41
+ add_action( 'customize_controls_print_footer_scripts', array( $this, 'output_wp_editor_widget_html' ) );
42
+ add_action( 'plugins_loaded', array( $this, 'plugins_loaded' ) );
43
+
44
+ } // END __construct()
45
+
46
  /**
47
+ * Action: load-widgets.php
48
+ * Action: load-customize.php
49
  */
50
+ public function load_admin_assets() {
51
+
52
+ wp_register_script( 'wp-editor-widget-js', plugins_url( 'assets/js/admin.js', __FILE__ ), array( 'jquery' ), self::VERSION );
53
+ wp_enqueue_script( 'wp-editor-widget-js' );
54
+
55
+ wp_register_style( 'wp-editor-widget-css', plugins_url( 'assets/css/admin.css', __FILE__ ), array(), self::VERSION );
56
+ wp_enqueue_style( 'wp-editor-widget-css' );
57
+
58
+ add_filter( 'wp_editor_widget_content', 'wptexturize' );
59
+ add_filter( 'wp_editor_widget_content', 'convert_smilies' );
60
+ add_filter( 'wp_editor_widget_content', 'convert_chars' );
61
+ add_filter( 'wp_editor_widget_content', 'wpautop' );
62
+ add_filter( 'wp_editor_widget_content', 'shortcode_unautop' );
63
+ add_filter( 'wp_editor_widget_content', 'do_shortcode', 11 );
64
+
65
+ } // END load_admin_assets()
66
+
67
  /**
68
  * Action: plugins_loaded
69
  */
70
+ public function plugins_loaded() {
71
+
72
  // Load translations
73
+ load_plugin_textdomain( 'wp-editor-widget', false, dirname( plugin_basename( __FILE__ ) ) . '/langs/' );
74
+
75
+ } // END plugins_loaded()
76
 
77
  /**
78
  * Action: widgets_admin_page
79
+ * Action: customize_controls_print_footer_scripts
80
  */
81
+ public function output_wp_editor_widget_html() {
82
+
83
  ?>
84
  <div id="wp-editor-widget-container" style="display: none;">
85
+ <a class="close" href="javascript:WPEditorWidget.hideEditor();" title="<?php esc_attr_e( 'Close', 'wp-editor-widget' ); ?>"><span class="icon"></span></a>
86
  <div class="editor">
87
  <?php
88
  $settings = array(
89
+ 'textarea_rows' => 15,
90
  );
91
+ wp_editor( '', 'wp-editor-widget', $settings );
92
  ?>
93
  <p>
94
+ <a href="javascript:WPEditorWidget.updateWidgetAndCloseEditor(true);" class="button button-primary"><?php _e( 'Save and close', 'wp-editor-widget' ); ?></a>
95
  </p>
96
  </div>
97
  </div>
98
  <div id="wp-editor-widget-backdrop" style="display: none;"></div>
99
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
100
 
101
+ } // END output_wp_editor_widget_html
 
 
 
 
 
 
 
102
 
103
  /**
104
+ * Action: widgets_init
 
 
 
 
105
  */
106
+ public function widgets_init() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
107
 
108
+ register_widget( 'WP_Editor_Widget' );
109
+
110
+ } // END widgets_init()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
111
 
112
+ } // END class WPEditorWidget
 
113
 
114
+ global $wp_editor_widget;
115
+ $wp_editor_widget = new WPEditorWidget;