WP Edit - Version 3.7

Version Description

  • 01/11-16

  • Fixed Feedblitz image loading insecure over https.

  • Fixed WP_PLUGIN_URL constant; switched to using plugins_url() function.

  • Fixed profile biography editor.

  • Updated compatibility version.

Download this release

Release Info

Developer josh401
Plugin Icon wp plugin WP Edit
Version 3.7
Comparing to
See all releases

Code changes from version 3.6 to 3.7

Files changed (3) hide show
  1. includes/functions.php +770 -757
  2. main.php +1 -1
  3. readme.txt +10 -2
includes/functions.php CHANGED
@@ -1,758 +1,771 @@
1
- <?php
2
-
3
- /*
4
- ****************************************************************
5
- Global Functions
6
- ****************************************************************
7
- */
8
- $plugin_options_global = get_option('wp_edit_global');
9
-
10
- // Disable admin bar links
11
- if($plugin_options_global['disable_admin_links'] != 1) {
12
-
13
- function wp_edit_admin_bar_init() {
14
-
15
- // Is the user sufficiently leveled, or has the bar been disabled?
16
- if (!is_admin() || !is_admin_bar_showing() ) {
17
- return;
18
- }
19
- // Good to go, lets do this!
20
- add_action('admin_bar_menu', 'wp_edit_admin_bar_links', 500);
21
- }
22
- add_action('admin_bar_init', 'wp_edit_admin_bar_init');
23
-
24
- function wp_edit_admin_bar_links() {
25
-
26
- global $wp_admin_bar;
27
- $path = admin_url();
28
- $wp_admin_bar->add_menu( array(
29
- 'title' => __('WP Edit','wp-edit'),
30
- 'id' => 'jwl_links',
31
- 'href' => $path . 'admin.php?page=wp_edit_options&tab=buttons'
32
- ));
33
- /** * Add the submenu links. */
34
- $wp_admin_bar->add_menu( array(
35
- 'id' => 'jwl_admin_buttons',
36
- 'parent' => 'jwl_links',
37
- 'title' => __('Buttons','wp-edit'),
38
- 'href' => $path.'admin.php?page=wp_edit_options&tab=buttons',
39
- 'meta' => array(
40
- 'title' => __('Buttons','wp-edit')
41
- ),
42
- ));
43
- $wp_admin_bar->add_menu( array(
44
- 'id' => 'jwl_admin_global',
45
- 'parent' => 'jwl_links',
46
- 'title' => __('Global','wp-edit'),
47
- 'href' => $path.'admin.php?page=wp_edit_options&tab=global',
48
- 'meta' => array(
49
- 'title' => __('Global','wp-edit')
50
- ),
51
- ));
52
- $wp_admin_bar->add_menu( array(
53
- 'id' => 'jwl_admin_general',
54
- 'parent' => 'jwl_links',
55
- 'title' => __('General','wp-edit'),
56
- 'href' => $path.'admin.php?page=wp_edit_options&tab=general',
57
- 'meta' => array(
58
- 'title' => __('General','wp-edit')
59
- ),
60
- ));
61
- $wp_admin_bar->add_menu( array(
62
- 'id' => 'jwl_admin_posts',
63
- 'parent' => 'jwl_links',
64
- 'title' => __('Posts/Pages','wp-edit'),
65
- 'href' => $path.'admin.php?page=wp_edit_options&tab=posts',
66
- 'meta' => array(
67
- 'title' => __('Posts/Pages','wp-edit')
68
- ),
69
- ));
70
- $wp_admin_bar->add_menu( array(
71
- 'id' => 'jwl_admin_editor',
72
- 'parent' => 'jwl_links',
73
- 'title' => __('Editor','wp-edit'),
74
- 'href' => $path.'admin.php?page=wp_edit_options&tab=editor',
75
- 'meta' => array(
76
- 'title' => __('Editor','wp-edit')
77
- ),
78
- ));
79
- $wp_admin_bar->add_menu( array(
80
- 'id' => 'jwl_admin_extras',
81
- 'parent' => 'jwl_links',
82
- 'title' => __('Extras','wp-edit'),
83
- 'href' => $path.'admin.php?page=wp_edit_options&tab=extras',
84
- 'meta' => array(
85
- 'title' => __('Extras','wp-edit')
86
- ),
87
- ));
88
- $wp_admin_bar->add_menu( array(
89
- 'id' => 'jwl_admin_user_specific',
90
- 'parent' => 'jwl_links',
91
- 'title' => __('User Specific','wp-edit'),
92
- 'href' => $path.'admin.php?page=wp_edit_options&tab=user_specific',
93
- 'meta' => array(
94
- 'title' => __('User Specific','wp-edit')
95
- ),
96
- ));
97
- $wp_admin_bar->add_menu( array(
98
- 'id' => 'jwl_admin_database',
99
- 'parent' => 'jwl_links',
100
- 'title' => __('Database','wp-edit'),
101
- 'href' => $path.'admin.php?page=wp_edit_options&tab=database',
102
- 'meta' => array(
103
- 'title' => __('Database','wp-edit')
104
- ),
105
- ));
106
- $wp_admin_bar->add_menu( array(
107
- 'id' => 'jwl_admin_about',
108
- 'parent' => 'jwl_links',
109
- 'title' => __('About','wp-edit'),
110
- 'href' => $path.'admin.php?page=wp_edit_options&tab=about',
111
- 'meta' => array(
112
- 'title' => __('About','wp-edit')
113
- ),
114
- ));
115
- }
116
- }
117
-
118
- /*
119
- ****************************************************************
120
- General Functions
121
- ****************************************************************
122
- */
123
- $plugin_options_general = get_option('wp_edit_general');
124
-
125
- // Enable LineBreak Shortcode
126
- if($plugin_options_general['linebreak_shortcode'] == 1) {
127
-
128
- function wp_edit_insert_linebreak($atts){
129
- return '<br clear="none" />';
130
- }
131
- add_shortcode( 'break', 'wp_edit_insert_linebreak' );
132
- }
133
-
134
- // Enable Shortcodes in Widgets
135
- if($plugin_options_general['shortcodes_in_widgets'] == 1) {
136
-
137
- add_filter( 'widget_text', 'do_shortcode');
138
- }
139
-
140
- // Enable Shortcodes in Excerpts
141
- if($plugin_options_general['shortcodes_in_excerpts'] == 1) {
142
-
143
- add_filter( 'the_excerpt', 'do_shortcode');
144
- }
145
-
146
- // Add Editor to Post Excerpts
147
- if($plugin_options_general['post_excerpt_editor'] == 1) {
148
-
149
- function wp_edit_change_post_excerpt() {
150
- remove_meta_box('postexcerpt', 'post', 'normal');
151
- add_meta_box('postexcerpt', __('WP Edit Excerpt', 'wp-edit'), 'wp_edit_post_excerpt_meta_box', 'post', 'normal');
152
- }
153
- add_action( 'admin_init', 'wp_edit_change_post_excerpt' );
154
-
155
- function wp_edit_post_excerpt_meta_box() {
156
- global $wpdb,$post;
157
- $tinymce_summary = $wpdb->get_row("SELECT post_excerpt FROM $wpdb->posts WHERE id = '$post->ID'");
158
- $post_tinymce_excerpt = $tinymce_summary->post_excerpt;
159
-
160
- $id = 'excerpt';
161
- $settings = array(
162
- 'quicktags' => array('buttons' => 'em,strong,link',),
163
- 'text_area_name'=> 'excerpt',
164
- 'quicktags' => true,
165
- 'tinymce' => true,
166
- 'editor_css' => '<style>#wp-excerpt-editor-container .wp-editor-area{height:250px; width:100%;}</style>'
167
- );
168
- wp_editor($post_tinymce_excerpt,$id,$settings);
169
- }
170
- }
171
-
172
- // Add Editor to Page Excerpts
173
- if($plugin_options_general['page_excerpt_editor'] == 1) {
174
-
175
- add_action('init', 'wp_edit_page_excerpts_init');
176
- function wp_edit_page_excerpts_init() {
177
- add_post_type_support('page', array('excerpt'));
178
- }
179
-
180
- add_action( 'admin_init', 'wp_edit_change_page_excerpt' );
181
- function wp_edit_change_page_excerpt() {
182
- remove_meta_box('postexcerpt', 'page', 'normal');
183
- add_meta_box('postexcerpt', __('Wp Edit Excerpt', 'wp-edit'), 'wp_edit_page_excerpt_meta_box', 'page', 'normal');
184
- }
185
-
186
- function wp_edit_page_excerpt_meta_box() {
187
- global $wpdb,$post;
188
- $tinymce_summary_page = $wpdb->get_row("SELECT post_excerpt FROM $wpdb->posts WHERE id = '$post->ID'");
189
- $post_tinymce_excerpt_page = $tinymce_summary_page->post_excerpt;
190
-
191
- $id = 'excerpt';
192
- $settings = array(
193
- 'quicktags' => array('buttons' => 'em,strong,link',),
194
- 'text_area_name'=> 'excerpt',
195
- 'quicktags' => true,
196
- 'tinymce' => true,
197
- 'editor_css' => '<style>#wp-excerpt-editor-container .wp-editor-area{height:250px; width:100%;}</style>'
198
- );
199
- wp_editor($post_tinymce_excerpt_page,$id,$settings);
200
- }
201
- }
202
-
203
- // Extend editor to profile biography
204
- if($plugin_options_general['profile_editor'] == 1) {
205
-
206
- function wp_edit_visual_editor($user) {
207
-
208
- // Contributor level user or higher required
209
- if ( !current_user_can('edit_posts') )
210
- return;
211
- ?>
212
- <table class="form-table">
213
- <tr id="wp_edit_biographical_editor">
214
- <th><label for="description"><?php _e('Biographical Info', 'wp-edit'); ?></label></th>
215
- <td>
216
- <?php
217
- $description = get_user_meta( $user->ID, 'description', true);
218
- $args = array('textarea_rows' => 5);
219
- wp_editor( $description, 'description', $args );
220
- ?>
221
- <p class="description"><?php _e('Share a little biographical information to fill out your profile. This may be shown publicly.', 'wp-edit'); ?></p>
222
- </td>
223
- </tr>
224
- </table>
225
- <?php
226
- }
227
- add_action('show_user_profile','wp_edit_visual_editor');
228
- add_action('edit_user_profile','wp_edit_visual_editor');
229
-
230
- function wp_edit_editor_biography_js($hook) {
231
-
232
- global $current_screen;
233
- if($current_screen->id === 'profile' || $current_screen->id === 'edit-profile') {
234
-
235
- ?>
236
- <script type="text/javascript">
237
- jQuery(document).ready(function($) {
238
- // Remove the textarea before displaying visual editor
239
- $('#description').parents('tr').remove();
240
-
241
- field = $('#wp_edit_biographical_editor').remove();
242
- parent = $('#password').closest('tr');
243
- field.insertBefore(parent);
244
- });
245
- </script>
246
- <?php
247
- }
248
- }
249
- add_action( 'admin_head', 'wp_edit_editor_biography_js', 10, 1 );
250
- }
251
-
252
- /*
253
- ****************************************************************
254
- Posts/Pages Functions
255
- ****************************************************************
256
- */
257
- $plugin_options_posts = get_option('wp_edit_posts');
258
-
259
- // Post title field
260
- if(isset($plugin_options_posts['post_title_field']) && $plugin_options_posts['post_title_field'] != 'Enter title here') {
261
-
262
- function wp_edit_title_text_input( $title ){
263
-
264
- $plugin_options_posts = get_option('wp_edit_posts');
265
- $title = $plugin_options_posts['post_title_field'];
266
- return $title;
267
- }
268
- add_filter( 'enter_title_here', 'wp_edit_title_text_input' );
269
- }
270
-
271
- // Column Shortcodes
272
- if($plugin_options_posts['column_shortcodes'] == 1) {
273
-
274
- function wp_edit_one_third( $atts, $content = null ) { return '<div class="jwl_one_third">' . do_shortcode($content) . '</div>'; }
275
- add_shortcode('one_third', 'wp_edit_one_third');
276
- function wp_edit_one_third_last( $atts, $content = null ) { return '<div class="jwl_one_third last">' . do_shortcode($content) . '</div><div class="clearboth"></div>'; }
277
- add_shortcode('one_third_last', 'wp_edit_one_third_last');
278
- function wp_edit_two_third( $atts, $content = null ) { return '<div class="jwl_two_third">' . do_shortcode($content) . '</div>'; }
279
- add_shortcode('two_third', 'wp_edit_two_third');
280
- function wp_edit_two_third_last( $atts, $content = null ) { return '<div class="jwl_two_third last">' . do_shortcode($content) . '</div><div class="clearboth"></div>'; }
281
- add_shortcode('two_third_last', 'wp_edit_two_third_last');
282
- function wp_edit_one_half( $atts, $content = null ) { return '<div class="jwl_one_half">' . do_shortcode($content) . '</div>'; }
283
- add_shortcode('one_half', 'wp_edit_one_half');
284
- function wp_edit_one_half_last( $atts, $content = null ) { return '<div class="jwl_one_half last">' . do_shortcode($content) . '</div><div class="clearboth"></div>'; }
285
- add_shortcode('one_half_last', 'wp_edit_one_half_last');
286
- function wp_edit_one_fourth( $atts, $content = null ) { return '<div class="jwl_one_fourth">' . do_shortcode($content) . '</div>'; }
287
- add_shortcode('one_fourth', 'wp_edit_one_fourth');
288
- function wp_edit_one_fourth_last( $atts, $content = null ) { return '<div class="jwl_one_fourth last">' . do_shortcode($content) . '</div><div class="clearboth"></div>'; }
289
- add_shortcode('one_fourth_last', 'wp_edit_one_fourth_last');
290
- function wp_edit_three_fourth( $atts, $content = null ) { return '<div class="jwl_three_fourth">' . do_shortcode($content) . '</div>'; }
291
- add_shortcode('three_fourth', 'wp_edit_three_fourth');
292
- function wp_edit_three_fourth_last( $atts, $content = null ) { return '<div class="jwl_three_fourth last">' . do_shortcode($content) . '</div><div class="clearboth"></div>'; }
293
- add_shortcode('three_fourth_last', 'wp_edit_three_fourth_last');
294
- function wp_edit_one_fifth( $atts, $content = null ) { return '<div class="jwl_one_fifth">' . do_shortcode($content) . '</div>'; }
295
- add_shortcode('one_fifth', 'wp_edit_one_fifth');
296
- function wp_edit_one_fifth_last( $atts, $content = null ) { return '<div class="jwl_one_fifth last">' . do_shortcode($content) . '</div><div class="clearboth"></div>'; }
297
- add_shortcode('one_fifth_last', 'wp_edit_one_fifth_last');
298
- function wp_edit_two_fifth( $atts, $content = null ) { return '<div class="jwl_two_fifth">' . do_shortcode($content) . '</div>'; }
299
- add_shortcode('two_fifth', 'wp_edit_two_fifth');
300
- function wp_edit_two_fifth_last( $atts, $content = null ) { return '<div class="jwl_two_fifth last">' . do_shortcode($content) . '</div><div class="clearboth"></div>'; }
301
- add_shortcode('two_fifth_last', 'wp_edit_two_fifth_last');
302
- function wp_edit_three_fifth( $atts, $content = null ) { return '<div class="jwl_three_fifth">' . do_shortcode($content) . '</div>'; }
303
- add_shortcode('three_fifth', 'wp_edit_three_fifth');
304
- function wp_edit_three_fifth_last( $atts, $content = null ) { return '<div class="jwl_three_fifth last">' . do_shortcode($content) . '</div><div class="clearboth"></div>'; }
305
- add_shortcode('three_fifth_last', 'wp_edit_three_fifth_last');
306
- function wp_edit_four_fifth( $atts, $content = null ) { return '<div class="jwl_four_fifth">' . do_shortcode($content) . '</div>'; }
307
- add_shortcode('four_fifth', 'wp_edit_four_fifth');
308
- function wp_edit_four_fifth_last( $atts, $content = null ) { return '<div class="jwl_four_fifth last">' . do_shortcode($content) . '</div><div class="clearboth"></div>'; }
309
- add_shortcode('four_fifth_last', 'wp_edit_four_fifth_last');
310
- function wp_edit_one_sixth( $atts, $content = null ) { return '<div class="jwl_one_sixth">' . do_shortcode($content) . '</div>'; }
311
- add_shortcode('one_sixth', 'wp_edit_one_sixth');
312
- function wp_edit_one_sixth_last( $atts, $content = null ) { return '<div class="jwl_one_sixth last">' . do_shortcode($content) . '</div><div class="clearboth"></div>'; }
313
- add_shortcode('one_sixth_last', 'wp_edit_one_sixth_last');
314
- function wp_edit_five_sixth( $atts, $content = null ) { return '<div class="jwl_five_sixth">' . do_shortcode($content) . '</div>'; }
315
- add_shortcode('five_sixth', 'wp_edit_five_sixth');
316
- function wp_edit_five_sixth_last( $atts, $content = null ) { return '<div class="jwl_five_sixth last">' . do_shortcode($content) . '</div><div class="clearboth"></div>'; }
317
- add_shortcode('five_sixth_last', 'wp_edit_five_sixth_last');
318
-
319
- function wp_edit_column_stylesheet() {
320
-
321
- wp_register_style('wp_edit_column-styles', WP_PLUGIN_URL.'/wp-edit/css/column-style.css');
322
- wp_enqueue_style('wp_edit_column-styles');
323
- }
324
- add_action('wp_print_styles', 'wp_edit_column_stylesheet');
325
- }
326
-
327
- // Disable wpautop
328
- if(!empty($plugin_options_posts['disable_wpautop']) && $plugin_options_posts['disable_wpautop'] == '1') {
329
-
330
- if ( ! class_exists( 'JWL_Toggle_wpautop' ) ) {
331
-
332
- /*** JWL_Toggle_wpautop class. */
333
- class JWL_Toggle_wpautop {
334
-
335
- /*** Add our hooks and filters */
336
- function __construct() {
337
-
338
- add_action( 'admin_init', array( $this, 'activation' ) );
339
- add_action( 'admin_init', array( $this, 'admin_init' ) );
340
- add_action( 'add_meta_boxes', array( $this, 'add_meta_boxes' ) );
341
- add_action( 'save_post', array( $this, 'save_post' ) );
342
- add_action( 'the_post', array( $this, 'the_post' ) );
343
- add_action( 'loop_end', array( $this, 'loop_end' ) );
344
-
345
- add_filter( 'post_class', array( $this, 'post_class' ), 10, 3 );
346
- }
347
-
348
- /*** By default, add the ability to disable wpautop on all registered post types */
349
- function activation() {
350
-
351
- if ( $settings = get_option( 'jwl_toggle_wpautop_settings' ))
352
- return;
353
-
354
- $post_types = get_post_types();
355
-
356
- if ( empty( $post_types ) )
357
- return;
358
-
359
- $default_post_types = array();
360
-
361
- foreach ( $post_types as $post_type ) {
362
- $pt = get_post_type_object( $post_type );
363
-
364
- if ( in_array( $post_type, array( 'revision', 'nav_menu_item', 'attachment' ) ) || ! $pt->public )
365
- continue;
366
-
367
- $default_post_types[] = $post_type;
368
- }
369
-
370
- if ( ! empty( $default_post_types ) )
371
- add_option( 'jwl_toggle_wpautop_settings', $default_post_types );
372
- }
373
-
374
- /*** Add our settings fields to the writing page */
375
- function admin_init() {
376
-
377
- register_setting( 'jwl_toggle_wpautop_settings', 'jwl_toggle_wpautop_settings', array( $this, 'sanitize_settings' ) );
378
-
379
- //add a section for the plugin's settings on the writing page
380
- add_settings_section( 'jwl_toggle_wpautop_settings_section', __('Toggle wpautop', 'wp-edit'), array( $this, 'settings_section_text' ), 'writing' );
381
-
382
- //For each post type add a settings field, excluding revisions and nav menu items
383
- if ( $post_types = get_post_types() ) {
384
- foreach ( $post_types as $post_type ) {
385
- $pt = get_post_type_object( $post_type );
386
-
387
- if ( in_array( $post_type, array( 'revision', 'nav_menu_item', 'attachment' ) ) || ! $pt->public )
388
- continue;
389
-
390
- add_settings_field( 'jwl_toggle_wpautop_post_types' . $post_type, $pt->labels->name, array( $this,'toggle_wpautop_field' ), 'writing', 'jwl_toggle_wpautop_settings_section', array( 'slug' => $pt->name, 'name' => $pt->labels->name ) );
391
- }
392
- }
393
- }
394
-
395
- /*** Display our settings section */
396
- function settings_section_text() {
397
- echo '<p>';
398
- _e('Select which post types have the option to disable the wpautop filter.','wp-edit');
399
- echo '</p>';
400
- settings_fields( 'jwl_toggle_wpautop_settings' );
401
- }
402
-
403
- /*** Display the actual settings field */
404
- function toggle_wpautop_field( $args ) {
405
-
406
- $settings = get_option( 'jwl_toggle_wpautop_settings', array() );
407
-
408
- if ( $post_types = get_post_types() ) { ?>
409
- <input type="checkbox" name="jwl_toggle_wpautop_post_types[]" id="jwl_toggle_wpautop_post_types_<?php echo $args['slug']; ?>" value="<?php echo $args['slug']; ?>" <?php in_array( $args['slug'], $settings ) ? checked( true ) : checked( false ); ?>/>
410
- <?php
411
- }
412
- }
413
-
414
- /*** Sanitize our settings fields */
415
- function sanitize_settings( $input ) {
416
-
417
- $input = wp_parse_args( $_POST['jwl_toggle_wpautop_post_types'], array() );
418
-
419
- $new_input = array();
420
-
421
- foreach ( $input as $pt ) {
422
- if ( post_type_exists( sanitize_text_field( $pt ) ) )
423
- $new_input[] = sanitize_text_field( $pt );
424
- }
425
-
426
- return $new_input;
427
- }
428
-
429
- /*** Add meta boxes to the selected post types */
430
- function add_meta_boxes( $post_type ) {
431
-
432
- $settings = get_option( 'jwl_toggle_wpautop_settings', array() );
433
-
434
- if ( empty( $settings ) )
435
- return;
436
-
437
- if ( in_array( $post_type, $settings ) )
438
- add_action( 'post_submitbox_misc_actions', array( $this, 'post_submitbox_misc_actions' ), 5 );
439
- }
440
-
441
- /*** Display a checkbox to disable the wpautop filter */
442
- function post_submitbox_misc_actions() {
443
-
444
- global $post;
445
-
446
- wp_nonce_field( '_jwl_wpautop_nonce', '_jwl_wpautop_noncename' );
447
- ?>
448
- <div class="misc-pub-section jwl-wpautop">
449
- <span>Disable wpautop:</span> <input type="checkbox" name="_jwl_disable_wpautop" id="_jwl_disable_wpautop" <?php checked( get_post_meta( $post->ID, '_jwl_disable_wpautop', true ) ); ?> /> <span style="float:right; display: block;"><a href="http://codex.wordpress.org/Function_Reference/wpautop" target="_blank">?</a>
450
- </div>
451
- <?php
452
- }
453
-
454
- /*** Process the wpautop checkbox */
455
- function save_post( $post_id ) {
456
- //Skip revisions and autosaves
457
- if ( wp_is_post_revision( $post_id ) || ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) || ( defined( 'DOING_AJAX' ) && DOING_AJAX ) )
458
- return;
459
-
460
- //Users should have the ability to edit listings.
461
- if ( ! current_user_can( 'edit_post', $post_id ) )
462
- return;
463
-
464
- if ( isset( $_POST['_jwl_wpautop_noncename'] ) && wp_verify_nonce( $_POST['_jwl_wpautop_noncename'], '_jwl_wpautop_nonce' ) ) {
465
-
466
- if ( isset( $_POST['_jwl_disable_wpautop'] ) && ! empty( $_POST['_jwl_disable_wpautop'] ) )
467
- update_post_meta( $post_id, '_jwl_disable_wpautop', 1 );
468
- else
469
- delete_post_meta( $post_id, '_jwl_disable_wpautop' );
470
- }
471
- }
472
-
473
- /*** Add or remove the wpautop filter */
474
- function the_post( $post ) {
475
- if ( get_post_meta( $post->ID, '_jwl_disable_wpautop', true ) ) {
476
- remove_filter( 'the_content', 'wpautop' );
477
- remove_filter( 'the_excerpt', 'wpautop' );
478
- } else {
479
- if ( ! has_filter( 'the_content', 'wpautop' ) )
480
- add_filter( 'the_content', 'wpautop' );
481
-
482
- if ( ! has_filter( 'the_excerpt', 'wpautop' ) )
483
- add_filter( 'the_excerpt', 'wpautop' );
484
- }
485
- }
486
-
487
- /*** loop_end function. * After we run our loop, everything should be set back to normal */
488
- function loop_end() {
489
- if ( ! has_filter( 'the_content', 'wpautop' ) )
490
- add_filter( 'the_content', 'wpautop' );
491
-
492
- if ( ! has_filter( 'the_excerpt', 'wpautop' ) )
493
- add_filter( 'the_excerpt', 'wpautop' );
494
- }
495
-
496
- /*** Add a class to posts noting whether they were passed through the wpautop filter */
497
- function post_class( $classes, $class, $post_id ) {
498
- if ( get_post_meta( $post_id, '_jwl_disable_wpautop', true ) )
499
- $classes[] = 'no-wpautop';
500
- else
501
- $classes[] = 'wpautop';
502
-
503
- return $classes;
504
- }
505
- }
506
- }
507
- $jwl_toggle_wpautop = new JWL_Toggle_wpautop();
508
- }
509
-
510
- // Max post revisions
511
- if(isset($plugin_options_posts['max_post_revisions']) && $plugin_options_posts['max_post_revisions'] != '') {
512
-
513
- function wp_edit_max_post_revisions( $num, $post ) {
514
- $options_post_revisions = get_option('wp_edit_posts');
515
- if( 'post' == $post->post_type ) {
516
- $num = $options_post_revisions['max_post_revisions'];
517
- }
518
- return $num;
519
- }
520
- add_filter( 'wp_revisions_to_keep', 'wp_edit_max_post_revisions', 10, 2 );
521
- }
522
-
523
- // Max page revisions
524
- if(isset($plugin_options_posts['max_page_revisions']) && $plugin_options_posts['max_page_revisions'] != '') {
525
-
526
- function wp_edit_max_page_revisions( $num, $post ) {
527
- $options_post_revisions = get_option('wp_edit_posts');
528
- if( 'page' == $post->post_type ) {
529
- $num = $options_post_revisions['max_page_revisions'];
530
- }
531
- return $num;
532
- }
533
- add_filter( 'wp_revisions_to_keep', 'wp_edit_max_page_revisions', 10, 2 );
534
- }
535
-
536
- // Hide admin posts
537
- if(!empty($plugin_options_posts['hide_admin_posts']) && $plugin_options_posts['hide_admin_posts'] != '') {
538
-
539
- function wp_edit_hide_admin_posts( $query ) {
540
- if( !is_admin() ) return $query;
541
- global $pagenow;
542
- $options_hide_posts = get_option('wp_edit_posts');
543
- $jwl_hide_posts = $options_hide_posts['hide_admin_posts'];
544
- $jwl_hide_posts_array = explode(",",$jwl_hide_posts);
545
-
546
- if( 'edit.php' == $pagenow && ( get_query_var('post_type') && 'post' == get_query_var('post_type') ) )
547
- $query->set( 'post__not_in', $jwl_hide_posts_array ); // page id
548
- return $query;
549
- }
550
- add_action( 'pre_get_posts' ,'wp_edit_hide_admin_posts' );
551
- }
552
-
553
- // Hide admin pages
554
- if(!empty($plugin_options_posts['hide_admin_pages']) && $plugin_options_posts['hide_admin_pages'] != '') {
555
-
556
- function wp_edit_hide_admin_pages( $query ) {
557
- if( !is_admin() ) return $query;
558
- global $pagenow;
559
- $options_hide_pages = get_option('wp_edit_posts');
560
- $jwl_hide_pages = $options_hide_pages['hide_admin_pages'];
561
- $jwl_hide_pages_array = explode(",",$jwl_hide_pages);
562
-
563
- if( 'edit.php' == $pagenow && ( get_query_var('post_type') && 'page' == get_query_var('post_type') ) )
564
- $query->set( 'post__not_in', $jwl_hide_pages_array ); // page id
565
- return $query;
566
- }
567
- add_action( 'pre_get_posts' ,'wp_edit_hide_admin_pages' );
568
- }
569
-
570
- /*
571
- ****************************************************************
572
- Extras Functions
573
- ****************************************************************
574
- */
575
- $plugin_options_extras = get_option('wp_edit_extras');
576
-
577
- // Signoff text
578
- if(isset($plugin_options_extras['signoff_text']) && $plugin_options_extras['signoff_text'] != '') {
579
-
580
- function wp_edit_sign_off_text() {
581
-
582
- $options = get_option('wp_edit_extras');
583
- $jwl_signoff = isset($options['signoff_text']) ? $options['signoff_text'] : 'Please enter text here...';
584
-
585
- return $jwl_signoff;
586
- }
587
- add_shortcode('signoff', 'wp_edit_sign_off_text');
588
- }
589
-
590
-
591
- /*
592
- ****************************************************************
593
- User Specific Functions
594
- ****************************************************************
595
- */
596
- function wp_edit_user_specific_init() {
597
-
598
- global $current_user;
599
- $opts_user_meta = get_user_meta($current_user->ID, 'aaa_wp_edit_user_meta', true);
600
-
601
- // Add ID Column
602
- if(isset($opts_user_meta['id_column']) && $opts_user_meta['id_column'] === '1') {
603
-
604
- function wp_edit_column_id($defaults){
605
- $defaults['wps_post_id'] = __('ID');
606
- return $defaults;
607
- }
608
- add_filter('manage_posts_columns', 'wp_edit_column_id', 5);
609
- add_filter('manage_pages_columns', 'wp_edit_column_id', 5);
610
- function wp_edit_custom_column_id($column_name, $id){
611
- if($column_name === 'wps_post_id'){
612
- echo $id;
613
- }
614
- }
615
- add_action('manage_posts_custom_column', 'wp_edit_custom_column_id', 5, 2);
616
- add_action('manage_pages_custom_column', 'wp_edit_custom_column_id', 5, 2);
617
- }
618
-
619
- // Add Tumbnail Column
620
- if(isset($opts_user_meta['thumbnail_column']) && $opts_user_meta['thumbnail_column'] === '1') {
621
-
622
- if ( !function_exists('wp_edit_AddThumbColumn') && function_exists('add_theme_support') ) {
623
-
624
-
625
- // First, check if current theme support post thumbnails
626
- function wpep_check_post_thumbnails() {
627
-
628
- // If current theme does not support post thumbnails
629
- if(!current_theme_supports('post-thumbnails')) {
630
-
631
- // Add post thumbnail support
632
- add_theme_support('post-thumbnails', array( 'post', 'page' ) );
633
- }
634
- }
635
- add_action('after_theme_setup', 'wpep_check_post_thumbnails');
636
-
637
- function wp_edit_AddThumbColumn($cols) {
638
-
639
- $cols['thumbnail'] = __('Thumbnail', 'wp-edit');
640
- return $cols;
641
- }
642
-
643
- function wp_edit_AddThumbValue($column_name, $post_id) {
644
-
645
- if ( 'thumbnail' == $column_name ) {
646
-
647
- $thumb = get_the_post_thumbnail($post_id, array(100,70));
648
-
649
- if ( isset($thumb) && $thumb ) { echo $thumb; }
650
- else { echo __('None','wp-edit'); }
651
- }
652
- }
653
-
654
- // for posts
655
- add_filter( 'manage_posts_columns', 'wp_edit_AddThumbColumn' );
656
- add_action( 'manage_posts_custom_column', 'wp_edit_AddThumbValue', 10, 2 );
657
-
658
- // for pages
659
- add_filter( 'manage_pages_columns', 'wp_edit_AddThumbColumn' );
660
- add_action( 'manage_pages_custom_column', 'wp_edit_AddThumbValue', 10, 2 );
661
- }
662
- }
663
-
664
- // Hide Text Tab
665
- if(isset($opts_user_meta['hide_text_tab']) && $opts_user_meta['hide_text_tab'] === '1') {
666
-
667
- global $pagenow;
668
- if ($pagenow=='post.php' || $pagenow == 'post-new.php' || ($pagenow == "admin.php" && (isset($_GET['page'])) == 'cleverness-to-do-list') || ($pagenow == "options-general.php" && (isset($_GET['page'])) == 'ultimate-tinymce')) {
669
- function wp_edit_user_hide_on_todo() {
670
- ?><style type="text/css"> #excerpt-html { display: none !important; } #content-id-html { display: none !important; } #content-html { display: none !important; } #clevernesstododescription-html { display: none !important; }</style><?php
671
- }
672
- add_filter('admin_head','wp_edit_user_hide_on_todo');
673
- }
674
- }
675
-
676
- // Default Visual Tab
677
- if(isset($opts_user_meta['default_visual_tab']) && $opts_user_meta['default_visual_tab'] === '1') {
678
-
679
- add_filter( 'wp_default_editor', create_function('', 'return "tmce";') );
680
- }
681
-
682
- // Disable Dashboard Widget
683
- if(isset($opts_user_meta['dashboard_widget']) && $opts_user_meta['dashboard_widget'] != '1') {
684
-
685
- add_action('wp_dashboard_setup', 'wp_edit_user_custom_dashboard_widgets');
686
- function wp_edit_user_custom_dashboard_widgets() {
687
- global $wp_meta_boxes;
688
- wp_add_dashboard_widget('jwl_user_tinymce_dashboard_widget', __('WP Edit Pro RSS Feed', 'wp-edit'), 'wp_edit_user_tinymce_widget', 'wp_edit_user_configure_widget');
689
- }
690
- function wp_edit_user_tinymce_widget() {
691
- $jwl_widgets = get_option( 'wp_edit_user_dashboard_options' ); // Get the dashboard widget options
692
- $jwl_widget_id = 'jwl_user_tinymce_dashboard_widget'; // This must be the same ID we set in wp_add_dashboard_widget
693
- /* Check whether we have set the post count through the controls. If we didn't, set the default to 5 */
694
- $jwl_total_items = isset( $jwl_widgets[$jwl_widget_id] ) && isset( $jwl_widgets[$jwl_widget_id]['items'] ) ? absint( $jwl_widgets[$jwl_widget_id]['items'] ) : 5;
695
- // Echo the output of the RSS Feed.
696
- echo '<p><a href="http://www.feedblitz.com/f/?Sub=950320"><img title="Subscribe to get updates by email and more!" border="0" src="http://assets.feedblitz.com/chicklets/email/i/25/950320.bmp"></a><br />News updates for WP Edit Pro and Stable versions.</p>';
697
- echo '<p style="border-bottom:#000 1px solid;">Showing ('.$jwl_total_items.') Posts</p>';
698
- echo '<div class="rss-widget">';
699
- wp_widget_rss_output(array(
700
- 'url' => 'http://feeds.feedblitz.com/wpeditpro&x=1',
701
- 'title' => '',
702
- 'items' => $jwl_total_items,
703
- 'show_author' => 0,
704
- 'show_date' => 1
705
- ));
706
- echo "</div>";
707
- echo '<p style="text-align:center;border-top: #000 1px solid;padding:5px;"><a target="_blank" href="https://wpeditpro.com/">WP Edit Pro</a> - Visual Wordpress Editor</p>';
708
- }
709
- function wp_edit_user_configure_widget() {
710
- $jwl_widget_id = 'jwl_user_tinymce_dashboard_widget'; // This must be the same ID we set in wp_add_dashboard_widget
711
- $jwl_form_id = 'jwl-user-dashboard-control'; // Set this to whatever you want
712
- // Checks whether there are already dashboard widget options in the database
713
- if ( !$jwl_widget_options = get_option( 'wp_edit_user_dashboard_options' ) ) {
714
- $jwl_widget_options = array(); // If not, we create a new array
715
- }
716
- // Check whether we have information for this form
717
- if ( !isset($jwl_widget_options[$jwl_widget_id]) ) {
718
- $jwl_widget_options[$jwl_widget_id] = array(); // If not, we create a new array
719
- }
720
- // Check whether our form was just submitted
721
- if ( 'POST' == $_SERVER['REQUEST_METHOD'] && isset($_POST[$jwl_form_id]) ) {
722
- /* Get the value. In this case ['items'] is from the input field with the name of '.$form_id.'[items] */
723
- $jwl_number = absint( $_POST[$jwl_form_id]['items'] );
724
- $jwl_widget_options[$jwl_widget_id]['items'] = $jwl_number; // Set the number of items
725
- update_option( 'wp_edit_user_dashboard_options', $jwl_widget_options ); // Update our dashboard widget options so we can access later
726
- }
727
- // Check if we have set the number of posts previously. If we didn't, then we just set it as empty. This value is used when we create the input field
728
- $jwl_number = isset( $jwl_widget_options[$jwl_widget_id]['items'] ) ? (int) $jwl_widget_options[$jwl_widget_id]['items'] : '';
729
- // Create our form fields. Pay very close attention to the name part of the input field.
730
- echo '<p><label for="jwl_user_tinymce_dashboard_widget-number">' . __('Number of posts to show:', 'wp-edit') . '</label>';
731
- echo '<input id="jwl_user_tinymce_dashboard_widget-number" name="'.$jwl_form_id.'[items]" type="text" value="' . $jwl_number . '" size="3" /></p>';
732
- }
733
- }
734
-
735
- // Enable Post/Page Highlights
736
- if(isset($opts_user_meta['enable_highlights']) && $opts_user_meta['enable_highlights'] === '1') {
737
-
738
- function wp_edit_highlight_posts_status_colors(){
739
-
740
- global $current_user;
741
- $opts_user_meta = get_user_meta($current_user->ID, 'aaa_wp_edit_user_meta', true);
742
- ?>
743
- <style type="text/css">
744
- .status-draft{background-color: <?php (isset($opts_user_meta['draft_highlight']) ? print $opts_user_meta['draft_highlight'] : print '#FFFFFF'); ?> !important;}
745
- .status-pending{background-color: <?php (isset($opts_user_meta['pending_highlight']) ? print $opts_user_meta['pending_highlight'] : print '#FFFFFF'); ?> !important;}
746
- .status-publish{background-color: <?php (isset($opts_user_meta['published_highlight']) ? print $opts_user_meta['published_highlight'] : print '#FFFFFF'); ?> !important;}
747
- .status-future{background-color: <?php (isset($opts_user_meta['future_highlight']) ? print $opts_user_meta['future_highlight'] : print '#FFFFFF'); ?> !important;}
748
- .status-private{background-color: <?php (isset($opts_user_meta['private_highlight']) ? print $opts_user_meta['private_highlight'] : print '#FFFFFF'); ?> !important;}
749
- </style>
750
- <?php
751
- }
752
- add_action('admin_head','wp_edit_highlight_posts_status_colors');
753
- }
754
-
755
- }
756
- add_action('init', 'wp_edit_user_specific_init');
757
-
 
 
 
 
 
 
 
 
 
 
 
 
 
758
  ?>
1
+ <?php
2
+
3
+ /*
4
+ ****************************************************************
5
+ Global Functions
6
+ ****************************************************************
7
+ */
8
+ $plugin_options_global = get_option('wp_edit_global');
9
+
10
+ // Disable admin bar links
11
+ if($plugin_options_global['disable_admin_links'] != 1) {
12
+
13
+ function wp_edit_admin_bar_init() {
14
+
15
+ // Is the user sufficiently leveled, or has the bar been disabled?
16
+ if (!is_admin() || !is_admin_bar_showing() ) {
17
+ return;
18
+ }
19
+ // Good to go, lets do this!
20
+ add_action('admin_bar_menu', 'wp_edit_admin_bar_links', 500);
21
+ }
22
+ add_action('admin_bar_init', 'wp_edit_admin_bar_init');
23
+
24
+ function wp_edit_admin_bar_links() {
25
+
26
+ global $wp_admin_bar;
27
+ $path = admin_url();
28
+ $wp_admin_bar->add_menu( array(
29
+ 'title' => __('WP Edit','wp-edit'),
30
+ 'id' => 'jwl_links',
31
+ 'href' => $path . 'admin.php?page=wp_edit_options&tab=buttons'
32
+ ));
33
+ /** * Add the submenu links. */
34
+ $wp_admin_bar->add_menu( array(
35
+ 'id' => 'jwl_admin_buttons',
36
+ 'parent' => 'jwl_links',
37
+ 'title' => __('Buttons','wp-edit'),
38
+ 'href' => $path.'admin.php?page=wp_edit_options&tab=buttons',
39
+ 'meta' => array(
40
+ 'title' => __('Buttons','wp-edit')
41
+ ),
42
+ ));
43
+ $wp_admin_bar->add_menu( array(
44
+ 'id' => 'jwl_admin_global',
45
+ 'parent' => 'jwl_links',
46
+ 'title' => __('Global','wp-edit'),
47
+ 'href' => $path.'admin.php?page=wp_edit_options&tab=global',
48
+ 'meta' => array(
49
+ 'title' => __('Global','wp-edit')
50
+ ),
51
+ ));
52
+ $wp_admin_bar->add_menu( array(
53
+ 'id' => 'jwl_admin_general',
54
+ 'parent' => 'jwl_links',
55
+ 'title' => __('General','wp-edit'),
56
+ 'href' => $path.'admin.php?page=wp_edit_options&tab=general',
57
+ 'meta' => array(
58
+ 'title' => __('General','wp-edit')
59
+ ),
60
+ ));
61
+ $wp_admin_bar->add_menu( array(
62
+ 'id' => 'jwl_admin_posts',
63
+ 'parent' => 'jwl_links',
64
+ 'title' => __('Posts/Pages','wp-edit'),
65
+ 'href' => $path.'admin.php?page=wp_edit_options&tab=posts',
66
+ 'meta' => array(
67
+ 'title' => __('Posts/Pages','wp-edit')
68
+ ),
69
+ ));
70
+ $wp_admin_bar->add_menu( array(
71
+ 'id' => 'jwl_admin_editor',
72
+ 'parent' => 'jwl_links',
73
+ 'title' => __('Editor','wp-edit'),
74
+ 'href' => $path.'admin.php?page=wp_edit_options&tab=editor',
75
+ 'meta' => array(
76
+ 'title' => __('Editor','wp-edit')
77
+ ),
78
+ ));
79
+ $wp_admin_bar->add_menu( array(
80
+ 'id' => 'jwl_admin_extras',
81
+ 'parent' => 'jwl_links',
82
+ 'title' => __('Extras','wp-edit'),
83
+ 'href' => $path.'admin.php?page=wp_edit_options&tab=extras',
84
+ 'meta' => array(
85
+ 'title' => __('Extras','wp-edit')
86
+ ),
87
+ ));
88
+ $wp_admin_bar->add_menu( array(
89
+ 'id' => 'jwl_admin_user_specific',
90
+ 'parent' => 'jwl_links',
91
+ 'title' => __('User Specific','wp-edit'),
92
+ 'href' => $path.'admin.php?page=wp_edit_options&tab=user_specific',
93
+ 'meta' => array(
94
+ 'title' => __('User Specific','wp-edit')
95
+ ),
96
+ ));
97
+ $wp_admin_bar->add_menu( array(
98
+ 'id' => 'jwl_admin_database',
99
+ 'parent' => 'jwl_links',
100
+ 'title' => __('Database','wp-edit'),
101
+ 'href' => $path.'admin.php?page=wp_edit_options&tab=database',
102
+ 'meta' => array(
103
+ 'title' => __('Database','wp-edit')
104
+ ),
105
+ ));
106
+ $wp_admin_bar->add_menu( array(
107
+ 'id' => 'jwl_admin_about',
108
+ 'parent' => 'jwl_links',
109
+ 'title' => __('About','wp-edit'),
110
+ 'href' => $path.'admin.php?page=wp_edit_options&tab=about',
111
+ 'meta' => array(
112
+ 'title' => __('About','wp-edit')
113
+ ),
114
+ ));
115
+ }
116
+ }
117
+
118
+ /*
119
+ ****************************************************************
120
+ General Functions
121
+ ****************************************************************
122
+ */
123
+ $plugin_options_general = get_option('wp_edit_general');
124
+
125
+ // Enable LineBreak Shortcode
126
+ if($plugin_options_general['linebreak_shortcode'] == 1) {
127
+
128
+ function wp_edit_insert_linebreak($atts){
129
+ return '<br clear="none" />';
130
+ }
131
+ add_shortcode( 'break', 'wp_edit_insert_linebreak' );
132
+ }
133
+
134
+ // Enable Shortcodes in Widgets
135
+ if($plugin_options_general['shortcodes_in_widgets'] == 1) {
136
+
137
+ add_filter( 'widget_text', 'do_shortcode');
138
+ }
139
+
140
+ // Enable Shortcodes in Excerpts
141
+ if($plugin_options_general['shortcodes_in_excerpts'] == 1) {
142
+
143
+ add_filter( 'the_excerpt', 'do_shortcode');
144
+ }
145
+
146
+ // Add Editor to Post Excerpts
147
+ if($plugin_options_general['post_excerpt_editor'] == 1) {
148
+
149
+ function wp_edit_change_post_excerpt() {
150
+ remove_meta_box('postexcerpt', 'post', 'normal');
151
+ add_meta_box('postexcerpt', __('WP Edit Excerpt', 'wp-edit'), 'wp_edit_post_excerpt_meta_box', 'post', 'normal');
152
+ }
153
+ add_action( 'admin_init', 'wp_edit_change_post_excerpt' );
154
+
155
+ function wp_edit_post_excerpt_meta_box() {
156
+ global $wpdb,$post;
157
+ $tinymce_summary = $wpdb->get_row("SELECT post_excerpt FROM $wpdb->posts WHERE id = '$post->ID'");
158
+ $post_tinymce_excerpt = $tinymce_summary->post_excerpt;
159
+
160
+ $id = 'excerpt';
161
+ $settings = array(
162
+ 'quicktags' => array('buttons' => 'em,strong,link',),
163
+ 'text_area_name'=> 'excerpt',
164
+ 'quicktags' => true,
165
+ 'tinymce' => true,
166
+ 'editor_css' => '<style>#wp-excerpt-editor-container .wp-editor-area{height:250px; width:100%;}</style>'
167
+ );
168
+ wp_editor($post_tinymce_excerpt,$id,$settings);
169
+ }
170
+ }
171
+
172
+ // Add Editor to Page Excerpts
173
+ if($plugin_options_general['page_excerpt_editor'] == 1) {
174
+
175
+ add_action('init', 'wp_edit_page_excerpts_init');
176
+ function wp_edit_page_excerpts_init() {
177
+ add_post_type_support('page', array('excerpt'));
178
+ }
179
+
180
+ add_action( 'admin_init', 'wp_edit_change_page_excerpt' );
181
+ function wp_edit_change_page_excerpt() {
182
+ remove_meta_box('postexcerpt', 'page', 'normal');
183
+ add_meta_box('postexcerpt', __('Wp Edit Excerpt', 'wp-edit'), 'wp_edit_page_excerpt_meta_box', 'page', 'normal');
184
+ }
185
+
186
+ function wp_edit_page_excerpt_meta_box() {
187
+ global $wpdb,$post;
188
+ $tinymce_summary_page = $wpdb->get_row("SELECT post_excerpt FROM $wpdb->posts WHERE id = '$post->ID'");
189
+ $post_tinymce_excerpt_page = $tinymce_summary_page->post_excerpt;
190
+
191
+ $id = 'excerpt';
192
+ $settings = array(
193
+ 'quicktags' => array('buttons' => 'em,strong,link',),
194
+ 'text_area_name'=> 'excerpt',
195
+ 'quicktags' => true,
196
+ 'tinymce' => true,
197
+ 'editor_css' => '<style>#wp-excerpt-editor-container .wp-editor-area{height:250px; width:100%;}</style>'
198
+ );
199
+ wp_editor($post_tinymce_excerpt_page,$id,$settings);
200
+ }
201
+ }
202
+
203
+ // Extend editor to profile biography
204
+ if($plugin_options_general['profile_editor'] == 1) {
205
+
206
+ function wp_edit_visual_editor($user) {
207
+
208
+ // Contributor level user or higher required
209
+ if ( !current_user_can('edit_posts') )
210
+ return;
211
+ ?>
212
+ <table class="form-table">
213
+ <tr id="wp_edit_biographical_editor" class="user-description-wrap">
214
+ <th><label for="description"><?php _e('Biographical Info', 'wp-edit'); ?></label></th>
215
+ <td>
216
+ <?php
217
+ $description = get_user_meta( $user->ID, 'description', true);
218
+ $args = array('textarea_rows' => 5);
219
+ wp_editor( $description, 'description', $args );
220
+ ?>
221
+ <p class="description"><?php _e('Share a little biographical information to fill out your profile. This may be shown publicly.', 'wp-edit'); ?></p>
222
+ </td>
223
+ </tr>
224
+ </table>
225
+ <?php
226
+ }
227
+ add_action('show_user_profile','wp_edit_visual_editor');
228
+ add_action('edit_user_profile','wp_edit_visual_editor');
229
+
230
+ function wp_edit_editor_biography_js($hook) {
231
+
232
+ global $current_screen;
233
+ if($current_screen->id === 'profile' || $current_screen->id === 'edit-profile') {
234
+
235
+ ?>
236
+ <script type="text/javascript">
237
+
238
+ jQuery(document).ready(function($) {
239
+
240
+ // Remove the textarea before displaying visual editor
241
+ $('.user-description-wrap').first().replaceWith($('#wp_edit_biographical_editor'));
242
+ // Expand text editor width
243
+ $('.wp-editor-area').css('width', '100%');
244
+ });
245
+ </script>
246
+ <?php
247
+ }
248
+ }
249
+ add_action( 'admin_head', 'wp_edit_editor_biography_js', 10, 1 );
250
+ }
251
+
252
+ /*
253
+ ****************************************************************
254
+ Posts/Pages Functions
255
+ ****************************************************************
256
+ */
257
+ $plugin_options_posts = get_option('wp_edit_posts');
258
+
259
+ // Post title field
260
+ if(isset($plugin_options_posts['post_title_field']) && $plugin_options_posts['post_title_field'] != 'Enter title here') {
261
+
262
+ function wp_edit_title_text_input( $title ){
263
+
264
+ $plugin_options_posts = get_option('wp_edit_posts');
265
+ $title = $plugin_options_posts['post_title_field'];
266
+ return $title;
267
+ }
268
+ add_filter( 'enter_title_here', 'wp_edit_title_text_input' );
269
+ }
270
+
271
+ // Column Shortcodes
272
+ if($plugin_options_posts['column_shortcodes'] == 1) {
273
+
274
+ function wp_edit_one_third( $atts, $content = null ) { return '<div class="jwl_one_third">' . do_shortcode($content) . '</div>'; }
275
+ add_shortcode('one_third', 'wp_edit_one_third');
276
+ function wp_edit_one_third_last( $atts, $content = null ) { return '<div class="jwl_one_third last">' . do_shortcode($content) . '</div><div class="clearboth"></div>'; }
277
+ add_shortcode('one_third_last', 'wp_edit_one_third_last');
278
+ function wp_edit_two_third( $atts, $content = null ) { return '<div class="jwl_two_third">' . do_shortcode($content) . '</div>'; }
279
+ add_shortcode('two_third', 'wp_edit_two_third');
280
+ function wp_edit_two_third_last( $atts, $content = null ) { return '<div class="jwl_two_third last">' . do_shortcode($content) . '</div><div class="clearboth"></div>'; }
281
+ add_shortcode('two_third_last', 'wp_edit_two_third_last');
282
+ function wp_edit_one_half( $atts, $content = null ) { return '<div class="jwl_one_half">' . do_shortcode($content) . '</div>'; }
283
+ add_shortcode('one_half', 'wp_edit_one_half');
284
+ function wp_edit_one_half_last( $atts, $content = null ) { return '<div class="jwl_one_half last">' . do_shortcode($content) . '</div><div class="clearboth"></div>'; }
285
+ add_shortcode('one_half_last', 'wp_edit_one_half_last');
286
+ function wp_edit_one_fourth( $atts, $content = null ) { return '<div class="jwl_one_fourth">' . do_shortcode($content) . '</div>'; }
287
+ add_shortcode('one_fourth', 'wp_edit_one_fourth');
288
+ function wp_edit_one_fourth_last( $atts, $content = null ) { return '<div class="jwl_one_fourth last">' . do_shortcode($content) . '</div><div class="clearboth"></div>'; }
289
+ add_shortcode('one_fourth_last', 'wp_edit_one_fourth_last');
290
+ function wp_edit_three_fourth( $atts, $content = null ) { return '<div class="jwl_three_fourth">' . do_shortcode($content) . '</div>'; }
291
+ add_shortcode('three_fourth', 'wp_edit_three_fourth');
292
+ function wp_edit_three_fourth_last( $atts, $content = null ) { return '<div class="jwl_three_fourth last">' . do_shortcode($content) . '</div><div class="clearboth"></div>'; }
293
+ add_shortcode('three_fourth_last', 'wp_edit_three_fourth_last');
294
+ function wp_edit_one_fifth( $atts, $content = null ) { return '<div class="jwl_one_fifth">' . do_shortcode($content) . '</div>'; }
295
+ add_shortcode('one_fifth', 'wp_edit_one_fifth');
296
+ function wp_edit_one_fifth_last( $atts, $content = null ) { return '<div class="jwl_one_fifth last">' . do_shortcode($content) . '</div><div class="clearboth"></div>'; }
297
+ add_shortcode('one_fifth_last', 'wp_edit_one_fifth_last');
298
+ function wp_edit_two_fifth( $atts, $content = null ) { return '<div class="jwl_two_fifth">' . do_shortcode($content) . '</div>'; }
299
+ add_shortcode('two_fifth', 'wp_edit_two_fifth');
300
+ function wp_edit_two_fifth_last( $atts, $content = null ) { return '<div class="jwl_two_fifth last">' . do_shortcode($content) . '</div><div class="clearboth"></div>'; }
301
+ add_shortcode('two_fifth_last', 'wp_edit_two_fifth_last');
302
+ function wp_edit_three_fifth( $atts, $content = null ) { return '<div class="jwl_three_fifth">' . do_shortcode($content) . '</div>'; }
303
+ add_shortcode('three_fifth', 'wp_edit_three_fifth');
304
+ function wp_edit_three_fifth_last( $atts, $content = null ) { return '<div class="jwl_three_fifth last">' . do_shortcode($content) . '</div><div class="clearboth"></div>'; }
305
+ add_shortcode('three_fifth_last', 'wp_edit_three_fifth_last');
306
+ function wp_edit_four_fifth( $atts, $content = null ) { return '<div class="jwl_four_fifth">' . do_shortcode($content) . '</div>'; }
307
+ add_shortcode('four_fifth', 'wp_edit_four_fifth');
308
+ function wp_edit_four_fifth_last( $atts, $content = null ) { return '<div class="jwl_four_fifth last">' . do_shortcode($content) . '</div><div class="clearboth"></div>'; }
309
+ add_shortcode('four_fifth_last', 'wp_edit_four_fifth_last');
310
+ function wp_edit_one_sixth( $atts, $content = null ) { return '<div class="jwl_one_sixth">' . do_shortcode($content) . '</div>'; }
311
+ add_shortcode('one_sixth', 'wp_edit_one_sixth');
312
+ function wp_edit_one_sixth_last( $atts, $content = null ) { return '<div class="jwl_one_sixth last">' . do_shortcode($content) . '</div><div class="clearboth"></div>'; }
313
+ add_shortcode('one_sixth_last', 'wp_edit_one_sixth_last');
314
+ function wp_edit_five_sixth( $atts, $content = null ) { return '<div class="jwl_five_sixth">' . do_shortcode($content) . '</div>'; }
315
+ add_shortcode('five_sixth', 'wp_edit_five_sixth');
316
+ function wp_edit_five_sixth_last( $atts, $content = null ) { return '<div class="jwl_five_sixth last">' . do_shortcode($content) . '</div><div class="clearboth"></div>'; }
317
+ add_shortcode('five_sixth_last', 'wp_edit_five_sixth_last');
318
+
319
+ function wp_edit_column_stylesheet() {
320
+
321
+ wp_register_style('wp_edit_column-styles', plugins_url().'/wp-edit/css/column-style.css');
322
+ wp_enqueue_style('wp_edit_column-styles');
323
+ }
324
+ add_action('wp_print_styles', 'wp_edit_column_stylesheet');
325
+ }
326
+
327
+ // Disable wpautop
328
+ if(!empty($plugin_options_posts['disable_wpautop']) && $plugin_options_posts['disable_wpautop'] == '1') {
329
+
330
+ if ( ! class_exists( 'JWL_Toggle_wpautop' ) ) {
331
+
332
+ /*** JWL_Toggle_wpautop class. */
333
+ class JWL_Toggle_wpautop {
334
+
335
+ /*** Add our hooks and filters */
336
+ function __construct() {
337
+
338
+ add_action( 'admin_init', array( $this, 'activation' ) );
339
+ add_action( 'admin_init', array( $this, 'admin_init' ) );
340
+ add_action( 'add_meta_boxes', array( $this, 'add_meta_boxes' ) );
341
+ add_action( 'save_post', array( $this, 'save_post' ) );
342
+ add_action( 'the_post', array( $this, 'the_post' ) );
343
+ add_action( 'loop_end', array( $this, 'loop_end' ) );
344
+
345
+ add_filter( 'post_class', array( $this, 'post_class' ), 10, 3 );
346
+ }
347
+
348
+ /*** By default, add the ability to disable wpautop on all registered post types */
349
+ function activation() {
350
+
351
+ if ( $settings = get_option( 'jwl_toggle_wpautop_settings' ))
352
+ return;
353
+
354
+ $post_types = get_post_types();
355
+
356
+ if ( empty( $post_types ) )
357
+ return;
358
+
359
+ $default_post_types = array();
360
+
361
+ foreach ( $post_types as $post_type ) {
362
+ $pt = get_post_type_object( $post_type );
363
+
364
+ if ( in_array( $post_type, array( 'revision', 'nav_menu_item', 'attachment' ) ) || ! $pt->public )
365
+ continue;
366
+
367
+ $default_post_types[] = $post_type;
368
+ }
369
+
370
+ if ( ! empty( $default_post_types ) )
371
+ add_option( 'jwl_toggle_wpautop_settings', $default_post_types );
372
+ }
373
+
374
+ /*** Add our settings fields to the writing page */
375
+ function admin_init() {
376
+
377
+ register_setting( 'jwl_toggle_wpautop_settings', 'jwl_toggle_wpautop_settings', array( $this, 'sanitize_settings' ) );
378
+
379
+ //add a section for the plugin's settings on the writing page
380
+ add_settings_section( 'jwl_toggle_wpautop_settings_section', __('Toggle wpautop', 'wp-edit'), array( $this, 'settings_section_text' ), 'writing' );
381
+
382
+ //For each post type add a settings field, excluding revisions and nav menu items
383
+ if ( $post_types = get_post_types() ) {
384
+ foreach ( $post_types as $post_type ) {
385
+ $pt = get_post_type_object( $post_type );
386
+
387
+ if ( in_array( $post_type, array( 'revision', 'nav_menu_item', 'attachment' ) ) || ! $pt->public )
388
+ continue;
389
+
390
+ add_settings_field( 'jwl_toggle_wpautop_post_types' . $post_type, $pt->labels->name, array( $this,'toggle_wpautop_field' ), 'writing', 'jwl_toggle_wpautop_settings_section', array( 'slug' => $pt->name, 'name' => $pt->labels->name ) );
391
+ }
392
+ }
393
+ }
394
+
395
+ /*** Display our settings section */
396
+ function settings_section_text() {
397
+ echo '<p>';
398
+ _e('Select which post types have the option to disable the wpautop filter.','wp-edit');
399
+ echo '</p>';
400
+ settings_fields( 'jwl_toggle_wpautop_settings' );
401
+ }
402
+
403
+ /*** Display the actual settings field */
404
+ function toggle_wpautop_field( $args ) {
405
+
406
+ $settings = get_option( 'jwl_toggle_wpautop_settings', array() );
407
+
408
+ if ( $post_types = get_post_types() ) { ?>
409
+ <input type="checkbox" name="jwl_toggle_wpautop_post_types[]" id="jwl_toggle_wpautop_post_types_<?php echo $args['slug']; ?>" value="<?php echo $args['slug']; ?>" <?php in_array( $args['slug'], $settings ) ? checked( true ) : checked( false ); ?>/>
410
+ <?php
411
+ }
412
+ }
413
+
414
+ /*** Sanitize our settings fields */
415
+ function sanitize_settings( $input ) {
416
+
417
+ $input = wp_parse_args( $_POST['jwl_toggle_wpautop_post_types'], array() );
418
+
419
+ $new_input = array();
420
+
421
+ foreach ( $input as $pt ) {
422
+ if ( post_type_exists( sanitize_text_field( $pt ) ) )
423
+ $new_input[] = sanitize_text_field( $pt );
424
+ }
425
+
426
+ return $new_input;
427
+ }
428
+
429
+ /*** Add meta boxes to the selected post types */
430
+ function add_meta_boxes( $post_type ) {
431
+
432
+ $settings = get_option( 'jwl_toggle_wpautop_settings', array() );
433
+
434
+ if ( empty( $settings ) )
435
+ return;
436
+
437
+ if ( in_array( $post_type, $settings ) )
438
+ add_action( 'post_submitbox_misc_actions', array( $this, 'post_submitbox_misc_actions' ), 5 );
439
+ }
440
+
441
+ /*** Display a checkbox to disable the wpautop filter */
442
+ function post_submitbox_misc_actions() {
443
+
444
+ global $post;
445
+
446
+ wp_nonce_field( '_jwl_wpautop_nonce', '_jwl_wpautop_noncename' );
447
+ ?>
448
+ <div class="misc-pub-section jwl-wpautop">
449
+ <span>Disable wpautop:</span> <input type="checkbox" name="_jwl_disable_wpautop" id="_jwl_disable_wpautop" <?php checked( get_post_meta( $post->ID, '_jwl_disable_wpautop', true ) ); ?> /> <span style="float:right; display: block;"><a href="http://codex.wordpress.org/Function_Reference/wpautop" target="_blank">?</a>
450
+ </div>
451
+ <?php
452
+ }
453
+
454
+ /*** Process the wpautop checkbox */
455
+ function save_post( $post_id ) {
456
+ //Skip revisions and autosaves
457
+ if ( wp_is_post_revision( $post_id ) || ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) || ( defined( 'DOING_AJAX' ) && DOING_AJAX ) )
458
+ return;
459
+
460
+ //Users should have the ability to edit listings.
461
+ if ( ! current_user_can( 'edit_post', $post_id ) )
462
+ return;
463
+
464
+ if ( isset( $_POST['_jwl_wpautop_noncename'] ) && wp_verify_nonce( $_POST['_jwl_wpautop_noncename'], '_jwl_wpautop_nonce' ) ) {
465
+
466
+ if ( isset( $_POST['_jwl_disable_wpautop'] ) && ! empty( $_POST['_jwl_disable_wpautop'] ) )
467
+ update_post_meta( $post_id, '_jwl_disable_wpautop', 1 );
468
+ else
469
+ delete_post_meta( $post_id, '_jwl_disable_wpautop' );
470
+ }
471
+ }
472
+
473
+ /*** Add or remove the wpautop filter */
474
+ function the_post( $post ) {
475
+ if ( get_post_meta( $post->ID, '_jwl_disable_wpautop', true ) ) {
476
+ remove_filter( 'the_content', 'wpautop' );
477
+ remove_filter( 'the_excerpt', 'wpautop' );
478
+ } else {
479
+ if ( ! has_filter( 'the_content', 'wpautop' ) )
480
+ add_filter( 'the_content', 'wpautop' );
481
+
482
+ if ( ! has_filter( 'the_excerpt', 'wpautop' ) )
483
+ add_filter( 'the_excerpt', 'wpautop' );
484
+ }
485
+ }
486
+
487
+ /*** loop_end function. * After we run our loop, everything should be set back to normal */
488
+ function loop_end() {
489
+ if ( ! has_filter( 'the_content', 'wpautop' ) )
490
+ add_filter( 'the_content', 'wpautop' );
491
+
492
+ if ( ! has_filter( 'the_excerpt', 'wpautop' ) )
493
+ add_filter( 'the_excerpt', 'wpautop' );
494
+ }
495
+
496
+ /*** Add a class to posts noting whether they were passed through the wpautop filter */
497
+ function post_class( $classes, $class, $post_id ) {
498
+ if ( get_post_meta( $post_id, '_jwl_disable_wpautop', true ) )
499
+ $classes[] = 'no-wpautop';
500
+ else
501
+ $classes[] = 'wpautop';
502
+
503
+ return $classes;
504
+ }
505
+ }
506
+ }
507
+ $jwl_toggle_wpautop = new JWL_Toggle_wpautop();
508
+ }
509
+
510
+ // Max post revisions
511
+ if(isset($plugin_options_posts['max_post_revisions']) && $plugin_options_posts['max_post_revisions'] != '') {
512
+
513
+ function wp_edit_max_post_revisions( $num, $post ) {
514
+ $options_post_revisions = get_option('wp_edit_posts');
515
+ if( 'post' == $post->post_type ) {
516
+ $num = $options_post_revisions['max_post_revisions'];
517
+ }
518
+ return $num;
519
+ }
520
+ add_filter( 'wp_revisions_to_keep', 'wp_edit_max_post_revisions', 10, 2 );
521
+ }
522
+
523
+ // Max page revisions
524
+ if(isset($plugin_options_posts['max_page_revisions']) && $plugin_options_posts['max_page_revisions'] != '') {
525
+
526
+ function wp_edit_max_page_revisions( $num, $post ) {
527
+ $options_post_revisions = get_option('wp_edit_posts');
528
+ if( 'page' == $post->post_type ) {
529
+ $num = $options_post_revisions['max_page_revisions'];
530
+ }
531
+ return $num;
532
+ }
533
+ add_filter( 'wp_revisions_to_keep', 'wp_edit_max_page_revisions', 10, 2 );
534
+ }
535
+
536
+ // Hide admin posts
537
+ if(!empty($plugin_options_posts['hide_admin_posts']) && $plugin_options_posts['hide_admin_posts'] != '') {
538
+
539
+ function wp_edit_hide_admin_posts( $query ) {
540
+ if( !is_admin() ) return $query;
541
+ global $pagenow;
542
+ $options_hide_posts = get_option('wp_edit_posts');
543
+ $jwl_hide_posts = $options_hide_posts['hide_admin_posts'];
544
+ $jwl_hide_posts_array = explode(",",$jwl_hide_posts);
545
+
546
+ if( 'edit.php' == $pagenow && ( get_query_var('post_type') && 'post' == get_query_var('post_type') ) )
547
+ $query->set( 'post__not_in', $jwl_hide_posts_array ); // page id
548
+ return $query;
549
+ }
550
+ add_action( 'pre_get_posts' ,'wp_edit_hide_admin_posts' );
551
+ }
552
+
553
+ // Hide admin pages
554
+ if(!empty($plugin_options_posts['hide_admin_pages']) && $plugin_options_posts['hide_admin_pages'] != '') {
555
+
556
+ function wp_edit_hide_admin_pages( $query ) {
557
+ if( !is_admin() ) return $query;
558
+ global $pagenow;
559
+ $options_hide_pages = get_option('wp_edit_posts');
560
+ $jwl_hide_pages = $options_hide_pages['hide_admin_pages'];
561
+ $jwl_hide_pages_array = explode(",",$jwl_hide_pages);
562
+
563
+ if( 'edit.php' == $pagenow && ( get_query_var('post_type') && 'page' == get_query_var('post_type') ) )
564
+ $query->set( 'post__not_in', $jwl_hide_pages_array ); // page id
565
+ return $query;
566
+ }
567
+ add_action( 'pre_get_posts' ,'wp_edit_hide_admin_pages' );
568
+ }
569
+
570
+ /*
571
+ ****************************************************************
572
+ Extras Functions
573
+ ****************************************************************
574
+ */
575
+ $plugin_options_extras = get_option('wp_edit_extras');
576
+
577
+ // Signoff text
578
+ if(isset($plugin_options_extras['signoff_text']) && $plugin_options_extras['signoff_text'] != '') {
579
+
580
+ function wp_edit_sign_off_text() {
581
+
582
+ $options = get_option('wp_edit_extras');
583
+ $jwl_signoff = isset($options['signoff_text']) ? $options['signoff_text'] : 'Please enter text here...';
584
+
585
+ return $jwl_signoff;
586
+ }
587
+ add_shortcode('signoff', 'wp_edit_sign_off_text');
588
+ }
589
+
590
+
591
+ /*
592
+ ****************************************************************
593
+ User Specific Functions
594
+ ****************************************************************
595
+ */
596
+ function wp_edit_user_specific_init() {
597
+
598
+ global $current_user;
599
+ $opts_user_meta = get_user_meta($current_user->ID, 'aaa_wp_edit_user_meta', true);
600
+
601
+ // Add ID Column
602
+ if(isset($opts_user_meta['id_column']) && $opts_user_meta['id_column'] === '1') {
603
+
604
+ function wp_edit_column_id($defaults){
605
+ $defaults['wps_post_id'] = __('ID');
606
+ return $defaults;
607
+ }
608
+ add_filter('manage_posts_columns', 'wp_edit_column_id', 5);
609
+ add_filter('manage_pages_columns', 'wp_edit_column_id', 5);
610
+ function wp_edit_custom_column_id($column_name, $id){
611
+ if($column_name === 'wps_post_id'){
612
+ echo $id;
613
+ }
614
+ }
615
+ add_action('manage_posts_custom_column', 'wp_edit_custom_column_id', 5, 2);
616
+ add_action('manage_pages_custom_column', 'wp_edit_custom_column_id', 5, 2);
617
+ }
618
+
619
+ // Add Tumbnail Column
620
+ if(isset($opts_user_meta['thumbnail_column']) && $opts_user_meta['thumbnail_column'] === '1') {
621
+
622
+ if ( !function_exists('wp_edit_AddThumbColumn') && function_exists('add_theme_support') ) {
623
+
624
+
625
+ // First, check if current theme support post thumbnails
626
+ function wpep_check_post_thumbnails() {
627
+
628
+ // If current theme does not support post thumbnails
629
+ if(!current_theme_supports('post-thumbnails')) {
630
+
631
+ // Add post thumbnail support
632
+ add_theme_support('post-thumbnails', array( 'post', 'page' ) );
633
+ }
634
+ }
635
+ add_action('after_theme_setup', 'wpep_check_post_thumbnails');
636
+
637
+ function wp_edit_AddThumbColumn($cols) {
638
+
639
+ $cols['thumbnail'] = __('Thumbnail', 'wp-edit');
640
+ return $cols;
641
+ }
642
+
643
+ function wp_edit_AddThumbValue($column_name, $post_id) {
644
+
645
+ if ( 'thumbnail' == $column_name ) {
646
+
647
+ $thumb = get_the_post_thumbnail($post_id, array(100,70));
648
+
649
+ if ( isset($thumb) && $thumb ) { echo $thumb; }
650
+ else { echo __('None','wp-edit'); }
651
+ }
652
+ }
653
+
654
+ // for posts
655
+ add_filter( 'manage_posts_columns', 'wp_edit_AddThumbColumn' );
656
+ add_action( 'manage_posts_custom_column', 'wp_edit_AddThumbValue', 10, 2 );
657
+
658
+ // for pages
659
+ add_filter( 'manage_pages_columns', 'wp_edit_AddThumbColumn' );
660
+ add_action( 'manage_pages_custom_column', 'wp_edit_AddThumbValue', 10, 2 );
661
+ }
662
+ }
663
+
664
+ // Hide Text Tab
665
+ if(isset($opts_user_meta['hide_text_tab']) && $opts_user_meta['hide_text_tab'] === '1') {
666
+
667
+ global $pagenow;
668
+ if ($pagenow=='post.php' || $pagenow == 'post-new.php' || ($pagenow == "admin.php" && (isset($_GET['page'])) == 'cleverness-to-do-list') || ($pagenow == "options-general.php" && (isset($_GET['page'])) == 'ultimate-tinymce')) {
669
+ function wp_edit_user_hide_on_todo() {
670
+ ?><style type="text/css"> #excerpt-html { display: none !important; } #content-id-html { display: none !important; } #content-html { display: none !important; } #clevernesstododescription-html { display: none !important; }</style><?php
671
+ }
672
+ add_filter('admin_head','wp_edit_user_hide_on_todo');
673
+ }
674
+ }
675
+
676
+ // Default Visual Tab
677
+ if(isset($opts_user_meta['default_visual_tab']) && $opts_user_meta['default_visual_tab'] === '1') {
678
+
679
+ add_filter( 'wp_default_editor', create_function('', 'return "tmce";') );
680
+ }
681
+
682
+ // Disable Dashboard Widget
683
+ if(isset($opts_user_meta['dashboard_widget']) && $opts_user_meta['dashboard_widget'] != '1') {
684
+
685
+ add_action('wp_dashboard_setup', 'wp_edit_user_custom_dashboard_widgets');
686
+ function wp_edit_user_custom_dashboard_widgets() {
687
+
688
+ global $wp_meta_boxes;
689
+ wp_add_dashboard_widget('jwl_user_tinymce_dashboard_widget', __('WP Edit Pro RSS Feed', 'wp-edit'), 'wp_edit_user_tinymce_widget', 'wp_edit_user_configure_widget');
690
+ }
691
+ function wp_edit_user_tinymce_widget() {
692
+
693
+ $jwl_widgets = get_option( 'wp_edit_user_dashboard_options' ); // Get the dashboard widget options
694
+ $jwl_widget_id = 'jwl_user_tinymce_dashboard_widget'; // This must be the same ID we set in wp_add_dashboard_widget
695
+
696
+ /* Check whether we have set the post count through the controls. If we didn't, set the default to 5 */
697
+ $jwl_total_items = isset( $jwl_widgets[$jwl_widget_id] ) && isset( $jwl_widgets[$jwl_widget_id]['items'] ) ? absint( $jwl_widgets[$jwl_widget_id]['items'] ) : 5;
698
+
699
+ $protocol = is_ssl() === true ? 'https:' : 'http:';
700
+
701
+ // Echo the output of the RSS Feed.
702
+ echo '<p><a href="//www.feedblitz.com/f/?Sub=950320"><img title="Subscribe to get updates by email and more!" border="0" src="//assets.feedblitz.com/chicklets/email/i/25/950320.bmp"></a><br />News updates for WP Edit Pro and Stable versions.</p>';
703
+ echo '<p style="border-bottom:#000 1px solid;">Showing ('.$jwl_total_items.') Posts</p>';
704
+ echo '<div class="rss-widget">';
705
+ wp_widget_rss_output(array(
706
+ 'url' => $protocol . '//feeds.feedblitz.com/wpeditpro&x=1',
707
+ 'title' => '',
708
+ 'items' => $jwl_total_items,
709
+ 'show_author' => 0,
710
+ 'show_date' => 1
711
+ ));
712
+ echo "</div>";
713
+ echo '<p style="text-align:center;border-top: #000 1px solid;padding:5px;"><a target="_blank" href="https://wpeditpro.com/">WP Edit Pro</a> - Visual Wordpress Editor</p>';
714
+ }
715
+ function wp_edit_user_configure_widget() {
716
+
717
+ $jwl_widget_id = 'jwl_user_tinymce_dashboard_widget'; // This must be the same ID we set in wp_add_dashboard_widget
718
+ $jwl_form_id = 'jwl-user-dashboard-control'; // Set this to whatever you want
719
+
720
+ // Checks whether there are already dashboard widget options in the database
721
+ if ( !$jwl_widget_options = get_option( 'wp_edit_user_dashboard_options' ) ) {
722
+ $jwl_widget_options = array(); // If not, we create a new array
723
+ }
724
+
725
+ // Check whether we have information for this form
726
+ if ( !isset($jwl_widget_options[$jwl_widget_id]) ) {
727
+ $jwl_widget_options[$jwl_widget_id] = array(); // If not, we create a new array
728
+ }
729
+
730
+ // Check whether our form was just submitted
731
+ if ( 'POST' == $_SERVER['REQUEST_METHOD'] && isset($_POST[$jwl_form_id]) ) {
732
+
733
+ /* Get the value. In this case ['items'] is from the input field with the name of '.$form_id.'[items] */
734
+ $jwl_number = absint( $_POST[$jwl_form_id]['items'] );
735
+ $jwl_widget_options[$jwl_widget_id]['items'] = $jwl_number; // Set the number of items
736
+ update_option( 'wp_edit_user_dashboard_options', $jwl_widget_options ); // Update our dashboard widget options so we can access later
737
+ }
738
+
739
+ // Check if we have set the number of posts previously. If we didn't, then we just set it as empty. This value is used when we create the input field
740
+ $jwl_number = isset( $jwl_widget_options[$jwl_widget_id]['items'] ) ? (int) $jwl_widget_options[$jwl_widget_id]['items'] : '';
741
+
742
+ // Create our form fields. Pay very close attention to the name part of the input field.
743
+ echo '<p><label for="jwl_user_tinymce_dashboard_widget-number">' . __('Number of posts to show:', 'wp-edit') . '</label>';
744
+ echo '<input id="jwl_user_tinymce_dashboard_widget-number" name="'.$jwl_form_id.'[items]" type="text" value="' . $jwl_number . '" size="3" /></p>';
745
+ }
746
+ }
747
+
748
+ // Enable Post/Page Highlights
749
+ if(isset($opts_user_meta['enable_highlights']) && $opts_user_meta['enable_highlights'] === '1') {
750
+
751
+ function wp_edit_highlight_posts_status_colors(){
752
+
753
+ global $current_user;
754
+ $opts_user_meta = get_user_meta($current_user->ID, 'aaa_wp_edit_user_meta', true);
755
+ ?>
756
+ <style type="text/css">
757
+ .status-draft{background-color: <?php (isset($opts_user_meta['draft_highlight']) ? print $opts_user_meta['draft_highlight'] : print '#FFFFFF'); ?> !important;}
758
+ .status-pending{background-color: <?php (isset($opts_user_meta['pending_highlight']) ? print $opts_user_meta['pending_highlight'] : print '#FFFFFF'); ?> !important;}
759
+ .status-publish{background-color: <?php (isset($opts_user_meta['published_highlight']) ? print $opts_user_meta['published_highlight'] : print '#FFFFFF'); ?> !important;}
760
+ .status-future{background-color: <?php (isset($opts_user_meta['future_highlight']) ? print $opts_user_meta['future_highlight'] : print '#FFFFFF'); ?> !important;}
761
+ .status-private{background-color: <?php (isset($opts_user_meta['private_highlight']) ? print $opts_user_meta['private_highlight'] : print '#FFFFFF'); ?> !important;}
762
+ </style>
763
+ <?php
764
+ }
765
+ add_action('admin_head','wp_edit_highlight_posts_status_colors');
766
+ }
767
+
768
+ }
769
+ add_action('init', 'wp_edit_user_specific_init');
770
+
771
  ?>
main.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: WP Edit
4
  * Plugin URI: https://wpeditpro.com
5
  * Description: Ultimate WordPress Content Editing.
6
- * Version: 3.6
7
  * Author: Josh Lobe
8
  * Author URI: https://wpeditpro.com
9
  * License: GPL2
3
  * Plugin Name: WP Edit
4
  * Plugin URI: https://wpeditpro.com
5
  * Description: Ultimate WordPress Content Editing.
6
+ * Version: 3.7
7
  * Author: Josh Lobe
8
  * Author URI: https://wpeditpro.com
9
  * License: GPL2
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: josh401
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=A9E5VNRBMVBCS
4
  Tags: wpedit, wp edit, editor, buttons, button, add, font, font style, font select, table, tables, visual editor, search, replace, colors, color, anchor, advance, advanced, links, link, popup, javascript, upgrade, update, admin, image, images, citations, preview, html, custom css, borders, pages, posts, colorful, php, php widget, shortcode, shortcodes, style, styles, plugin, login, excerpt, id, post, page, youtube, tinymce
5
  Requires at least: 3.9
6
- Tested up to: 4.4
7
- Stable tag: 3.6
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -97,6 +97,14 @@ OR...
97
 
98
  == Changelog ==
99
 
 
 
 
 
 
 
 
 
100
  = 3.6 =
101
  * 12/16/15
102
  * Update to be stable with WordPress 4.4.
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=A9E5VNRBMVBCS
4
  Tags: wpedit, wp edit, editor, buttons, button, add, font, font style, font select, table, tables, visual editor, search, replace, colors, color, anchor, advance, advanced, links, link, popup, javascript, upgrade, update, admin, image, images, citations, preview, html, custom css, borders, pages, posts, colorful, php, php widget, shortcode, shortcodes, style, styles, plugin, login, excerpt, id, post, page, youtube, tinymce
5
  Requires at least: 3.9
6
+ Tested up to: 4.5 Alpha
7
+ Stable tag: 3.7
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
97
 
98
  == Changelog ==
99
 
100
+ = 3.7 =
101
+ * 01/11-16
102
+
103
+ * Fixed Feedblitz image loading insecure over https.
104
+ * Fixed WP_PLUGIN_URL constant; switched to using plugins_url() function.
105
+ * Fixed profile biography editor.
106
+ * Updated compatibility version.
107
+
108
  = 3.6 =
109
  * 12/16/15
110
  * Update to be stable with WordPress 4.4.