WP Edit - Version 4.0.3

Version Description

  • Updated readme.
  • Ensured plugin not generating any errors/warnings/notices with current version of WordPress.
  • WordPress 5.0 will include "Gutenberg" (please research); and I am working on a compatible WP Edit version.
Download this release

Release Info

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

Code changes from version 4.0.2 to 4.0.3

Files changed (2) hide show
  1. main.php +3250 -3250
  2. readme.txt +165 -160
main.php CHANGED
@@ -1,3251 +1,3251 @@
1
- <?php
2
- /**
3
- * Plugin Name: WP Edit
4
- * Plugin URI: https://wpeditpro.com
5
- * Description: Ultimate WordPress Content Editing.
6
- * Version: 4.0.2
7
- * Author: Josh Lobe
8
- * Author URI: https://wpeditpro.com
9
- * License: GPL2
10
- * Text Domain: wp-edit
11
- * Domain Path: /langs
12
- */
13
-
14
- /*
15
- ****************************************************************
16
- Define plugin url
17
- ****************************************************************
18
- */
19
- define('WPEDIT_PLUGIN_URL', plugins_url('', __FILE__).'/');
20
- define('WPEDIT_PLUGIN_PATH', plugin_dir_path(__FILE__));
21
-
22
-
23
- /*
24
- ****************************************************************
25
- Begin Plugin Class
26
- ****************************************************************
27
- */
28
- class wp_edit_class {
29
-
30
- /*
31
- ****************************************************************
32
- Define WP Edit Plugin Options
33
- ****************************************************************
34
- */
35
- public $global_options_buttons = array(
36
- 'toolbar1' => 'bold italic strikethrough bullist numlist blockquote alignleft aligncenter alignright link unlink wp_more hr',
37
- 'toolbar2' => 'formatselect underline alignjustify forecolor pastetext removeformat charmap outdent indent undo redo wp_help',
38
- 'toolbar3' => '',
39
- 'toolbar4' => '',
40
- 'tmce_container' => 'fontselect fontsizeselect styleselect backcolor media rtl ltr table anchor code emoticons inserttime wp_page preview print searchreplace visualblocks subscript superscript image_orig advlink acheck abbr columnShortcodes nonbreaking eqneditor'
41
- );
42
- public $global_options_global = array(
43
- 'jquery_theme' => 'smoothness',
44
- 'disable_admin_links' => '0',
45
- 'disable_fancy_tooltips' => '0'
46
- );
47
- public $global_options_general = array(
48
- 'linebreak_shortcode' => '0',
49
- 'shortcodes_in_widgets' => '0',
50
- 'shortcodes_in_excerpts' => '0',
51
- 'post_excerpt_editor' => '0',
52
- 'page_excerpt_editor' => '0',
53
- 'profile_editor' => '0',
54
- 'cpt_excerpt_editor' => array()
55
- );
56
- public $global_options_posts = array(
57
- 'post_title_field' => 'Enter title here',
58
- 'max_post_revisions' => '',
59
- 'max_page_revisions' => '',
60
- 'delete_revisions' => '0',
61
- 'hide_admin_posts' => '',
62
- 'hide_admin_pages' => '',
63
- 'disable_wpautop' => '0',
64
- 'column_shortcodes' => '0'
65
- );
66
- public $global_options_editor = array(
67
- 'editor_add_pre_styles' => '0',
68
- 'default_editor_fontsize_type' => 'pt',
69
- 'default_editor_fontsize_values' => '',
70
- 'bbpress_editor' => '0'
71
- );
72
- public $global_options_extras = array(
73
- 'signoff_text' => 'Please enter text here...'
74
- );
75
- public $global_options_user_specific = array(
76
- 'id_column' => '0',
77
- 'thumbnail_column' => '0',
78
- 'hide_text_tab' => '0',
79
- 'default_visual_tab' => '0',
80
- 'dashboard_widget' => '0',
81
- 'enable_highlights' => '0',
82
-
83
- 'draft_highlight' => '#FFFFFF',
84
- 'pending_highlight' => '#FFFFFF',
85
- 'published_highlight' => '#FFFFFF',
86
- 'future_highlight' => '#FFFFFF',
87
- 'private_highlight' => '#FFFFFF'
88
- );
89
-
90
- // Prepare global settings array (for future use)
91
- public $wpedit_options_array = array();
92
-
93
- public $filtered_buttons = array();
94
- public $new_plugin_array = array();
95
- public $default_buttons_array = array();
96
- public $filtered_plugin_buttons = array();
97
-
98
- /*
99
- ****************************************************************
100
- Class construct
101
- ****************************************************************
102
- */
103
- public function __construct() {
104
-
105
- register_activation_hook( __FILE__, array( $this, 'plugin_activate' ) ); // Plugin activation hook
106
-
107
- add_action('plugins_loaded', array($this, 'wp_edit_load_translation')); // Language localization
108
-
109
- add_filter('plugin_action_links_'.plugin_basename(__FILE__), array($this, 'plugin_settings_link')); // Set plugin settings links
110
-
111
- add_action('admin_init', array($this, 'upgrade_notice')); // Dismissable upgrade notice
112
-
113
- add_action('admin_menu', array($this, 'add_page')); // Register main admin page
114
- add_action('admin_init', array($this, 'process_activation_redirect')); // Redirect after plugin activation
115
- add_action('admin_init', array($this, 'process_settings_export')); // Export db options
116
- add_action('admin_init', array($this, 'process_settings_import')); // Import db options
117
-
118
- add_action('admin_enqueue_scripts', array($this, 'admin_plugins_page_stylesheet'));
119
-
120
- add_action('before_wp_tiny_mce', array($this, 'before_wp_tiny_mce')); // Add dashicons to tinymce
121
- add_filter('tiny_mce_before_init', array($this, 'wp_edit_tiny_mce_before_init')); // Before tinymce initialization
122
- add_action('init', array($this, 'wp_edit_init_tinymce')); // Tinymce initialization
123
-
124
- add_filter('format_for_editor', array($this, 'htlmedit_pre')); // Filter html content if wpautop is disabled
125
-
126
- $plugin_file = basename( __FILE__ );
127
- $plugin_folder = basename( dirname( __FILE__ ) );
128
- $plugin_hook = "in_plugin_update_message-{$plugin_folder}/{$plugin_file}";
129
- add_action($plugin_hook, array($this, 'wpedit_plugin_update_cb'), 10, 2); // Plugin update message
130
- add_action('admin_footer', array($this, 'wpedit_plugin_update_js')); // Plugin update message javascript
131
-
132
-
133
- // Populate this plugin filtered buttons
134
- $filter_args = array();
135
- $get_filters = apply_filters( 'wp_edit_custom_buttons', $filter_args );
136
- $filters_array = array();
137
-
138
- // If the array set is not empty (filters being applied)
139
- if( ! empty( $get_filters ) ) {
140
- foreach( $get_filters as $key => $values ) {
141
-
142
- $filters_array[] = $values;
143
- }
144
- }
145
- $this->filtered_buttons = $filters_array;
146
- }
147
-
148
- /*
149
- ****************************************************************
150
- Activation hook
151
- ****************************************************************
152
- */
153
- public function plugin_activate() {
154
-
155
- global $current_user;
156
-
157
- // Get DB values
158
- $options_buttons = get_option('wp_edit_buttons');
159
- $options_global = get_option('wp_edit_global');
160
- $options_general = get_option('wp_edit_general');
161
- $options_posts = get_option('wp_edit_posts');
162
- $options_editor = get_option('wp_edit_editor');
163
- $options_extras = get_option('wp_edit_extras');
164
- $options_user_specific = get_user_meta($current_user->ID, 'aaa_wp_edit_user_meta', true);
165
-
166
- // Check if DB value exists.. if YES, then keep value.. if NO, then replace with protected defaults
167
- $options_buttons = $options_buttons ? $options_buttons : $this->global_options_buttons;
168
- $options_global = $options_global ? $options_global : $this->global_options_global;
169
- $options_general = $options_general ? $options_general : $this->global_options_general;
170
- $options_posts = $options_posts ? $options_posts : $this->global_options_posts;
171
- $options_editor = $options_editor ? $options_editor : $this->global_options_editor;
172
- $options_extras = $options_extras ? $options_extras : $this->global_options_extras;
173
- $options_user_specific = $options_user_specific ? $options_user_specific : $this->global_options_user_specific;
174
-
175
- // Set DB values
176
- update_option('wp_edit_buttons', $options_buttons);
177
- update_option('wp_edit_global', $options_global);
178
- update_option('wp_edit_general', $options_general);
179
- update_option('wp_edit_posts', $options_posts);
180
- update_option('wp_edit_editor', $options_editor);
181
- update_option('wp_edit_extras', $options_extras);
182
- update_user_meta($current_user->ID, 'aaa_wp_edit_user_meta', $options_user_specific);
183
-
184
- // Add option for redirect
185
- add_option('wp_edit_activation_redirect', true);
186
- }
187
-
188
- /*
189
- ****************************************************************
190
- Language localization
191
- ****************************************************************
192
- */
193
- public function wp_edit_load_translation() {
194
-
195
- load_plugin_textdomain( 'wp-edit' );
196
- }
197
-
198
- /*
199
- ****************************************************************
200
- Plugin settings links
201
- ****************************************************************
202
- */
203
- public function plugin_settings_link($links) {
204
-
205
- $settings_link = '<a href="admin.php?page=wp_edit_options">'.__('Settings', 'wp-edit').'</a>';
206
- $settings_link2 = '<a target="_blank" href="https://wpeditpro.com">'.__('Go Pro!', 'wp-edit').'</a>';
207
- array_push( $links, $settings_link, $settings_link2 );
208
- return $links;
209
- }
210
-
211
- /*
212
- ****************************************************************
213
- Dismissable upgrade notice
214
- ****************************************************************
215
- */
216
- public function upgrade_notice() {
217
-
218
- // Define variables
219
- global $pagenow;
220
- global $current_user;
221
- $userid = $current_user->ID;
222
-
223
- // If we are only on plugins.php admin page...
224
- if($pagenow === 'plugins.php') {
225
-
226
- //******************************************************/
227
- // Check 30 day installation notice
228
- //******************************************************/
229
-
230
- // Check if plugin install date is set in database
231
- $opt_install = get_option('wp_edit_install');
232
- if($opt_install === false) {
233
-
234
- // Set install date to today
235
- update_option('wp_edit_install', date('Y-m-d'));
236
- }
237
-
238
- // Compare install date with today
239
- $date_install = isset($opt_install) ? $opt_install : date('Y-m-d');
240
-
241
- // If install date is more than 30 days old...
242
- if(strtotime($date_install) < strtotime('-30 days')){
243
-
244
- // If the user clicked to dismiss notice...
245
- if ( isset( $_GET['dismiss_wpedit_ug_notice'] ) && 'yes' == $_GET['dismiss_wpedit_ug_notice'] ) {
246
-
247
- // Update user meta
248
- add_user_meta( $userid, 'ignore_wpedit_ag_notice', 'yes', true );
249
- }
250
-
251
- // If user meta is not set...
252
- if ( !get_user_meta( $userid, 'ignore_wpedit_ag_notice' ) ) {
253
-
254
- // Alert plugin update message
255
- function wpedit_wordpress_version_notice() {
256
-
257
- global $pagenow;
258
-
259
- echo '<div class="updated" style="padding: 0; margin: 0; border: none; background: none;">
260
- <div class="wpedit_plugins_page_banner">
261
- <a href="'.$pagenow.'?dismiss_wpedit_ug_notice=yes"><img class="close_icon" title="" src="'. plugins_url( 'images/close_banner.png', __FILE__ ) .'" alt=""/></a>
262
- <div class="button_div">
263
- <a class="button" target="_blank" href="https://wpeditpro.com">Learn More</a>
264
- </div>
265
- <div class="text">
266
- It\'s time to consider upgrading <strong>WP Edit</strong> to the <strong>PRO</strong> version.<br />
267
- <span>Extend standard plugin functionality with new, enhanced options.</span>
268
- </div>
269
- </div>
270
- </div>';
271
- }
272
- add_action('admin_notices', 'wpedit_wordpress_version_notice');
273
- }
274
- }
275
-
276
- //******************************************************/
277
- // Check Custom Buttons API notice
278
- //******************************************************/
279
- // If the user clicked to dismiss notice...
280
- if ( isset( $_GET['dismiss_wpedit_custom_buttons_notice'] ) && 'yes' == $_GET['dismiss_wpedit_custom_buttons_notice'] ) {
281
-
282
- // Update user meta
283
- add_user_meta( $userid, 'ignore_wpedit_custom_buttons_notice', 'yes', true );
284
- }
285
-
286
- // If user meta is not set...
287
- if ( !get_user_meta( $userid, 'ignore_wpedit_custom_buttons_notice' ) ) {
288
-
289
- // Alert plugin update message
290
- function wpedit_custom_buttons_notice() {
291
-
292
- global $pagenow;
293
-
294
- echo '<div class="updated" style="padding: 0; margin: 0; border: none; background: none;">
295
- <div class="wpedit_plugins_page_banner">
296
- <a href="'.$pagenow.'?dismiss_wpedit_custom_buttons_notice=yes"><img class="close_icon" title="" src="'. plugins_url( 'images/close_banner.png', __FILE__ ) .'" alt=""/></a>
297
- <div class="button_div">
298
- <a class="button" target="_blank" href="http://learn.wpeditpro.com/custom-buttons-api/">Learn More</a>
299
- </div>
300
- <div class="text">
301
- Introducing the WP Edit Custom Buttons API<br />
302
- <span>Tell all your favorite plugin/theme developers they can now add their editor buttons to WP Edit and WP Edit Pro.</span>
303
- </div>
304
- </div>
305
- </div>';
306
- }
307
- add_action('admin_notices', 'wpedit_custom_buttons_notice');
308
- }
309
-
310
- }
311
- }
312
-
313
- public function admin_plugins_page_stylesheet( $hook ) {
314
-
315
- if( $hook == 'plugins.php' ) {
316
-
317
- wp_register_style( 'wp_edit_admin_plugins_page_styles', plugin_dir_url( __FILE__ ) . 'css/admin_plugins_page.css', array() ); // Main Admin Page Script File
318
- wp_enqueue_style( 'wp_edit_admin_plugins_page_styles' );
319
- }
320
- }
321
-
322
-
323
- /*
324
- ****************************************************************
325
- Page Functions
326
- ****************************************************************
327
- */
328
- public function add_page() {
329
-
330
- $wp_edit_page = add_menu_page(__('WP Edit', 'wp-edit'), __('WP Edit', 'wp-edit'), 'manage_options', 'wp_edit_options', array($this, 'options_do_page'));
331
- add_action('admin_print_scripts-'.$wp_edit_page, array($this, 'admin_scripts'));
332
- add_action('admin_print_styles-'.$wp_edit_page, array($this, 'admin_styles'));
333
- add_action('load-'.$wp_edit_page, array($this, 'load_page'));
334
- }
335
- public function admin_scripts() {
336
-
337
- wp_enqueue_script('jquery-ui-core');
338
- wp_enqueue_script('jquery-ui-sortable');
339
- wp_enqueue_script('jquery-ui-dialog');
340
- wp_enqueue_script('jquery-ui-tooltip');
341
- wp_enqueue_script('jquery-ui-tabs');
342
- wp_enqueue_script('wp-color-picker');
343
-
344
- wp_register_script( 'wp_edit_js', plugin_dir_url( __FILE__ ) . 'js/admin.js', array() ); // Main Admin Page Script File
345
- wp_enqueue_script( 'wp_edit_js' );
346
-
347
- // Pass WP variables to main JS script
348
- $wp_vars = array( 'jwl_plugin_url' => plugin_dir_url( __FILE__ ));
349
- wp_localize_script( 'wp_edit_js', 'jwlWpVars', $wp_vars); // Set wp-content
350
- }
351
- public function admin_styles() {
352
-
353
- $options = get_option('wp_edit_global');
354
- $select_theme = isset($options['jquery_theme']) ? $options['jquery_theme'] : 'smoothness';
355
-
356
- wp_enqueue_style( 'wp-color-picker' );
357
- wp_enqueue_style('dashicons');
358
-
359
- ?><link rel="stylesheet" href="//code.jquery.com/ui/1.10.3/themes/<?php echo $select_theme; ?>/jquery-ui.css"><?php
360
- ?><link rel="stylesheet" href="<?php echo includes_url().'js/tinymce/skins/lightgray/skin.min.css' ?>"><?php
361
-
362
- wp_register_style('wp_edit_css', plugin_dir_url( __FILE__ ) . ('css/admin.css'), array()); // css for admin panel presentation
363
- wp_enqueue_style('wp_edit_css');
364
- }
365
-
366
-
367
- /*
368
- ****************************************************************
369
- Display Page
370
- ****************************************************************
371
- */
372
- public function options_do_page() {
373
-
374
- ?>
375
- <div class="wrap">
376
-
377
- <div id="icon-themes" class="icon32"></div>
378
- <h2><?php _e('WP Edit Settings', 'wp-edit'); ?></h2>
379
-
380
- <?php
381
- settings_errors();
382
- $active_tab = isset($_GET['tab']) ? $_GET['tab'] : 'buttons';
383
-
384
-
385
- /******************************************************************************/
386
- // Make filtered button comparison; alert users if counts do not match
387
- /******************************************************************************/
388
- // First; get all buttons saved in database
389
- $plugin_buttons = get_option( 'wp_edit_buttons', $this->global_options_buttons );
390
- $plugin_buttons_string = '';
391
-
392
- foreach( $plugin_buttons as $key => $button_string ) {
393
-
394
- if( !empty( $button_string ) )
395
- $plugin_buttons_string .= $button_string. ' ';
396
- }
397
-
398
- $plugin_buttons_string = rtrim( $plugin_buttons_string, ' ' );
399
- $explode_buttons_string = explode( ' ', $plugin_buttons_string );
400
-
401
-
402
-
403
- // Second; get all plugin default buttons
404
- $plugin_buttons = $this->global_options_buttons;
405
-
406
- // Merge all default plugin buttons into single array
407
- $all_array = '';
408
- foreach($plugin_buttons as $slot_array) {
409
-
410
- if(!empty($slot_array) && $slot_array != '') { // Skip containter array if empty
411
- $all_array .= $slot_array.' '; // Create single string of all default plugin buttons
412
- }
413
- }
414
- $all_array = rtrim($all_array, ' '); // Remove trailing right space
415
- $plugin_array = explode(' ', $all_array); // Explode at spaces to make single array (this is an array of all current plugin buttons)
416
-
417
-
418
- // Third; add filtered buttons to second array
419
- $get_filters = $this->filtered_buttons;
420
-
421
- // If the array set is not empty (filters being applied)
422
- if( ! empty( $get_filters ) ) {
423
- foreach( $get_filters as $key => $values ) {
424
-
425
- $plugin_array[] = $values['button_id'];
426
- }
427
- }
428
-
429
-
430
- // Create an array of buttons that have been removed
431
- $array_diff = array_diff( $explode_buttons_string, $plugin_array );
432
-
433
-
434
- // Fourth; make comparison and alert user if filtered buttons have been removed (deactivated)
435
- if( count( $plugin_array ) < count( $explode_buttons_string ) ) {
436
-
437
- ?>
438
- <div class="error wpep_info">
439
-
440
- <p>
441
- <?php _e('The following buttons have been removed:', 'wp_edit_pro'); ?><br />
442
- <strong>
443
- <?php
444
- $buttons = '';
445
- foreach( $array_diff as $key => $button ) { $buttons .= $button . ', '; }
446
- $buttons = rtrim( $buttons, ', ' );
447
- echo $buttons;
448
- ?>
449
- </strong><br /><br />
450
- <?php _e('These buttons came from a plugin or theme that has been deactivated.', 'wp_edit_pro'); ?><br />
451
- <?php _e('To remove this message; simply visit the "Buttons" tab and save the buttons.', 'wp_edit_pro'); ?><br />
452
- </p>
453
- </div>
454
- <?php
455
- }
456
- ?>
457
-
458
- <h2 class="nav-tab-wrapper">
459
- <a href="?page=wp_edit_options&tab=buttons" class="nav-tab <?php echo $active_tab == 'buttons' ? 'nav-tab-active' : ''; ?>"><?php _e('Buttons', 'wp-edit'); ?></a>
460
- <a href="?page=wp_edit_options&tab=global" class="nav-tab <?php echo $active_tab == 'global' ? 'nav-tab-active' : ''; ?>"><?php _e('Global', 'wp-edit'); ?></a>
461
- <a href="?page=wp_edit_options&tab=general" class="nav-tab <?php echo $active_tab == 'general' ? 'nav-tab-active' : ''; ?>"><?php _e('General', 'wp-edit'); ?></a>
462
- <a href="?page=wp_edit_options&tab=posts" class="nav-tab <?php echo $active_tab == 'posts' ? 'nav-tab-active' : ''; ?>"><?php _e('Posts/Pages', 'wp-edit'); ?></a>
463
- <a href="?page=wp_edit_options&tab=editor" class="nav-tab <?php echo $active_tab == 'editor' ? 'nav-tab-active' : ''; ?>"><?php _e('Editor', 'wp-edit'); ?></a>
464
- <a href="?page=wp_edit_options&tab=extras" class="nav-tab <?php echo $active_tab == 'extras' ? 'nav-tab-active' : ''; ?>"><?php _e('Extras', 'wp-edit'); ?></a>
465
- <a href="?page=wp_edit_options&tab=user_specific" class="nav-tab <?php echo $active_tab == 'user_specific' ? 'nav-tab-active' : ''; ?>"><?php _e('User Specific', 'wp-edit'); ?></a>
466
- <a href="?page=wp_edit_options&tab=database" class="nav-tab <?php echo $active_tab == 'database' ? 'nav-tab-active' : ''; ?>"><?php _e('Database', 'wp-edit'); ?></a>
467
- <a href="?page=wp_edit_options&tab=about" class="nav-tab <?php echo $active_tab == 'about' ? 'nav-tab-active' : ''; ?>"><?php _e('About', 'wp-edit'); ?></a>
468
- </h2>
469
-
470
- <?php
471
- /*
472
- ****************************************************************
473
- Buttons Tab
474
- ****************************************************************
475
- */
476
- if($active_tab == 'buttons'){
477
-
478
- $options_buttons = get_option( 'wp_edit_buttons', $this->global_options_buttons );
479
-
480
- echo '<div class="main_container">';
481
-
482
- echo '<div id="main_buttons_container" class="main_buttons_container_float">';
483
-
484
- echo '<h3>';
485
- _e('WP Edit Buttons', 'wp-edit');
486
- echo '</h3>';
487
- ?>
488
-
489
- <div class="metabox-holder">
490
- <div class="postbox">
491
-
492
- <div class="inside wpep_act_button_area" id="inside_button_hover">
493
- <h3><?php _e('Button Rows', 'wp-edit'); ?></h3>
494
-
495
- <?php
496
- $no_tooltips = false;
497
- $icons_filter = '';
498
-
499
- $options_global = get_option('wp_edit_global');
500
- if(isset($options_global['disable_fancy_tooltips']) && $options_global['disable_fancy_tooltips'] === '1') {
501
-
502
- $no_tooltips = true;
503
- }
504
-
505
- // Loop each toolbar and create array of icons (for later comparison)
506
- foreach( $options_buttons as $toolbar => $icons ) {
507
-
508
- if(!empty($icons)) {
509
-
510
- $icons_filter .= ' ' . $icons;
511
- }
512
- }
513
-
514
- // Loop all buttons and create sortable divs
515
- foreach ($options_buttons as $toolbar => $icons) {
516
-
517
- if($toolbar === 'tmce_container') {
518
- ?><h3><?php _e('Button Container', 'wp-edit'); ?></h3><?php
519
- }
520
-
521
- // Disregard rows 3 and 4
522
- if($toolbar === 'toolbar1' || $toolbar === 'toolbar2' || $toolbar === 'tmce_container') {
523
-
524
-
525
- echo '<div id="'.$toolbar.'" class="ui-state-default sortable">';
526
-
527
- // Create array of icons
528
- if(!empty($icons)) {
529
- $icons = explode(' ', $icons);
530
- }
531
-
532
- // Loop icons (if is array)
533
- if(is_array($icons)) {
534
- foreach ($icons as $icon) {
535
-
536
- $class = ''; $title = ''; $text = ''; $style = ''; $tooltip = array('title' => '', 'content' => '');
537
-
538
- // WP Buttons included by default
539
- if($icon === 'bold') {
540
- $class = 'dashicons dashicons-editor-bold';
541
- $title = 'Bold';
542
- $tooltip['title'] = 'Bold';
543
- $tooltip['content'] = '<p>Apply <strong>bold</strong> to editor text.</p>';
544
- }
545
- else if($icon === 'italic') {
546
- $class = 'dashicons dashicons-editor-italic';
547
- $title = 'Italic';
548
- $tooltip['title'] = 'Italic';
549
- $tooltip['content'] = '<p>Apply <em>italic</em> to editor text.</p>';
550
- }
551
- else if($icon === 'strikethrough') {
552
- $class = 'dashicons dashicons-editor-strikethrough';
553
- $title = 'Strikethrough';
554
- $tooltip['title'] = 'Strikethrough';
555
- $tooltip['content'] = '<p>Apply <strike>strikethrough</strike> to editor text.</p>';
556
- }
557
- else if($icon === 'bullist') {
558
- $class = 'dashicons dashicons-editor-ul';
559
- $title = 'Bullet List';
560
- $tooltip['title'] = 'Bullet List';
561
- $tooltip['content'] = '<p>Create a list of bulleted items.</p>';
562
- }
563
- else if($icon === 'numlist') {
564
- $class = 'dashicons dashicons-editor-ol';
565
- $title = 'Numbered List';
566
- $tooltip['title'] = 'Numbered List';
567
- $tooltip['content'] = '<p>Create a list of numbered items.</p>';
568
- }
569
- else if($icon === 'blockquote') {
570
- $class = 'dashicons dashicons-editor-quote';
571
- $title = 'Blockquote';
572
- $tooltip['title'] = 'Blockquote';
573
- $tooltip['content'] = '<p>Insert a block level quotation.</p>';
574
- }
575
- else if($icon === 'hr') {
576
- $class = 'dashicons dashicons-minus';
577
- $title = 'Horizontal Rule';
578
- $tooltip['title'] = 'Horizontal Rule';
579
- $tooltip['content'] = '<p>Insert a horizontal rule.</p>';
580
- }
581
- else if($icon === 'alignleft') {
582
- $class = 'dashicons dashicons-editor-alignleft';
583
- $title = 'Align Left';
584
- $tooltip['title'] = 'Align Left';
585
- $tooltip['content'] = '<p>Align editor content to the left side of the editor.</p>';
586
- }
587
- else if($icon === 'aligncenter') {
588
- $class = 'dashicons dashicons-editor-aligncenter';
589
- $title = 'Align Center';
590
- $tooltip['title'] = 'Align Center';
591
- $tooltip['content'] = '<p>Align editor content to the center of the editor.</p>';
592
- }
593
- else if($icon === 'alignright') {
594
- $class = 'dashicons dashicons-editor-alignright';
595
- $title = 'Align Right';
596
- $tooltip['title'] = 'Align Right';
597
- $tooltip['content'] = '<p>Align editor content to the right side of the editor.</p>';
598
- }
599
- else if($icon === 'link') {
600
- $class = 'dashicons dashicons-admin-links';
601
- $title = 'Link';
602
- $tooltip['title'] = 'Link';
603
- $tooltip['content'] = '<p>Insert a link around currently selected content.</p>';
604
- }
605
- else if($icon === 'unlink') {
606
- $class = 'dashicons dashicons-editor-unlink';
607
- $title = 'Unlink';
608
- $tooltip['title'] = 'Unlink';
609
- $tooltip['content'] = '<p>Remove the link around currently selected content.</p>';
610
- }
611
- else if($icon === 'wp_more') {
612
- $class = 'dashicons dashicons-editor-insertmore';
613
- $title = 'More';
614
- $tooltip['title'] = 'More';
615
- $tooltip['content'] = '<p>Inserts the read_more() WordPress function; commonly used for excerpts.</p>';
616
- }
617
-
618
- else if($icon === 'formatselect') {
619
- $title = 'Format Select';
620
- $text = 'Paragraph';
621
- $tooltip['title'] = 'Paragraph';
622
- $tooltip['content'] = '<p>Adds the Format Select dropdown button; used to select different styles.</p>';
623
- }
624
- else if($icon === 'underline') {
625
- $class = 'dashicons dashicons-editor-underline';
626
- $title = 'Underline';
627
- $tooltip['title'] = 'Underline';
628
- $tooltip['content'] = '<p>Apply <u>underline</u> to editor text.</p>';
629
- }
630
- else if($icon === 'alignjustify') {
631
- $class = 'dashicons dashicons-editor-justify';
632
- $title = 'Align Full';
633
- $tooltip['title'] = 'Align Full';
634
- $tooltip['content'] = '<p>Align selected content to full width of the page.</p>';
635
- }
636
- else if($icon === 'forecolor') {
637
- $class = 'dashicons dashicons-editor-textcolor';
638
- $title = 'Foreground Color';
639
- $tooltip['title'] = 'Foreground Color';
640
- $tooltip['content'] = '<p>Change the foreground color of selected content; commonly used to change text color.</p>';
641
- }
642
- else if($icon === 'pastetext') {
643
- $class = 'dashicons dashicons-editor-paste-text';
644
- $title = 'Paste Text';
645
- $tooltip['title'] = 'Paste Text';
646
- $tooltip['content'] = '<p>Paste content as plain text.</p>';
647
- }
648
- else if($icon === 'removeformat') {
649
- $class = 'dashicons dashicons-editor-removeformatting';
650
- $title = 'Remove Format';
651
- $tooltip['title'] = 'Remove Format';
652
- $tooltip['content'] = '<p>Remove all current formatting from selected content.</p>';
653
- }
654
- else if($icon === 'charmap') {
655
- $class = 'dashicons dashicons-editor-customchar';
656
- $title = 'Character Map';
657
- $tooltip['title'] = 'Character Map';
658
- $tooltip['content'] = '<p>Display a characted map used for inserting special characters.</p>';
659
- }
660
- else if($icon === 'outdent') {
661
- $class = 'dashicons dashicons-editor-outdent';
662
- $title = 'Outdent';
663
- $tooltip['title'] = 'Outdent';
664
- $tooltip['content'] = '<p>Outdent selected content; primary used for paragraph elements.</p>';
665
- }
666
- else if($icon === 'indent') {
667
- $class = 'dashicons dashicons-editor-indent';
668
- $title = 'Indent';
669
- $tooltip['title'] = 'Indent';
670
- $tooltip['content'] = '<p>Indent selected content; primary used for paragraph elements.</p>';
671
- }
672
- else if($icon === 'undo') {
673
- $class = 'dashicons dashicons-undo';
674
- $title = 'Undo';
675
- $tooltip['title'] = 'Undo';
676
- $tooltip['content'] = '<p>Undo last editor action.</p>';
677
- }
678
- else if($icon === 'redo') {
679
- $class = 'dashicons dashicons-redo';
680
- $title = 'Redo';
681
- $tooltip['title'] = 'Redo';
682
- $tooltip['content'] = '<p>Redo last editor action.</p>';
683
- }
684
- else if($icon === 'wp_help') {
685
- $class = 'dashicons dashicons-editor-help';
686
- $title = 'Help';
687
- $tooltip['title'] = 'Help';
688
- $tooltip['content'] = '<p>Displays helpful information such as editor information and keyboard shortcuts.</p>';
689
- }
690
-
691
- // WP Buttons not included by default
692
- else if($icon === 'fontselect') {
693
- $title = 'Font Select';
694
- $text = 'Font Family';
695
- $tooltip['title'] = 'Font Select';
696
- $tooltip['content'] = '<p>Apply various fonts to the editor selection.</p><p>Also displays fonts from Google Fonts options (if activated).</p>';
697
- }
698
- else if($icon === 'fontsizeselect') {
699
- $title = 'Font Size Select';
700
- $text = 'Font Sizes';
701
- $tooltip['title'] = 'Font Size Select';
702
- $tooltip['content'] = '<p>Apply various font sizes to the editor selection.</p><p>Default values can be switched from "pt" to "px" via the Editor tab.</p>';
703
- }
704
- else if($icon === 'styleselect') {
705
- $title = 'Formats';
706
- $text = 'Formats';
707
- $tooltip['title'] = 'Formats';
708
- $tooltip['content'] = '<p>Displays quick access to formats like "Headings", "Inline", "Blocks" and "Alignment".</p><p>Any custom styles created (Styles Tab) will also be shown here.</p>';
709
- }
710
- else if($icon === 'backcolor') {
711
- $title = 'Background Color Picker';
712
- $text = '<i class="mce-ico mce-i-backcolor"></i>';
713
- $tooltip['title'] = 'Background Color Picker';
714
- $tooltip['content'] = '<p>Change the background color of selected content; commonly used for high-lighting text.</p>';
715
- }
716
- else if($icon === 'media') {
717
- $class = 'dashicons dashicons-format-video';
718
- $title = 'Media';
719
- $tooltip['title'] = 'Media';
720
- $tooltip['content'] = '<p>Insert media from an external resource (by link); or embed media content into editor.</p>';
721
- }
722
- else if($icon === 'rtl') {
723
- $title = 'Text Direction Right to Left';
724
- $text = '<i class="mce-ico mce-i-rtl"></i>';
725
- $tooltip['title'] = 'Text Direction Right to Left';
726
- $tooltip['content'] = '<p>Forces the text direction from right to left on selected block element.</p>';
727
- }
728
- else if($icon === 'ltr') {
729
- $title = 'Text Direction Left to Right';
730
- $text = '<i class="mce-ico mce-i-ltr"></i>';
731
- $tooltip['title'] = 'Text Direction Left to Right';
732
- $tooltip['content'] = '<p>Forces the text direction from left to right on selected block element.</p>';
733
- }
734
- else if($icon === 'table') {
735
- $title = 'Tables';
736
- $text = '<i class="mce-ico mce-i-table"></i>';
737
- $tooltip['title'] = 'Tables';
738
- $tooltip['content'] = '<p>Insert, edit and modify html tables.</p>';
739
- }
740
- else if($icon === 'anchor') {
741
- $title = 'Anchor';
742
- $text = '<i class="mce-ico mce-i-anchor"></i>';
743
- $tooltip['title'] = 'Anchor';
744
- $tooltip['content'] = '<p>Create an anchor link on the page.</p>';
745
- }
746
- else if($icon === 'code') {
747
- $title = 'HTML Code';
748
- $text = '<i class="mce-ico mce-i-code"></i>';
749
- $tooltip['title'] = 'HTML Code';
750
- $tooltip['content'] = '<p>Displays the html code of the editor content; in a popup window.</p><p>This can be helpful when editing code is necessary, but switching editor views is undesirable.</p><p>Also, the "Code Magic" button provides a much better interface.</p>';
751
- }
752
- else if($icon === 'emoticons') {
753
- $title = 'Emoticons';
754
- $text = '<i class="mce-ico mce-i-emoticons"></i>';
755
- $tooltip['title'] = 'Emoticons';
756
- $tooltip['content'] = '<p>Opens an overlay window with access to common emoticons.</p>';
757
- }
758
- else if($icon === 'inserttime') {
759
- $title = 'Insert Date Time';
760
- $text = '<i class="mce-ico mce-i-insertdatetime"></i>';
761
- $tooltip['title'] = 'Insert Date Time';
762
- $tooltip['content'] = '<p>Inserts the current date and time into the content editor.</p><p>The date format can be adjusted using the "Configuration" tab.</p>';
763
- }
764
- else if($icon === 'wp_page') {
765
- $title = 'Page Break';
766
- $text = '<i class="mce-ico mce-i-pagebreak"></i>';
767
- $tooltip['title'] = 'Page Break';
768
- $tooltip['content'] = '<p>Inserts a page break; which can created "paged" sections of the content.</p>';
769
- }
770
- else if($icon === 'preview') {
771
- $title = 'Preview';
772
- $text = '<i class="mce-ico mce-i-preview"></i>';
773
- $tooltip['title'] = 'Preview';
774
- $tooltip['content'] = '<p>A quick preview of the editor content.</p>';
775
- }
776
- else if($icon === 'print') {
777
- $title = 'Print';
778
- $text = '<i class="mce-ico mce-i-print"></i>';
779
- $tooltip['title'] = 'Print';
780
- $tooltip['content'] = '<p>Print the editor content directly to a printer.</p>';
781
- }
782
- else if($icon === 'searchreplace') {
783
- $title = 'Search and Replace';
784
- $text = '<i class="mce-ico mce-i-searchreplace"></i>';
785
- $tooltip['title'] = 'Search and Replace';
786
- $tooltip['content'] = '<p>Search and/or replace the editor content with specific characters.</p>';
787
- }
788
- else if($icon === 'visualblocks') {
789
- $title = 'Show Blocks';
790
- $text = '<i class="mce-ico mce-i-visualblocks"></i>';
791
- $tooltip['title'] = 'Show Blocks';
792
- $tooltip['content'] = '<p>Shows all block level editor elements with a light border.</p>';
793
- }
794
- else if($icon === 'subscript') {
795
- $title = 'Subscript';
796
- $text = '<i class="mce-ico mce-i-subscript"></i>';
797
- $tooltip['title'] = 'Subscript';
798
- $tooltip['content'] = '<p>Adds a <sub>subscript</sub> to selected editor content (mainly used with text).</p>';
799
- }
800
- else if($icon === 'superscript') {
801
- $title = 'Superscript';
802
- $text = '<i class="mce-ico mce-i-superscript"></i>';
803
- $tooltip['title'] = 'Superscript';
804
- $tooltip['content'] = '<p>Adds a <sup>superscript</sup> to selected editor content (mainly used with text).</p>';
805
- }
806
- else if($icon === 'image_orig') {
807
- $class = 'dashicons dashicons-format-image';
808
- $title = 'Image';
809
- $tooltip['title'] = 'Image';
810
- $tooltip['content'] = '<p>Insert images (by link).</p>';
811
- }
812
- else if($icon === 'p_tags_button') {
813
- $title = 'Paragraph Tag';
814
- $style='background-image:url('.WPEDIT_PLUGIN_URL.'plugins/ptags/p_tag.png);width:20px;height:20px;';
815
- $tooltip['title'] = 'Paragraph Tag';
816
- $tooltip['content'] = '<p>Insert paragraph tags (along with attributes); which will not be removed from the editor.</p>';
817
- }
818
- else if($icon === 'line_break_button') {
819
- $title = 'Line Break';
820
- $style='background-image:url('.WPEDIT_PLUGIN_URL.'plugins/linebreak/line_break.png);width:20px;height:20px;';
821
- $tooltip['title'] = 'Line Break';
822
- $tooltip['content'] = '<p>Insert line breaks; which will not be removed from the editor.</p><p>This is done by adding a class of "none" to the tag.</p>';
823
- }
824
- else if($icon === 'mailto') {
825
- $title = 'MailTo Link';
826
- $style='background-image:url('.WPEDIT_PLUGIN_URL.'plugins/mailto/mailto.gif);width:20px;height:20px;';
827
- $tooltip['title'] = 'MailTo Link';
828
- $tooltip['content'] = '<p>Turns an email address into an active mail link.</p><p>When clicked, it will open the users default mail client to send a message.</p>';
829
- }
830
- else if($icon === 'loremipsum') {
831
- $title = 'Lorem Ipsum';
832
- $style='background-image:url('.WPEDIT_PLUGIN_URL.'plugins/loremipsum/loremipsum.png);width:20px;height:20px;';
833
- $tooltip['title'] = 'Lorem Ipsum';
834
- $tooltip['content'] = '<p>Esaily insert placeholder text into the editor.</p><p>Select from multiple languages; and choose the number of elements to add.</p>';
835
- }
836
- else if($icon === 'shortcodes') {
837
- $title = 'Shortcodes';
838
- $style='background-image:url('.WPEDIT_PLUGIN_URL.'plugins/shortcodes/shortcodes.gif);width:20px;height:20px;';
839
- $tooltip['title'] = 'Shortcodes';
840
- $tooltip['content'] = '<p>Gathers all available shortcodes and adds them to a dropdown list; for easy editor insertion.</p><p>Note: The shortcodes gathered here do not include any shortcode attributes.</p><p>If shortcode attributes are necessary, they will need to be entered into the shortcode manually.</p>';
841
- }
842
- else if($icon === 'youTube') {
843
- $title = 'YouTube Video';
844
- $style='background-image:url('.WPEDIT_PLUGIN_URL.'plugins/youTube/images/youtube.png);width:20px;height:20px;';
845
- $tooltip['title'] = 'YouTube Video';
846
- $tooltip['content'] = '<p>Browse and insert YouTube videos without ever leaving the editor.</p><p>A custom interface allows browsing YouTube videos directly from the editor.</p>';
847
- }
848
- else if($icon === 'clker') {
849
- $title = 'Clker Images';
850
- $style='background-image:url('.WPEDIT_PLUGIN_URL.'plugins/clker/img/clker.png);width:20px;height:20px;';
851
- $tooltip['title'] = 'Clker Images';
852
- $tooltip['content'] = '<p>Browse and insert images from the Clker.com website.</p>';
853
- }
854
- else if($icon === 'cleardiv') {
855
- $title = 'Clear Div';
856
- $style='background-image:url('.WPEDIT_PLUGIN_URL.'plugins/cleardiv/images/cleardiv.png);width:20px;height:20px;';
857
- $tooltip['title'] = 'Clear Div';
858
- $tooltip['content'] = '<p>Clear editor divs. Selections include "left", "right" and "both".</p>';
859
- }
860
- else if($icon === 'codemagic') {
861
- $title = 'Code Magic';
862
- $style='background-image:url('.WPEDIT_PLUGIN_URL.'plugins/codemagic/images/codemagic.png);width:20px;height:20px;';
863
- $tooltip['title'] = 'Code Magic';
864
- $tooltip['content'] = '<p>An advanced html code editor; view and edit the html code from an overlay window.</p><p>Includes syntax highlighting; search and replace; and proper element spacing.</p><p>This is a great option when editing html code is necessary; but swtiching editor views is undesirable.</p>';
865
- }
866
- else if($icon === 'acheck') {
867
- $title = 'Accessibility Checker';
868
- $style='background-image:url('.WPEDIT_PLUGIN_URL.'plugins/acheck/img//acheck.png);width:20px;height:20px;';
869
- $tooltip['title'] = 'Accessibility Checker';
870
- $tooltip['content'] = '<p>Checks the editor content for accessibility by other devices.</p>';
871
- }
872
- else if($icon === 'advlink') {
873
- $title = 'Insert/Edit Advanced Link';
874
- $style='background-image:url('.WPEDIT_PLUGIN_URL.'plugins/advlink/images/advlink.png);width:20px;height:20px;';
875
- $tooltip['title'] = 'Insert/Edit Advanced Link';
876
- $tooltip['content'] = '<p>Insert and edit links; along with various atttributes.</p><p>Populates with all posts and pages; so linking to current content is a one-click process.</p><p>Also includes javascript attributes (onclick, onmouseover, etc.); which can be used for executing javascript functions.</p>';
877
- }
878
- else if($icon === 'advhr') {
879
- $title = 'Advanced Horizontal Line';
880
- $style='background-image:url('.WPEDIT_PLUGIN_URL.'plugins/advhr/images/advhr.png);width:20px;height:20px;';
881
- $tooltip['title'] = 'Advanced Horizontal Line';
882
- $tooltip['content'] = '<p>Modify various options of the horizontal line; like shadow and width.</p>';
883
- }
884
- else if($icon === 'advimage') {
885
- $title = 'Advanced Insert/Edit Image';
886
- $style='background-image:url('.WPEDIT_PLUGIN_URL.'plugins/advimage/images//advimage.png);width:20px;height:20px;';
887
- $tooltip['title'] = 'Advanced Insert/Edit Image';
888
- $tooltip['content'] = '<p>Insert/Edit images with more control.</p><p>Define image attributes, image margin, image padding and image border.</p><p>Also includes javascript attributes (onclick, onmouseover, etc.); which can be used for executing javascript functions.</p>';
889
- }
890
- else if($icon === 'formatPainter') {
891
- $class = 'dashicons dashicons-admin-appearance';
892
- $title = 'Format Painter';
893
- $tooltip['title'] = 'Format Painter';
894
- $tooltip['content'] = '<p>Copies styling from one element; and applies the same styling to another element.</p>';
895
- }
896
- else if($icon === 'googleImages') {
897
- $title = 'Google Images';
898
- $style='background-image:url('.WPEDIT_PLUGIN_URL.'plugins/googleImages/images/googleImages.png);width:20px;height:20px;';
899
- $tooltip['title'] = 'Google Images';
900
- $tooltip['content'] = '<p>Browse and insert Google images without ever leaving the content editor.</p>';
901
- }
902
- else if($icon === 'abbr') {
903
- $title = 'Abbreviation';
904
- $style='background-image:url('.WPEDIT_PLUGIN_URL.'plugins/abbr/abbr.png);width:20px;height:20px;';
905
- $tooltip['title'] = 'Abbreviation';
906
- $tooltip['content'] = '<p>Add an abbreviation to selected editor content.</p>';
907
- }
908
- else if($icon === 'imgmap') {
909
- $title = 'Image Map';
910
- $style='background-image:url('.WPEDIT_PLUGIN_URL.'plugins/imgmap/images/imgmap.png);width:20px;height:20px;';
911
- $tooltip['title'] = 'Image Map';
912
- $tooltip['content'] = '<p>Create an image map from an image.</p><p>Allows multiple "hot spots" on a single image. Each "hot spot" can link to a different url.</p>';
913
- }
914
- else if($icon === 'columnShortcodes') {
915
- $class = 'dashicons dashicons-schedule';
916
- $title = 'Column Shortcodes';
917
- $tooltip['title'] = 'Column Shortcodes';
918
- $tooltip['content'] = '<p>A tool for easily inserting column shortcode templates.</p>';
919
- }
920
- else if($icon === 'nonbreaking') {
921
- $title = 'Nonbreaking Space';
922
- $style='background-image:url('.WPEDIT_PLUGIN_URL.'plugins/nonbreaking/nonbreaking.png);width:20px;height:20px;';
923
- $tooltip['title'] = 'Nonbreaking Space';
924
- $tooltip['content'] = '<p>Insert a nonbreaking space; which will not be removed from the editor.</p>';
925
- }
926
- else if($icon === 'eqneditor') {
927
- $title = 'CodeCogs Equation Editor';
928
- $style='background-image:url('.WPEDIT_PLUGIN_URL.'plugins/eqneditor/img/eqneditor.png);width:20px;height:20px;';
929
- $tooltip['title'] = 'CodeCogs Equation Editor';
930
- $tooltip['content'] = '<p>Create complex math equations from a simple interface.</p>';
931
- }
932
- else {
933
-
934
- $get_filters = $this->filtered_buttons;
935
-
936
- // If the array set is not empty (filters being applied)
937
- if( ! empty( $get_filters ) ) {
938
-
939
- $check_filter = array();
940
- foreach( $get_filters as $key => $values ) {
941
-
942
- $check_filter[$values['button_id']] = $values;
943
- }
944
-
945
- // If this button is in filtered array
946
- if( array_key_exists( $icon, $check_filter ) ) {
947
-
948
- $array_key = $check_filter[$icon];
949
-
950
- $title = isset( $array_key['tooltip_title'] ) && $array_key['tooltip_title'] !== '' ? $array_key['tooltip_title'] : '';
951
- $class = isset( $array_key['dashicon'] ) && $array_key['dashicon'] !== '' ? $array_key['dashicon'] : '';
952
- $text = isset( $array_key['button_text'] ) && $array_key['button_text'] !== '' ? $array_key['button_text'] : '';
953
- $style = isset( $array_key['custom_icon'] ) && $array_key['custom_icon'] !== '' ? 'background-image:url(' . $array_key['custom_icon'] . ');width:20px;height:20px;' : '';
954
- $tooltip['title'] = isset( $array_key['tooltip_title'] ) && $array_key['tooltip_title'] !== '' ? $array_key['tooltip_title'] : '';
955
- $tooltip['content'] = isset( $array_key['tooltip_content'] ) && $array_key['tooltip_content'] !== '' ? $array_key['tooltip_content'] : '';
956
- }
957
- }
958
- }
959
-
960
- // Process tooltips
961
- $tooltip_title = isset($tooltip['title']) ? $tooltip['title'] : 'Title not found';
962
- $tooltip_content = isset($tooltip['content']) ? $tooltip['content'] : '<p>Content not found. Please report to the plugin developer.</p>';
963
-
964
- // Are we displaying fancy tooltips?
965
- $tooltip_att = ($no_tooltips === false) ? 'data-tooltip="<h4 class=\'data_tooltip_title\'>'.htmlspecialchars($tooltip_title).'</h4><hr />'.htmlspecialchars($tooltip_content).'" ' : '';
966
-
967
-
968
- // ARRAY CHECKING BEFORE DISPLAYING BUTTON FROM DATABASE
969
- // This will keep saved filtered buttons from displaying (and removes when user saves); if their parent was deactivated
970
-
971
- // Create array of default buttons (and filter buttons)
972
- $plugin_buttons = $this->global_options_buttons;
973
- $check_array = '';
974
-
975
- foreach( $plugin_buttons as $button ) {
976
- if( !empty( $button ) && $button != '' ) { // Skip containter array if empty
977
-
978
- $check_array .= $button . ' '; // Create single string of all default plugin buttons
979
- }
980
- }
981
-
982
- $get_filters = $this->filtered_buttons;
983
-
984
- // If the array set is not empty (filters being applied)
985
- if( ! empty( $get_filters ) ) {
986
- foreach( $get_filters as $key => $values ) {
987
-
988
- $check_array .= $values['button_id'] . ' ';
989
- }
990
- }
991
-
992
- $trim_check_array = rtrim( $check_array, ' ' );
993
- $explode_check_array = explode( ' ', $trim_check_array );
994
-
995
-
996
- // If button is in active array; display div
997
- if( in_array( $icon, $explode_check_array ) ) {
998
-
999
- // Display button
1000
- echo '<div '.$tooltip_att.' id="'.$icon.'" class="ui-state-default draggable '.$class.'" title="'.$title.'"><span style="'.esc_attr($style).'">'.$text.'</span></div>';
1001
- }
1002
- }
1003
- }
1004
-
1005
-
1006
- /**************************************/
1007
- // Button filter for plugins/themes
1008
- /**************************************/
1009
- $filter_flag = false;
1010
-
1011
- // Create array of saved buttons
1012
- if( $icons_filter !== '' ) {
1013
-
1014
- $trim_filter = trim( $icons_filter );
1015
- $icons_filter_array = explode( ' ', $trim_filter );
1016
- }
1017
-
1018
- $get_filters = $this->filtered_buttons;
1019
-
1020
- // If the array set is not empty (filters being applied)
1021
- if( ! empty( $get_filters ) ) {
1022
- foreach( $get_filters as $key => $values ) {
1023
-
1024
- if( ! in_array( $values['button_id'], $icons_filter_array ) ) {
1025
-
1026
- $title = isset( $values['tooltip_title'] ) && $values['tooltip_title'] !== '' ? $values['tooltip_title'] : '';
1027
- $content = isset( $values['tooltip_content'] ) && $values['tooltip_content'] !== '' ? $values['tooltip_content'] : '';
1028
- $class = isset( $values['dashicon'] ) && $values['dashicon'] !== '' ? $values['dashicon'] : '';
1029
- $text = isset( $values['button_text'] ) && $values['button_text'] !== '' ? $values['button_text'] : '';
1030
- $style = isset( $values['custom_icon'] ) && $values['custom_icon'] !== '' ? 'background-image:url(' . $values['custom_icon'] . ');width:20px;height:20px;' : '';
1031
- $span = $style !== '' ? '<span style="' . $style . '">' . $text . '</span>' : '<span>' . $text . '</span>';
1032
- $row = isset( $values['editor_row'] ) && $values['editor_row'] !== '' ? $values['editor_row'] : 'tmce_container';
1033
-
1034
- /// Filter buttons by row
1035
- if( $toolbar === $row ) {
1036
-
1037
- echo '<div
1038
- data-tooltip="<h4 class=\'data_tooltip_title\'>'.htmlspecialchars( $title ) . '</h4>
1039
- <hr /><p>'.htmlspecialchars( $content ).'</p>"
1040
- id="' . $values['button_id'] . '"
1041
- class="ui-state-default draggable new_button ' . $class . '"
1042
- title="' . $title . '">' . $span .
1043
- '</div>'
1044
- ;
1045
- }
1046
-
1047
- $filter_flag = true;
1048
- }
1049
- }
1050
- }
1051
- echo '</div>'; // End foreach .sortable
1052
- } // End not rows 3 and 4
1053
- }
1054
-
1055
- if( $filter_flag === true ) {
1056
-
1057
- echo '<div class="error">';
1058
- echo '<h4>';
1059
- _e('New buttons have been added via other plugins (or theme).', 'wp_edit_pro');
1060
- echo '<br />';
1061
- _e('Move them to a new location (if desired) and click "Save Buttons".', 'wp_edit_pro');
1062
- echo '</h4>';
1063
- echo '</div>';
1064
- }
1065
- ?>
1066
- </div> <!-- End #inside_button_hover -->
1067
- </div> <!-- End .postbox -->
1068
- </div> <!-- End .metabox -->
1069
- </div> <!-- End .main_buttons_container_float -->
1070
- <?php
1071
-
1072
- // Build input for passing button arrangements
1073
- echo '<form method="post" action="">';
1074
-
1075
- echo '<input type="hidden" class="get_sorted_array" name="get_sorted_array_results" value="" />';
1076
-
1077
- // Submit save buttons
1078
- echo '<input type="submit" value="'.__('Save Buttons', 'wp-edit').'" name="wpep_save_buttons" class="button-primary" />';
1079
-
1080
- // Submit reset buttons
1081
- echo '<span style="margin-left:10px;"></span>';
1082
- echo '<input type="button" value="'.__('Reset Buttons', 'wp-edit').'" class="button-primary reset_dd_buttons" />';
1083
- echo '<input type="submit" name="wpep_reset_buttons" class="button-primary wpep_reset_buttons" style="display:none;" />';
1084
-
1085
- // Create nonce
1086
- wp_nonce_field( 'wpe_save_buttons_opts' );
1087
-
1088
- echo '</form>';
1089
- echo '</div>';
1090
-
1091
- echo '<div class="main_container">';
1092
-
1093
- echo '<h3>';
1094
- _e('Buttons Tips', 'wp-edit');
1095
- echo '</h3>';
1096
- ?>
1097
-
1098
- <div class="metabox-holder">
1099
- <div class="postbox">
1100
- <div class="inside">
1101
-
1102
- <div id="button_help_tabs">
1103
-
1104
- <ul>
1105
- <li><a href="#dragdrop"><?php _e('Drag/Drop', 'wp-edit'); ?></a></li>
1106
- <li><a href="#multiselect"><?php _e('Multi Select', 'wp-edit'); ?></a></li>
1107
- <li><a href="#reset"><?php _e('Reset', 'wp-edit'); ?></a></li>
1108
- <li><a href="#custom_api"><?php _e('Custom Buttons API', 'wp-edit'); ?></a></li>
1109
- </ul>
1110
-
1111
- <div id="dragdrop">
1112
- <p>
1113
- <?php _e('Buttons can be dragged and dropped into desired button rows.', 'wp-edit'); ?><br />
1114
- <?php _e('The "Button Container" is a placeholder for buttons not used in the editor; these buttons will not appear when editing a post or page.', 'wp-edit'); ?>
1115
- </p>
1116
- </div>
1117
- <div id="multiselect">
1118
- <p>
1119
- <?php _e('Buttons may also be selected in quantities; or multiple selections, before being moved.', 'wp-edit'); ?>
1120
- </p>
1121
- <p>
1122
- <?php _e('Clicking a button will set it as "active"; a yellowish highlight color. Multiple buttons can be clicked and set as "active".', 'wp-edit'); ?><br />
1123
- <?php _e('Clicking and dragging one of the "active" buttons will move the entire "active" selection.', 'wp-edit'); ?><br />
1124
- <?php _e('Clicking outside the button area will remove all currently active button selections.', 'wp-edit'); ?>
1125
- </p>
1126
- </div>
1127
- <div id="reset">
1128
- <p>
1129
- <?php _e('Clicking "Reset Buttons" will restore the editor buttons to their original default values.', 'wp-edit'); ?><br />
1130
- <?php _e('All button rows will get the default WordPress button arrangements; and the extra buttons will be added to the "Button Container".', 'wp-edit'); ?>
1131
- </p>
1132
- </div>
1133
- <div id="custom_api">
1134
- <p>
1135
- <?php _e('WP Edit now uses a Custom Buttons API which allows other plugin/theme developers to add their editor buttons into the system.', 'wp-edit'); ?><br />
1136
- <?php printf( __('Please direct all your favorite plugin/theme developers to the <a target="_blank" href="%s">Custom Buttons API</a> documentation.', 'wp-edit'), 'http://learn.wpeditpro.com/custom-buttons-api/'); ?>
1137
- </p>
1138
- </div>
1139
- </div>
1140
- </div>
1141
- </div>
1142
- </div>
1143
- <?php
1144
- echo '</div>';
1145
- }
1146
- /*
1147
- ****************************************************************
1148
- Global Tab
1149
- ****************************************************************
1150
- */
1151
- else if($active_tab == 'global') {
1152
-
1153
- echo '<div class="main_container">';
1154
-
1155
- ?>
1156
- <h3><?php _e('Global Options', 'wp-edit'); ?></h3>
1157
- <form method="post" action="">
1158
- <div class="metabox-holder">
1159
- <div class="postbox">
1160
- <div class="inside">
1161
-
1162
- <?php
1163
- $options_global = get_option('wp_edit_global');
1164
- $jquery_theme = isset($options_global['jquery_theme']) ? $options_global['jquery_theme'] : 'smoothness';
1165
- $disable_admin_links = isset($options_global['disable_admin_links']) && $options_global['disable_admin_links'] === '1' ? 'checked="checked"' : '';
1166
- $disable_fancy_tooltips = isset($options_global['disable_fancy_tooltips']) && $options_global['disable_fancy_tooltips'] === '1' ? 'checked="checked"' : '';
1167
- ?>
1168
-
1169
- <table cellpadding="10">
1170
- <tbody>
1171
- <tr><td><?php _e('jQuery Theme', 'wp-edit'); ?></td>
1172
- <td>
1173
-
1174
- <select id="jquery_theme" name="jquery_theme"/>
1175
- <?php
1176
- $jquery_themes = array('base','black-tie','blitzer','cupertino','dark-hive','dot-luv','eggplant','excite-bike','flick','hot-sneaks','humanity','le-frog','mint-choc','overcast','pepper-grinder','redmond','smoothness','south-street','start','sunny','swanky-purse','trontastic','ui-darkness','ui-lightness','vader');
1177
-
1178
- foreach($jquery_themes as $jquery_theme) {
1179
- $selected = ($options_global['jquery_theme']==$jquery_theme) ? 'selected="selected"' : '';
1180
- echo "<option value='$jquery_theme' $selected>$jquery_theme</option>";
1181
- }
1182
- ?>
1183
- </select>
1184
- <label for="jquery_theme"> <?php _e('Selects the jQuery theme for plugin alerts and notices.', 'wp-edit'); ?></label>
1185
- </td>
1186
- </tr>
1187
- <tr><td><?php _e('Disable Admin Links', 'wp-edit'); ?></td>
1188
- <td>
1189
- <input id="disable_admin_links" type="checkbox" value="1" name="disable_admin_links" <?php echo $disable_admin_links; ?> />
1190
- <label for="disable_admin_links"><?php _e('Disables the WP Edit top admin bar links.', 'wp-edit'); ?></label>
1191
- </td>
1192
- </tr>
1193
- <tr><td><?php _e('Disable Fancy Tooltips', 'wp-edit'); ?></td>
1194
- <td>
1195
- <input id="disable_fancy_tooltips" type="checkbox" value="1" name="disable_fancy_tooltips" <?php echo $disable_fancy_tooltips; ?> />
1196
- <label for="disable_fancy_tooltips"><?php _e('Disables the fancy tooltips used on button hover.', 'wp-edit'); ?></label>
1197
- </td>
1198
- </tr>
1199
- </tbody>
1200
- </table>
1201
- </div>
1202
- </div>
1203
- </div>
1204
- <input type="submit" value="<?php _e('Save Global Options', 'wp-edit'); ?>" class="button button-primary" id="submit_global" name="submit_global">
1205
- <?php wp_nonce_field( 'wpe_save_global_opts' ); ?>
1206
- </form>
1207
- <?php
1208
- echo '</div>';
1209
- }
1210
- /*
1211
- ****************************************************************
1212
- General Tab
1213
- ****************************************************************
1214
- */
1215
- else if($active_tab == 'general'){
1216
-
1217
- // Get all cpt's (_builtin will exclude default post types)
1218
- $post_types = get_post_types( array( 'public' => true, '_builtin' => false ), 'names' );
1219
-
1220
- echo '<div class="main_container">';
1221
-
1222
- ?>
1223
- <h3><?php _e('General Options', 'wp-edit'); ?></h3>
1224
- <form method="post" action="">
1225
- <div class="metabox-holder">
1226
- <div class="postbox">
1227
- <div class="inside">
1228
-
1229
- <?php
1230
- $options_general = get_option('wp_edit_general');
1231
- $linebreak_shortcode = isset($options_general['linebreak_shortcode']) && $options_general['linebreak_shortcode'] === '1' ? 'checked="checked"' : '';
1232
- $shortcodes_in_widgets = isset($options_general['shortcodes_in_widgets']) && $options_general['shortcodes_in_widgets'] === '1' ? 'checked="checked"' : '';
1233
- $shortcodes_in_excerpts = isset($options_general['shortcodes_in_excerpts']) && $options_general['shortcodes_in_excerpts'] === '1' ? 'checked="checked"' : '';
1234
- $post_excerpt_editor = isset($options_general['post_excerpt_editor']) && $options_general['post_excerpt_editor'] === '1' ? 'checked="checked"' : '';
1235
- $page_excerpt_editor = isset($options_general['page_excerpt_editor']) && $options_general['page_excerpt_editor'] === '1' ? 'checked="checked"' : '';
1236
- $profile_editor = isset($options_general['profile_editor']) && $options_general['profile_editor'] === '1' ? 'checked="checked"' : '';
1237
- $cpt_excerpts = isset($options_general['cpt_excerpt_editor']) ? $options_general['cpt_excerpt_editor'] : array();
1238
- ?>
1239
-
1240
- <table cellpadding="8">
1241
- <tbody>
1242
- <tr><td><?php _e('Linebreak Shortcode', 'wp-edit'); ?></td>
1243
- <td>
1244
- <input id="linebreak_shortcode" type="checkbox" value="1" name="linebreak_shortcode" <?php echo $linebreak_shortcode; ?> />
1245
- <label for="linebreak_shortcode"><?php _e('Use the [break] shortcode to insert linebreaks in the editor.', 'wp-edit'); ?></label>
1246
- </td>
1247
- </tr>
1248
- <tr><td><?php _e('Shortcodes in Widgets', 'wp-edit'); ?></td>
1249
- <td>
1250
- <input id="shortcodes_in_widgets" type="checkbox" value="1" name="shortcodes_in_widgets" <?php echo $shortcodes_in_widgets; ?> />
1251
- <label for="shortcodes_in_widgets"><?php _e('Use shortcodes in widget areas.', 'wp-edit'); ?></label>
1252
- </td>
1253
- </tr>
1254
- <tr><td><?php _e('Shortcodes in Excerpts', 'wp-edit'); ?></td>
1255
- <td>
1256
- <input id="shortcodes_in_excerpts" type="checkbox" value="1" name="shortcodes_in_excerpts" <?php echo $shortcodes_in_excerpts; ?> />
1257
- <label for="shortcodes_in_excerpts"><?php _e('Use shortcodes in excerpt areas.', 'wp-edit'); ?></label>
1258
- </td>
1259
- </tr>
1260
- <tr><td><?php _e('Profile Editor', 'wp-edit'); ?></td>
1261
- <td class="jwl_user_cell">
1262
- <input id="profile_editor" type="checkbox" value="1" name="profile_editor" <?php echo $profile_editor; ?> />
1263
- <label for="profile_editor"><?php _e('Use modified editor in profile biography field.', 'wp-edit'); ?></label>
1264
- </td>
1265
- </tr>
1266
- </tbody>
1267
- </table>
1268
- </div>
1269
- </div>
1270
-
1271
- <div class="postbox">
1272
- <div class="inside">
1273
-
1274
- <table cellpadding="8">
1275
- <tbody>
1276
- <tr><td><?php _e('WP Edit Post Excerpt', 'wp-edit'); ?></td>
1277
- <td>
1278
- <input id="post_excerpt_editor" type="checkbox" value="1" name="post_excerpt_editor" <?php echo $post_excerpt_editor; ?> />
1279
- <label for="post_excerpt_editor"><?php _e('Add the WP Edit editor to the Post Excerpt area.', 'wp-edit'); ?></label>
1280
- </td>
1281
- </tr>
1282
- <tr><td><?php _e('WP Edit Page Excerpt', 'wp-edit'); ?></td>
1283
- <td>
1284
- <input id="page_excerpt_editor" type="checkbox" value="1" name="page_excerpt_editor" <?php echo $page_excerpt_editor; ?> />
1285
- <label for="page_excerpt_editor"><?php _e('Add the WP Edit editor to the Page Excerpt area.', 'wp-edit'); ?></label>
1286
- </td>
1287
- </tr>
1288
- </tbody>
1289
- </table>
1290
-
1291
- <h3><?php _e('Custom Post Type Excerpts', 'wp-edit'); ?></h3>
1292
- <table cellpadding="3" style="margin-left:7px;">
1293
- <tbody>
1294
- <?php
1295
- if( !empty( $post_types) ) {
1296
- foreach ( $post_types as $post_type ) {
1297
-
1298
- $selected = in_array($post_type, $cpt_excerpts) ? 'checked="checked"' : '';
1299
- echo '<tr><td><input type="checkbox" name="cpt_excerpt_editor['.$post_type.']" '.$selected.'> '.$post_type.'</td></tr>';
1300
- }
1301
- }
1302
- else {
1303
-
1304
- echo '<tr><td>';
1305
- _e('No registered custom post types were found.', 'wp-edit');
1306
- echo '</td></tr>';
1307
- }
1308
- ?>
1309
- </tbody>
1310
- </table>
1311
- </div>
1312
- </div>
1313
- </div>
1314
-
1315
- <input type="submit" value="<?php _e('Save General Options', 'wp-edit'); ?>" class="button button-primary" id="submit_general" name="submit_general">
1316
- <?php wp_nonce_field( 'wpe_save_general_opts' ); ?>
1317
- </form>
1318
- <?php
1319
- echo '</div>';
1320
- }
1321
- /*
1322
- ****************************************************************
1323
- Posts/Pages Tab
1324
- ****************************************************************
1325
- */
1326
- else if($active_tab == 'posts'){
1327
-
1328
- $options_posts = get_option('wp_edit_posts');
1329
-
1330
- $post_title_field = isset($options_posts['post_title_field']) ? $options_posts['post_title_field'] : 'Enter title here';
1331
- $column_shortcodes = isset($options_posts['column_shortcodes']) && $options_posts['column_shortcodes'] === '1' ? 'checked="checked"' : '';
1332
- $disable_wpautop = isset($options_posts['disable_wpautop']) && $options_posts['disable_wpautop'] === '1' ? 'checked="checked"' : '';
1333
-
1334
- $max_post_revisions = isset($options_posts['max_post_revisions']) ? $options_posts['max_post_revisions'] : '';
1335
- $max_page_revisions = isset($options_posts['max_page_revisions']) ? $options_posts['max_page_revisions'] : '';
1336
-
1337
- $hide_admin_posts = isset($options_posts['hide_admin_posts']) ? $options_posts['hide_admin_posts'] : '';
1338
- $hide_admin_pages = isset($options_posts['hide_admin_pages']) ? $options_posts['hide_admin_pages'] : '';
1339
-
1340
- echo '<div class="main_container">';
1341
-
1342
- ?>
1343
- <h3><?php _e('Posts/pages Options', 'wp-edit'); ?></h3>
1344
- <form method="post" action="">
1345
- <div class="metabox-holder">
1346
- <div class="postbox">
1347
- <div class="inside">
1348
- <table cellpadding="8">
1349
- <tbody>
1350
- <tr><td><?php _e('Post/Page Default Title', 'wp-edit'); ?></td>
1351
- <td>
1352
- <input type="text" name="post_title_field" value="<?php echo $post_title_field ?>" />
1353
- <label for="post_title_field"><?php _e('Change the default "add new" post/page title field.', 'wp-edit'); ?></label>
1354
- </td>
1355
- </tr>
1356
- <tr><td><?php _e('Column Shortcodes', 'wp-edit'); ?></td>
1357
- <td>
1358
- <input id="column_shortcodes" type="checkbox" value="1" name="column_shortcodes" <?php echo $column_shortcodes; ?> />
1359
- <label for="column_shortcodes"><?php _e('Enable the column shortcodes functionality.', 'wp-edit'); ?></label>
1360
- </td>
1361
- </tr>
1362
- <tr><td><?php _e('Disable wpautop()', 'wp-edit'); ?></td>
1363
- <td>
1364
- <input id="disable_wpautop" type="checkbox" value="1" name="disable_wpautop" <?php echo $disable_wpautop; ?> />
1365
- <label for="disable_wpautop"><?php _e('Disable the filter responsible for removing p and br tags.', 'wp-edit'); ?></label>
1366
- </td>
1367
- </tr>
1368
- </tbody>
1369
- </table>
1370
- </div>
1371
- </div>
1372
- </div>
1373
-
1374
- <h3><?php _e('Page Revisions', 'wp-edit'); ?></h3>
1375
- <div class="metabox-holder">
1376
- <div class="postbox">
1377
- <div class="inside">
1378
- <table cellpadding="8">
1379
- <tbody>
1380
- <tr><td><?php _e('Max Post Revisions', 'wp-edit'); ?></td>
1381
- <td>
1382
- <input type="text" name="max_post_revisions" value="<?php echo $max_post_revisions ?>" />
1383
- <label for="max_post_revisions"><?php _e('Set max number of Post Revisions to store in database. (empty = unlimited)', 'wp-edit'); ?></label>
1384
- </td>
1385
- </tr>
1386
- <tr><td><?php _e('Max Page Revisions', 'wp-edit'); ?></td>
1387
- <td>
1388
- <input type="text" name="max_page_revisions" value="<?php echo $max_page_revisions ?>" />
1389
- <label for="max_page_revisions"><?php _e('Set max number of Page Revisions to store in database. (empty = unlimited)', 'wp-edit'); ?></label>
1390
- </td>
1391
- </tr>
1392
- <tr><td><?php _e('Delete Revisions', 'wp-edit'); ?></td>
1393
- <td>
1394
- <input id="delete_revisions" type="checkbox" value="1" name="delete_revisions" />
1395
- <label for="delete_revisions"><?php _e('Delete all database revisions.', 'wp-edit'); ?></label>
1396
- </td>
1397
- </tr>
1398
- <tr><td><?php _e('Revisions DB Size', 'wp-edit'); ?></td>
1399
- <td>
1400
- <?php
1401
- global $wpdb;
1402
- $query = $wpdb->get_results( "SELECT * FROM $wpdb->posts WHERE post_type = 'revision'", ARRAY_A );
1403
- $lengths = 0;
1404
- foreach ($query as $row) {
1405
- $lengths += strlen($row['post_content']);
1406
- }
1407
- _e('Current size of revisions stored in database:', 'wp-edit');
1408
- echo ' <strong>'.number_format($lengths/(1024*1024),3).' mb</strong>';
1409
- ?>
1410
- </td>
1411
- </tr>
1412
- </tbody>
1413
- </table>
1414
- </div>
1415
- </div>
1416
- </div>
1417
-
1418
- <h3><?php _e('Hide Posts and Pages', 'wp-edit'); ?></h3>
1419
- <div class="metabox-holder">
1420
- <div class="postbox">
1421
- <div class="inside">
1422
- <table cellpadding="8">
1423
- <tbody>
1424
- <tr><td><?php _e('Hide Admin Posts', 'wp-edit'); ?></td>
1425
- <td>
1426
- <input type="text" name="hide_admin_posts" value="<?php echo $hide_admin_posts ?>" />
1427
- <label for="hide_admin_posts"><?php _e('Hide selected posts from admin view. ID comma separated (1,5,14,256)', 'wp-edit'); ?></label>
1428
- </td>
1429
- </tr>
1430
- <tr><td><?php _e('Hide Admin Pages', 'wp-edit'); ?></td>
1431
- <td>
1432
- <input type="text" name="hide_admin_pages" value="<?php echo $hide_admin_pages ?>" />
1433
- <label for="hide_admin_pages"><?php _e('Hide selected pages from admin view. ID comma separated (1,5,14,256)', 'wp-edit'); ?></label>
1434
- </td>
1435
- </tr>
1436
- </tbody>
1437
- </table>
1438
- </div>
1439
- </div>
1440
- </div>
1441
- <input type="submit" value="<?php _e('Save Posts/Pages Options', 'wp-edit'); ?>" class="button button-primary" id="submit_posts" name="submit_posts">
1442
- <?php wp_nonce_field( 'wpe_save_posts_pages_opts' ); ?>
1443
- </form>
1444
- <?php
1445
- echo '</div>';
1446
- }
1447
- /*
1448
- ****************************************************************
1449
- Editor Tab
1450
- ****************************************************************
1451
- */
1452
- else if($active_tab == 'editor'){
1453
-
1454
- ?>
1455
- <form method="post" action="">
1456
- <div class="main_container">
1457
-
1458
- <h3><?php _e('Styles Options', 'wp-edit'); ?></h3>
1459
- <div class="metabox-holder">
1460
- <div class="postbox">
1461
- <div class="inside">
1462
- <p style="margin-left:10px;"><?php _e('Adds predefined styles; which can be applied to editor content.', 'wp-edit'); ?><br />
1463
- <?php _e('Please be sure the "Formats" button is active in the editor.', 'wp-edit'); ?></p>
1464
-
1465
- <?php
1466
- $options_editor = get_option('wp_edit_editor');
1467
- $editor_add_pre_styles = isset($options_editor['editor_add_pre_styles']) && $options_editor['editor_add_pre_styles'] === '1' ? 'checked="checked"' : '';
1468
- $default_editor_fontsize_type = isset($options_editor['default_editor_fontsize_type']) ? $options_editor['default_editor_fontsize_type'] : 'pt';
1469
- $default_editor_fontsize_values = isset($options_editor['default_editor_fontsize_values']) ? $options_editor['default_editor_fontsize_values'] : '';
1470
- $bbpress_editor = isset($options_editor['bbpress_editor']) && $options_editor['bbpress_editor'] === '1' ? 'checked="checked"' : '';
1471
- ?>
1472
-
1473
- <table cellpadding="8">
1474
- <tbody>
1475
- <tr><td><?php _e('Add Pre-defined Styles', 'wp-edit'); ?></td>
1476
- <td>
1477
- <input id="editor_add_pre_styles" type="checkbox" value="1" name="editor_add_pre_styles" <?php echo $editor_add_pre_styles; ?> />
1478
- <label for="editor_add_pre_styles"><?php _e('Adds predefined styles to the "Formats" dropdown button.', 'wp-edit'); ?></label>
1479
- </td>
1480
- </tr>
1481
- </tbody>
1482
- </table>
1483
- </div>
1484
- </div>
1485
- </div>
1486
-
1487
- <h3><?php _e('TinyMCE Options', 'wp-edit'); ?></h3>
1488
- <div class="metabox-holder">
1489
- <div class="postbox">
1490
- <div class="inside">
1491
- <p style="margin-left:10px;"><?php _e('These options will adjust various parts of the TinyMCE initialization process.', 'wp-edit'); ?></p>
1492
-
1493
- <table cellpadding="8">
1494
- <tbody>
1495
- <tr><td><?php _e('Dropdown Editor Font-Size Type', 'wp-edit'); ?></td>
1496
- <td>
1497
- <input type="radio" name="default_editor_fontsize_type" value="px" <?php if($default_editor_fontsize_type === 'px') echo 'checked="checked"'; ?> /> <?php _e('px', 'wp-edit'); ?><span style="margin-left:10px;"></span>
1498
- <input type="radio" name="default_editor_fontsize_type" value="pt" <?php if($default_editor_fontsize_type === 'pt') echo 'checked="checked"'; ?> /> <?php _e('pt', 'wp-edit'); ?><span style="margin-left:10px;"></span>
1499
- <input type="radio" name="default_editor_fontsize_type" value="em" <?php if($default_editor_fontsize_type === 'em') echo 'checked="checked"'; ?> /> <?php _e('em', 'wp-edit'); ?><span style="margin-left:10px;"></span>
1500
- <input type="radio" name="default_editor_fontsize_type" value="percent" <?php if($default_editor_fontsize_type === 'percent') echo 'checked="checked"'; ?> /> <?php _e('%', 'wp-edit'); ?><br />
1501
-
1502
- <?php _e('Select the editor font size type displayed in the "Font Size" button dropdown menu.', 'wp-edit'); ?>
1503
- </td>
1504
- </tr>
1505
- <tr><td style="vertical-align:top;"><?php _e('Dropdown Editor Font-Size Type Values', 'wp-edit'); ?></td>
1506
- <td>
1507
- <input type="text" name="default_editor_fontsize_values" value="<?php echo $default_editor_fontsize_values; ?>" /><br />
1508
- <?php _e('Define available font-size values for Font Size dropdown box.', 'wp-edit'); ?><br />
1509
- <?php _e('Values should be space separated; and end with the chosen font size type (selected above).', 'wp-edit'); ?><br />
1510
- <?php _e('For Example: If <strong>em</strong> is selected; possible values could be <strong>1em 1.1em 1.2em</strong> etc.', 'wp-edit'); ?>
1511
- </td>
1512
- </tr>
1513
- </tbody>
1514
- </table>
1515
- </div>
1516
- </div>
1517
- </div>
1518
-
1519
- <h3><?php _e('BBPress Options', 'wp-edit'); ?></h3>
1520
- <div class="metabox-holder">
1521
- <div class="postbox">
1522
- <div class="inside">
1523
-
1524
- <p style="margin-left:10px;"><?php _e('Options for the editor used in the BBPress forums.', 'wp-edit'); ?></p>
1525
-
1526
- <table cellpadding="8">
1527
- <tbody>
1528
- <tr><td><?php _e('Enable Visual BBPRess Editor', 'wp-edit'); ?></td>
1529
- <td>
1530
- <input id="bbpress_editor" type="checkbox" value="1" name="bbpress_editor" <?php echo $bbpress_editor; ?> />
1531
- <label for="bbpress_editor"><?php _e('Replaces default textarea with modified visual editor.', 'wp-edit'); ?></label>
1532
- </td>
1533
- </tr>
1534
- </tbody>
1535
- </table>
1536
- </div>
1537
- </div>
1538
- </div>
1539
- <input type="submit" value="<?php _e('Save Editor Options', 'wp-edit'); ?>" class="button button-primary" id="submit_editor" name="submit_editor">
1540
- <?php wp_nonce_field( 'wpe_save_editor_opts' ); ?>
1541
- </div>
1542
- </form>
1543
- <?php
1544
- }
1545
- /*
1546
- ****************************************************************
1547
- Extras Tab
1548
- ****************************************************************
1549
- */
1550
- else if($active_tab == 'extras') {
1551
-
1552
- ?>
1553
- <form method="post" action="">
1554
- <div class="main_container">
1555
-
1556
- <h3><?php _e('Extra Options', 'wp-edit'); ?></h3>
1557
-
1558
- <div class="metabox-holder">
1559
- <div class="postbox">
1560
- <div class="inside">
1561
-
1562
- <h3><?php _e('Signoff Text', 'wp-edit'); ?></h3>
1563
- <p style="margin-left:10px;"><?php _e('Use the editor below to create a content chunk that can be inserted anywhere using the', 'wp-edit'); ?> <strong>[signoff]</strong> <?php _e('shortcode.', 'wp-edit'); ?></p>
1564
-
1565
- <table cellpadding="8" width="100%">
1566
- <tbody>
1567
- <tr><td>
1568
- <?php
1569
- $options_extras = get_option('wp_edit_extras');
1570
- $content = isset($options_extras['signoff_text']) ? $options_extras['signoff_text'] : 'Please enter text here...';
1571
- $editor_id = 'wp_edit_signoff';
1572
- $args = array('textarea_rows' => 10, 'width' => '100px');
1573
- wp_editor( $content, $editor_id, $args );
1574
- ?>
1575
- </td></tr>
1576
- </tbody>
1577
- </table>
1578
- </div>
1579
- </div>
1580
- </div>
1581
-
1582
- <input type="submit" value="Save Extras Options" class="button button-primary" id="submit_extras" name="submit_extras">
1583
- <?php wp_nonce_field( 'wpe_save_extras_opts' ); ?>
1584
- </div>
1585
- </form>
1586
- <?php
1587
- }
1588
- /*
1589
- ****************************************************************
1590
- User Specific Tab
1591
- ****************************************************************
1592
- */
1593
- else if($active_tab == 'user_specific') {
1594
-
1595
- global $current_user;
1596
- $options_user_meta = get_user_meta($current_user->ID, 'aaa_wp_edit_user_meta', true);
1597
-
1598
- $id_column = isset($options_user_meta['id_column']) && $options_user_meta['id_column'] === '1' ? 'checked="checked"' : '';
1599
- $thumbnail_column = isset($options_user_meta['thumbnail_column']) && $options_user_meta['thumbnail_column'] === '1' ? 'checked="checked"' : '';
1600
- $hide_text_tab = isset($options_user_meta['hide_text_tab']) && $options_user_meta['hide_text_tab'] === '1' ? 'checked="checked"' : '';
1601
- $default_visual_tab = isset($options_user_meta['default_visual_tab']) && $options_user_meta['default_visual_tab'] === '1' ? 'checked="checked"' : '';
1602
- $dashboard_widget = isset($options_user_meta['dashboard_widget']) && $options_user_meta['dashboard_widget'] === '1' ? 'checked="checked"' : '';
1603
-
1604
- $enable_highlights = isset($options_user_meta['enable_highlights']) && $options_user_meta['enable_highlights'] === '1' ? 'checked="checked"' : '';
1605
- $draft_highlight = isset($options_user_meta['draft_highlight']) ? $options_user_meta['draft_highlight'] : '#FFFFFF';
1606
- $pending_highlight = isset($options_user_meta['pending_highlight']) ? $options_user_meta['pending_highlight'] : '#FFFFFF';
1607
- $published_highlight = isset($options_user_meta['published_highlight']) ? $options_user_meta['published_highlight'] : '#FFFFFF';
1608
- $future_highlight = isset($options_user_meta['future_highlight']) ? $options_user_meta['future_highlight'] : '#FFFFFF';
1609
- $private_highlight = isset($options_user_meta['private_highlight']) ? $options_user_meta['private_highlight'] : '#FFFFFF';
1610
- ?>
1611
-
1612
- <form method="post" action="">
1613
- <div class="main_container">
1614
-
1615
- <h3><?php _e('User Specific Options', 'wp-edit'); ?></h3>
1616
- <div class="metabox-holder">
1617
- <div class="postbox">
1618
- <div class="inside">
1619
-
1620
- <p style="margin-left:10px;"><?php _e('These options are stored in individual user meta; meaning each user can set these options independently from one another.', 'wp-edit'); ?></p>
1621
-
1622
- <table cellpadding="8">
1623
- <tbody>
1624
- <tr><td><?php _e('ID Column', 'wp-edit'); ?></td>
1625
- <td>
1626
- <input id="id_column" type="checkbox" value="1" name="wp_edit_user_specific[id_column]" <?php echo $id_column; ?> />
1627
- <label for="id_column"><?php _e('Adds a column to post/page list view for displaying the post/page ID.', 'wp-edit'); ?></label>
1628
- </td>
1629
- </tr>
1630
- <tr><td><?php _e('Thumbnail Column', 'wp-edit'); ?></td>
1631
- <td>
1632
- <input id="thumbnail_column" type="checkbox" value="1" name="wp_edit_user_specific[thumbnail_column]" <?php echo $thumbnail_column; ?> />
1633
- <label for="thumbnail_column"><?php _e('Adds a column to post/page list view for displaying thumbnails.', 'wp-edit'); ?></label>
1634
- </td>
1635
- </tr>
1636
- <tr><td><?php _e('Hide TEXT Tab', 'wp-edit'); ?></td>
1637
- <td>
1638
- <input id="hide_text_tab" type="checkbox" value="1" name="wp_edit_user_specific[hide_text_tab]" <?php echo $hide_text_tab; ?> />
1639
- <label for="hide_text_tab"><?php _e('Hide the editor TEXT tab from view.', 'wp-edit'); ?></label>
1640
- </td>
1641
- </tr>
1642
- <tr><td><?php _e('Default VISUAL Tab', 'wp-edit'); ?></td>
1643
- <td>
1644
- <input id="default_visual_tab" type="checkbox" value="1" name="wp_edit_user_specific[default_visual_tab]" <?php echo $default_visual_tab; ?> />
1645
- <label for="default_visual_tab"><?php _e('Always display VISUAL tab when editor loads.', 'wp-edit'); ?></label>
1646
- </td>
1647
- </tr>
1648
- <tr><td><?php _e('Disable Dashboard Widget', 'wp-edit'); ?></td>
1649
- <td>
1650
- <input id="dashboard_widget" type="checkbox" value="1" name="wp_edit_user_specific[dashboard_widget]" <?php echo $dashboard_widget; ?> />
1651
- <label for="dashboard_widget"><?php _e('Disables WP Edit Pro News Feed dashboard widget.', 'wp-edit'); ?></label>
1652
- </td>
1653
- </tr>
1654
- </tbody>
1655
- </table>
1656
- </div>
1657
- </div>
1658
- </div>
1659
-
1660
- <h3><?php _e('Post/Page Highlight Colors', 'wp-edit'); ?></h3>
1661
- <div class="metabox-holder">
1662
- <div class="postbox">
1663
- <div class="inside">
1664
-
1665
- <p style="margin-left:10px;"><?php _e('These options will allow each user to customize highlight colors for each post/page status.', 'wp-edit'); ?><br />
1666
- <?php _e('Meaning.. saved posts can be yellow, published posts can be blue, etc.', 'wp-edit'); ?></p>
1667
-
1668
- <table cellpadding="8">
1669
- <tbody>
1670
- <tr><td><?php _e('Enable Highlights', 'wp-edit'); ?></td>
1671
- <td>
1672
- <input id="enable_highlights" type="checkbox" value="1" name="wp_edit_user_specific[enable_highlights]" <?php echo $enable_highlights; ?> />
1673
- <label for="enable_highlights"><?php _e('Enable the Highlight Options below.', 'wp-edit'); ?></label>
1674
- </td>
1675
- </tr>
1676
- <tr><td><?php _e('Draft Highlight', 'wp-edit'); ?></td>
1677
- <td class="jwl_user_cell">
1678
- <input id="draft_highlight" type="text" name="wp_edit_user_specific[draft_highlight]" class="color_field" value="<?php echo $draft_highlight; ?>" />
1679
- </td>
1680
- </tr>
1681
- <tr><td><?php _e('Pending Highlight', 'wp-edit'); ?></td>
1682
- <td class="jwl_user_cell">
1683
- <input id="pending_highlight" type="text" name="wp_edit_user_specific[pending_highlight]" class="color_field" value="<?php echo $pending_highlight; ?>" />
1684
- </td>
1685
- </tr>
1686
- <tr><td><?php _e('Published Highlight', 'wp-edit'); ?></td>
1687
- <td class="jwl_user_cell">
1688
- <input id="published_highlight" type="text" name="wp_edit_user_specific[published_highlight]" class="color_field" value="<?php echo $published_highlight; ?>" />
1689
- </td>
1690
- </tr>
1691
- <tr><td><?php _e('Future Highlight', 'wp-edit'); ?></td>
1692
- <td class="jwl_user_cell">
1693
- <input id="future_highlight" type="text" name="wp_edit_user_specific[future_highlight]" class="color_field" value="<?php echo $future_highlight; ?>" />
1694
- </td>
1695
- </tr>
1696
- <tr><td><?php _e('Private Highlight', 'wp-edit'); ?></td>
1697
- <td class="jwl_user_cell">
1698
- <input id="private_highlight" type="text" name="wp_edit_user_specific[private_highlight]" class="color_field" value="<?php echo $private_highlight; ?>" />
1699
- </td>
1700
- </tr>
1701
- </tbody>
1702
- </table>
1703
- </div>
1704
- </div>
1705
- </div>
1706
-
1707
- <input type="submit" value="<?php _e('Save User Specific Options', 'wp-edit'); ?>" class="button button-primary" id="submit_user_specific" name="submit_user_specific">
1708
- <?php wp_nonce_field( 'wpe_save_user_specific_opts' ); ?>
1709
- </div>
1710
- </form><?php
1711
- }
1712
- /*
1713
- ****************************************************************
1714
- Database Tab
1715
- ****************************************************************
1716
- */
1717
- else if($active_tab == 'database') {
1718
- ?>
1719
- <div class="main_container">
1720
-
1721
- <h3><?php _e('Database Options', 'wp-edit'); ?></h3>
1722
-
1723
- <div class="metabox-holder">
1724
-
1725
- <div class="postbox">
1726
- <h3><span><?php _e('Export WP Edit Options', 'wp-edit'); ?></span></h3>
1727
- <div class="inside">
1728
- <p><?php _e('Export the plugin settings for this site as a .json file. This allows you to easily import the configuration into another site.', 'wp-edit'); ?></p>
1729
- <form method="post" action="">
1730
- <p><input type="hidden" name="database_action" value="export_settings" /></p>
1731
- <p>
1732
- <?php wp_nonce_field( 'database_action_export_nonce', 'database_action_export_nonce' ); ?>
1733
- <?php submit_button( __('Export', 'wp-edit'), 'primary', 'submit', false ); ?>
1734
- </p>
1735
- </form>
1736
- </div><!-- .inside -->
1737
- </div><!-- .postbox -->
1738
-
1739
- <div class="postbox">
1740
- <h3><span><?php _e('Import WP Edit Options', 'wp-edit'); ?></span></h3>
1741
- <div class="inside">
1742
- <p><?php _e('Import the plugin settings from a .json file. This file can be obtained by exporting the settings on another site using the form above.', 'wp-edit'); ?></p>
1743
- <form method="post" enctype="multipart/form-data">
1744
- <p><input type="file" name="import_file"/></p>
1745
- <p>
1746
- <input type="hidden" name="database_action" value="import_settings" />
1747
- <?php wp_nonce_field( 'database_action_import_nonce', 'database_action_import_nonce' ); ?>
1748
- <?php submit_button( __('Import', 'wp-edit'), 'primary', 'submit', false ); ?>
1749
- </p>
1750
- </form>
1751
- </div><!-- .inside -->
1752
- </div><!-- .postbox -->
1753
-
1754
- <div class="postbox">
1755
- <h3><span><?php _e('Reset WP Edit Options', 'wp-edit'); ?></span></h3>
1756
- <div class="inside">
1757
- <p><?php _e('Reset all plugin settings to their original default states.', 'wp-edit'); ?></p>
1758
- <form method="post" action="">
1759
- <?php wp_nonce_field( 'reset_db_values_nonce', 'reset_db_values_nonce' ); ?>
1760
- <input class="button-primary reset_db_values" name="reset_db_values" type="submit" style="display:none;" />
1761
- <input class="button-primary reset_db_values_confirm" name="reset_db_values_confirm" type="button" value="<?php _e('Reset', 'wp-edit'); ?>" />
1762
- </p>
1763
- </form>
1764
- </div><!-- .inside -->
1765
- </div><!-- .postbox -->
1766
-
1767
- <div class="postbox">
1768
- <h3><span><?php _e('Uninstall WP Edit (Completely)', 'wp-edit'); ?></span></h3>
1769
- <div class="inside">
1770
- <p><?php _e('Designed by intention, this plugin will not delete the associated database tables when activating and deactivating.', 'wp-edit'); ?><br />
1771
- <?php _e('This ensures the data is kept safe when troubleshooting other WordPress conflicts.', 'wp-edit'); ?><br />
1772
- <?php _e('In order to completely uninstall the plugin, AND remove all associated database tables, please use the option below.', 'wp-edit'); ?><br />
1773
- </p>
1774
- <form method="post" action="">
1775
- <?php wp_nonce_field('wp_edit_uninstall_nonce_check', 'wp_edit_uninstall_nonce'); ?>
1776
- <input id="plugin" name="plugin" type="hidden" value="wp-edit/main.php" />
1777
- <input name="uninstall_confirm" id="uninstall_confirm" type="checkbox" value="1" /><label for="uninstall_confirm"></label> <strong><?php _e('Please confirm before proceeding','wp-edit'); ?><br /><br /></strong>
1778
- <input class="button-primary" name="uninstall" type="submit" value="<?php _e('Uninstall','wp-edit'); ?>" />
1779
- </form>
1780
- </div><!-- .inside -->
1781
- </div><!-- .postbox -->
1782
-
1783
- </div><!-- .metabox-holder -->
1784
- </div><!-- .main_container -->
1785
- <?php
1786
- }
1787
- /*
1788
- ****************************************************************
1789
- About Tab
1790
- ****************************************************************
1791
- */
1792
- else if($active_tab == 'about') {
1793
-
1794
- // Get mysql version number (scrape php_info module)
1795
- ob_start();
1796
- phpinfo(INFO_MODULES);
1797
- $info = ob_get_contents();
1798
- ob_end_clean();
1799
- $info = stristr($info, 'Client API version');
1800
- preg_match('/[1-9].[0-9].[1-9][0-9]/', $info, $match);
1801
- $sql_version = $match[0];
1802
-
1803
- // Get plugin info
1804
- $url = WPEDIT_PLUGIN_PATH.'main.php';
1805
- $plugin_data = get_plugin_data( $url );
1806
-
1807
- global $wp_version;
1808
-
1809
- echo '<div class="main_container">';
1810
-
1811
- ?>
1812
- <h3><?php _e('Information','wp-edit'); ?></h3>
1813
-
1814
- <div class="metabox-holder">
1815
- <div class="postbox">
1816
- <div class="inside">
1817
-
1818
- <p><?php _e('Plugin and server version information.', 'wp-edit'); ?></p>
1819
-
1820
- <table class="table table-bordered" cellpadding="3" style="width:50%;">
1821
- <tbody>
1822
- <tr><td><?php _e('WP Edit Pro Version:','wp-edit'); ?></td>
1823
- <td>
1824
- <?php echo $plugin_data['Version']; ?>
1825
- </td>
1826
- </tr>
1827
- <tr><td><?php _e('WordPress Version:','wp-edit'); ?></td>
1828
- <td>
1829
- <?php echo $wp_version; ?>
1830
- </td>
1831
- </tr>
1832
- <tr><td><?php _e('PHP Version:','wp-edit'); ?></td>
1833
- <td>
1834
- <?php echo phpversion(); ?>
1835
- </td>
1836
- </tr>
1837
- <tr><td><?php _e('HTML Version:','wp-edit'); ?></td>
1838
- <td>
1839
- <span class="wpep_html_version"></span>
1840
- </td>
1841
- </tr>
1842
- <tr><td><?php _e('MySql Version:','wp-edit'); ?></td>
1843
- <td>
1844
- <?php echo $sql_version; ?>
1845
- </td>
1846
- </tr>
1847
- <tr><td><?php _e('jQuery Version:','wp-edit'); ?></td>
1848
- <td>
1849
- <?php echo $GLOBALS['wp_scripts']->registered['jquery-core']->ver; ?>
1850
- </td>
1851
- </tr>
1852
- </tbody>
1853
- </table>
1854
- </div>
1855
- </div>
1856
- </div>
1857
-
1858
- <h3><?php _e('Support','wp-edit'); ?></h3>
1859
- <div class="metabox-holder">
1860
- <div class="postbox">
1861
- <div class="inside">
1862
-
1863
- <p><?php _e('Please use the following helpful links for plugin support.', 'wp-edit'); ?></p>
1864
-
1865
- <table class="table table-bordered" cellpadding="3" style="width:30%;">
1866
- <tbody>
1867
- <tr><td><?php _e('Support Forum:','wp-edit'); ?></td>
1868
- <td>
1869
- <?php echo '<a target="_blank" href="https://wordpress.org/support/plugin/wp-edit">'.__('Support Forum', 'wp-edit').'</a>'; ?>
1870
- </td>
1871
- </tr>
1872
- <tr><td><?php _e('Knowledge Base:','wp-edit'); ?></td>
1873
- <td>
1874
- <?php echo '<a target="_blank" href="http://learn.wpeditpro.com">'.__('Knowledge Base', 'wp-edit').'</a>'; ?>
1875
- </td>
1876
- </tr>
1877
- </tbody>
1878
- </table>
1879
- </div>
1880
- </div>
1881
- </div>
1882
-
1883
- <h3><?php _e('Documentation','wp-edit'); ?></h3>
1884
- <div class="metabox-holder">
1885
- <div class="postbox">
1886
- <div class="inside">
1887
-
1888
- <p><?php _e('Remember, complete plugin documentation can be found on our <a target="_blank" href="http://learn.wpeditpro.com">Knowledge Base</a>.', 'wp-edit'); ?></p>
1889
- <p><?php _e('Visit the <a target="_blank" href="http://learn.wpeditpro.com/category/plugin-options/">Knowledge Base Plugin Options</a> page to get started.','wp-edit'); ?></p>
1890
- </div>
1891
- </div>
1892
- </div>
1893
- <?php
1894
- echo '</div>';
1895
- }
1896
- ?>
1897
- </div><!-- .wrap -->
1898
-
1899
- <div id="right_column_metaboxes">
1900
-
1901
- <div class="main_container">
1902
- <h3><?php _e('WP Edit Pro', 'wp-edit'); ?></h3>
1903
- <div class="metabox-holder">
1904
- <div class="postbox">
1905
- <div class="inside">
1906
-
1907
- <p><?php _e('Upgrade to WP Edit Pro today; and enjoy additional options such as:', 'wp-edit'); ?></p>
1908
- <ul class="wpep_pro_upgrade_list">
1909
- <li><span class="dashicons dashicons-yes"></span><?php _e('4 customizable button rows instead of only 2.', 'wp-edit'); ?></li>
1910
- <li><span class="dashicons dashicons-yes"></span><?php _e('Create multiple button arrangements.', 'wp-edit'); ?></li>
1911
- <li><span class="dashicons dashicons-yes"></span><?php _e('Limit users over what buttons they can access.', 'wp-edit'); ?></li>
1912
- <li><span class="dashicons dashicons-yes"></span><?php _e('Powerful "Snidget" Builder.', 'wp-edit'); ?></li>
1913
- <li><span class="dashicons dashicons-yes"></span><?php _e('Over 30 additional options and settings.', 'wp-edit'); ?></li>
1914
- <li><span class="dashicons dashicons-yes"></span><?php _e('Over a dozen additional editor buttons (Image maps, YouTube Videos, and many more!).', 'wp-edit'); ?></li>
1915
- </ul>
1916
- <a href="https://wpeditpro.com" target="_blank" class="button-primary"><?php _e('WP Edit Pro', 'wp-edit'); ?></a>
1917
- </div>
1918
- </div>
1919
- </div>
1920
- </div>
1921
-
1922
- <div class="main_container">
1923
- <h3><?php _e('Like this Plugin?', 'wp-edit'); ?></h3>
1924
- <div class="metabox-holder">
1925
- <div class="postbox">
1926
- <div class="inside">
1927
-
1928
- <p><?php _e('Please take a moment to rate and review this plugin on the WordPress Plugin Repository.', 'wp-edit'); ?></p>
1929
- <p><a href="https://wordpress.org/plugins/wp-edit/" target="_blank" class="button-primary"><?php _e('Rate Plugin', 'wp-edit'); ?></a></p>
1930
-
1931
- <?php
1932
- if ( ! function_exists( 'plugins_api' ) ) {
1933
- require_once( ABSPATH . 'wp-admin/includes/plugin-install.php' );
1934
- }
1935
-
1936
- /** Prepare our query */
1937
- $call_api = plugins_api( 'plugin_information', array( 'slug' => 'wp-edit', 'fields' => array( 'active_installs' => true ) ) );
1938
-
1939
- /** Check for Errors & Display the results */
1940
- if ( is_wp_error( $call_api ) ) {
1941
-
1942
- echo '<pre>' . print_r( $call_api->get_error_message(), true ) . '</pre>';
1943
- }
1944
- else {
1945
-
1946
- echo '<h3>';
1947
- _e( 'WP Edit Rating Statistics', 'wp_edit_pro' );
1948
- echo '</h3>';
1949
-
1950
- // Get ratings array
1951
- $ratings = $call_api->ratings;
1952
-
1953
- echo '<table><tbody>';
1954
- echo '<tr><td>Downloaded:</td><td>' . number_format( $call_api->downloaded ) . ' times</td></tr>';
1955
- echo '<tr><td>Active Installs:</td><td>' . number_format( $call_api->active_installs ) . '+</td></tr>';
1956
- echo '<tr><td>Number of Ratings:</td><td>' . $call_api->num_ratings . '</td></tr>';
1957
- echo '</tbody></table>';
1958
- echo '<br />';
1959
-
1960
- // Calculations
1961
- $total_ratings = $call_api->num_ratings;
1962
-
1963
- $five_star = round( ( $ratings[5] / $total_ratings ) * 100 );
1964
- $four_star = round( ( $ratings[4] / $total_ratings ) * 100 );
1965
- $three_star = round( ( $ratings[3] / $total_ratings ) * 100 );
1966
- $two_star = round( ( $ratings[2] / $total_ratings ) * 100 );
1967
- $one_star = round( ( $ratings[1] / $total_ratings ) * 100 );
1968
-
1969
- $overall_stars = number_format( ( $call_api->rating / 20 ), 1 );
1970
-
1971
- // Setup plugin star container
1972
- echo '<div class="plugin_star_container">';
1973
- echo '<div class="empty-stars"></div>';
1974
- echo '<div class="full-stars" style="width:' . $call_api->rating . '%"></div>';
1975
- echo '</div>';
1976
-
1977
- echo '<p style="margin:0px 0px 10px;">' . $overall_stars . ' out of 5 stars</p>';
1978
-
1979
- // Setup plugin rating table
1980
- echo '<table class="table table_plugin_ratings"><tbody>';
1981
- echo '<tr><td>5 stars:</td><td><div class="plugin_rating_container"><div class="plugin_rating_percentage" style="width:' . $five_star . '%;"></div></div>' . $ratings[5] . '</td></tr>';
1982
- echo '<tr><td>4 stars:</td><td><div class="plugin_rating_container"><div class="plugin_rating_percentage" style="width:' . $four_star . '%;"></div></div>' . $ratings[4] . '</td></tr>';
1983
- echo '<tr><td>3 stars:</td><td><div class="plugin_rating_container"><div class="plugin_rating_percentage" style="width:' . $three_star . '%;"></div></div>' . $ratings[3] . '</td></tr>';
1984
- echo '<tr><td>2 stars:</td><td><div class="plugin_rating_container"><div class="plugin_rating_percentage" style="width:' . $two_star . '%;"></div></div>' . $ratings[2] . '</td></tr>';
1985
- echo '<tr><td>1 star:</td><td><div class="plugin_rating_container"><div class="plugin_rating_percentage" style="width:' . $one_star . '%;"></div></div>' . $ratings[1] . '</td></tr>';
1986
- echo '</tbody></table>';
1987
- }
1988
- ?>
1989
-
1990
- </div>
1991
- </div>
1992
- </div>
1993
- </div>
1994
- </div>
1995
-
1996
- <div style="clear:both;"></div>
1997
- <?php
1998
- }
1999
-
2000
-
2001
- /*
2002
- ****************************************************************
2003
- Load/Save Page
2004
- ****************************************************************
2005
- */
2006
- public function load_page() {
2007
-
2008
- /*
2009
- ****************************************************************
2010
- If Import Settings was successful... let's alert a message
2011
- ****************************************************************
2012
- */
2013
- if(isset($_GET['import']) && $_GET['import'] === 'true') {
2014
-
2015
- echo '<div id="message" class="updated"><p>';
2016
- _e('Plugin settings have been successfully imported.' ,'wp-edit');
2017
- echo '</p></div>';
2018
- }
2019
-
2020
- /*
2021
- ****************************************************************
2022
- If Buttons Tab options are submitted
2023
- ****************************************************************
2024
- */
2025
- if(isset($_POST['wpep_reset_buttons'])) {
2026
-
2027
- // Verify nonce
2028
- $buttons_opts_nonce = $_REQUEST['_wpnonce'];
2029
- if ( ! wp_verify_nonce( $buttons_opts_nonce, 'wpe_save_buttons_opts' ) ) {
2030
-
2031
- echo 'This request could not be verified.';
2032
- exit;
2033
- }
2034
-
2035
- // Check if DB value exists.. if YES, then keep value.. if NO, then replace with protected defaults
2036
- $options_buttons = $this->global_options_buttons;
2037
-
2038
- // Set DB values
2039
- update_option('wp_edit_buttons', $options_buttons);
2040
-
2041
- // Alert user
2042
- function wpe_reset_buttons_from_input(){
2043
-
2044
- echo '<div class="updated">';
2045
- echo '<p>';
2046
- _e('Buttons have been reset successfully.','wp-edit');
2047
- echo '</p>';
2048
- echo '</div>';
2049
- }
2050
- add_action('admin_notices', 'wpe_reset_buttons_from_input');
2051
- }
2052
-
2053
- if(isset($_POST['wpep_save_buttons'])) {
2054
-
2055
- // Verify nonce
2056
- $buttons_opts_nonce = $_REQUEST['_wpnonce'];
2057
- if ( ! wp_verify_nonce( $buttons_opts_nonce, 'wpe_save_buttons_opts' ) ) {
2058
-
2059
- echo 'This request could not be verified.';
2060
- exit;
2061
- }
2062
-
2063
- if(isset($_POST['get_sorted_array_results']) && ($_POST['get_sorted_array_results'] != '')) {
2064
-
2065
- //***************************************************
2066
- // Get buttons from hidden div and update database
2067
- //***************************************************
2068
- $post_buttons = $_POST['get_sorted_array_results'];
2069
- $final_button_array = array();
2070
-
2071
- // Explode first set of containers (breaks into "toolbar1:bold,italic,etc."
2072
- $explode_containers = explode('*', $post_buttons);
2073
-
2074
- // Loop each container
2075
- foreach($explode_containers as $container) {
2076
-
2077
- // Get rid of first container (empty)
2078
- if($container != '') {
2079
-
2080
- // Explode each container
2081
- $explode_each_container = explode(':', $container);
2082
- // Replace commas (from js array) with spaces
2083
- $explode_each_container = str_replace(',', ' ', $explode_each_container);
2084
-
2085
- // Push key (container) and value (buttons) to final array
2086
- $final_button_array[$explode_each_container[0]] = $explode_each_container[1];
2087
- }
2088
- }
2089
-
2090
- // Update database buttons
2091
- update_option('wp_edit_buttons', $final_button_array);
2092
-
2093
- // Alert user
2094
- function wpe_save_buttons_from_input(){
2095
-
2096
- echo '<div class="updated">';
2097
- echo '<p>';
2098
- _e('Buttons have been saved successfully.','wp-edit');
2099
- echo '</p>';
2100
- echo '</div>';
2101
- }
2102
- add_action('admin_notices', 'wpe_save_buttons_from_input');
2103
- }
2104
-
2105
- //***************************************************
2106
- // Check for new buttons
2107
- //***************************************************
2108
- /*** Get page buttons ***/
2109
- $buttons = '';
2110
- $active_buttons = $_POST['get_sorted_array_results']; // Get each button container value (string)
2111
- $explode1 = explode('*', $active_buttons); // Explode into button containers (toolbar1:bold,italic,etc)
2112
- $final_buttons = '';
2113
-
2114
- foreach($explode1 as $value) {
2115
-
2116
- $explode2 = explode(':', $value); // Explodes from (toolbar1:bold,italic,link,etc)
2117
- $button_string = isset($explode2[1]) ? $explode2[1] : ''; // Get second array item (buttons (comma separated))
2118
-
2119
- if(!empty($button_string)) { // If the buttons string is not empty
2120
-
2121
- $final_buttons .= $button_string.','; // Create long string of comma separated butttons
2122
- }
2123
- }
2124
-
2125
- // Right trim comma from string
2126
- $final_buttons = rtrim($final_buttons, ',');
2127
-
2128
- // Create array of all buttons on page ((bold)(italic)(etc))
2129
- $page_array = array_filter(explode(',', $final_buttons));
2130
-
2131
-
2132
- /*** Get default buttons ***/
2133
- // Get all buttons from initialization code (including any new buttons)
2134
- $new_wp_edit_class_buttons = new wp_edit_class();
2135
- $options_buttons = $new_wp_edit_class_buttons->global_options_buttons;
2136
- $buttons_option = '';
2137
-
2138
- // Loop each container and extract buttons
2139
- foreach($options_buttons as $option) {
2140
-
2141
- $buttons_option .= ' ' . $option; // The list of initialization buttons (as string)
2142
- }
2143
-
2144
- // Trim whitespace from left of $buttons_option string (space separated)
2145
- $buttons_option = ltrim($buttons_option);
2146
-
2147
- // Explode space separated string into array
2148
- $buttons_option_array = array_filter(explode(' ', $buttons_option));
2149
-
2150
- /*** Compare arrays ***/
2151
- $array_diff = array_diff($buttons_option_array, $page_array);
2152
-
2153
- // If new buttons were discovered
2154
- if(!empty($array_diff)) {
2155
-
2156
- // Get each button name from array difference
2157
- global $each_button_trim;
2158
- $each_button = '';
2159
- foreach($array_diff as $button) { // Loop array to get each button name
2160
-
2161
- $each_button .= ' '.$button;
2162
- }
2163
- // Remove white space from far left of string
2164
- $each_button_trim = ltrim($each_button);
2165
-
2166
-
2167
- // Get buttons option and append new buttons to tmce container
2168
- $db_buttons = get_option('wp_edit_buttons');
2169
- $db_buttons['tmce_container'] = $db_buttons['tmce_container'].$each_button;
2170
-
2171
- // Update database
2172
- update_option('wp_edit_buttons', $db_buttons);
2173
-
2174
- // Alert user
2175
- function wpe_alert_user_new_buttons() {
2176
-
2177
- global $each_button_trim;
2178
- echo '<div id="message" class="updated"><p>';
2179
- _e('New buttons were discovered. The following buttons have been added to the Button Container:','wp-edit');
2180
- echo '<br /><strong>'.$each_button_trim.'</strong>';
2181
- echo '</p></div>';
2182
- }
2183
- add_action('admin_notices', 'wpe_alert_user_new_buttons');
2184
- }
2185
-
2186
- //*************************************************************************************************
2187
- // Check saved database buttons against plugin default buttons.
2188
- // - Will remove any buttons from rows if they are no longer supported by plugin.
2189
- //*************************************************************************************************
2190
-
2191
- // Get user saved buttons
2192
- $options_buttons = get_option('wp_edit_buttons');
2193
- // Get default plugin buttons
2194
- $new_wp_edit_class_buttons = new wp_edit_class();
2195
- $plugin_buttons = $new_wp_edit_class_buttons->global_options_buttons;
2196
-
2197
- // Merge all default plugin buttons into single array
2198
- $all_array = '';
2199
- foreach($plugin_buttons as $slot_array) {
2200
-
2201
- if(!empty($slot_array) && $slot_array != '') { // Skip containter array if empty
2202
- $all_array .= $slot_array.' '; // Create single string of all default plugin buttons
2203
- }
2204
- }
2205
- $all_array = rtrim($all_array, ' '); // Remove trailing right space
2206
- $plugin_array = explode(' ', $all_array); // Explode at spaces to make single array (this is an array of all current plugin buttons)
2207
-
2208
-
2209
- // Get filtered plugin buttons
2210
- $get_filters = $this->filtered_buttons;
2211
-
2212
- // If the array set is not empty (filters being applied)
2213
- if( ! empty( $get_filters ) ) {
2214
- foreach( $get_filters as $key => $values ) {
2215
-
2216
- $plugin_array[] = $values['button_id'];
2217
- }
2218
- }
2219
-
2220
-
2221
-
2222
- // Create arrays of user saved buttons
2223
- global $tot_array;
2224
- $val_array = array();
2225
- $tot_array = array(); // Used to display results to user
2226
- foreach($options_buttons as $cont=>$val) { // Break down array
2227
-
2228
- if(!empty($val) && $val !='') { // Skip container if empty
2229
- $val_array = explode(' ', $val); // Explode at spaces into array (this is multiarray of each container array of user buttons)
2230
-
2231
- $rem_array = array(); // Setup removal array
2232
- foreach($val_array as $item) {
2233
- if(!in_array($item, $plugin_array)) {
2234
- // Removed array items
2235
- $rem_array[] = $item;
2236
- $tot_array[] = $item;
2237
- }
2238
- }
2239
-
2240
- if($rem_array) {
2241
-
2242
- $old_opts = $options_buttons[$cont]; // Get option from database values
2243
- $old_opts = explode(' ', $old_opts); // Explode to array
2244
- $new_opt_array = array_diff($old_opts, $rem_array); // Compare arrays to remove non-supported buttons
2245
- $new_opt_array = implode(' ', $new_opt_array); // Implode back to string
2246
- $options_buttons[$cont] = $new_opt_array; // Set container to new string
2247
-
2248
- // Update buttons options
2249
- update_option('wp_edit_buttons', $options_buttons);
2250
-
2251
- function wpe_remove_buttons_notice() {
2252
-
2253
- global $tot_array;
2254
- echo '<div class="updated"><p>';
2255
- $tot_array = implode(', ', $tot_array);
2256
- _e('The following buttons have been removed from WP Edit Pro:', 'wp-edit');
2257
- echo '<br />';
2258
- echo '<strong>'.$tot_array.'</strong>';
2259
- echo '</p></div>';
2260
- }
2261
- add_action('admin_notices', 'wpe_remove_buttons_notice');
2262
- }
2263
- }
2264
- }
2265
- }
2266
-
2267
-
2268
- /*
2269
- ****************************************************************
2270
- If Global Tab button was submitted
2271
- ****************************************************************
2272
- */
2273
- if(isset($_POST['submit_global'])) {
2274
-
2275
- // Verify nonce
2276
- $global_opts_nonce = $_REQUEST['_wpnonce'];
2277
- if ( ! wp_verify_nonce( $global_opts_nonce, 'wpe_save_global_opts' ) ) {
2278
-
2279
- echo 'This request could not be verified.';
2280
- exit;
2281
- }
2282
-
2283
- $options_global = get_option('wp_edit_global');
2284
- $options_global['jquery_theme'] = isset($_POST['jquery_theme']) ? $_POST['jquery_theme'] : 'smoothness';
2285
- $options_global['disable_admin_links'] = isset($_POST['disable_admin_links']) ? '1' : '0';
2286
- $options_global['disable_fancy_tooltips'] = isset($_POST['disable_fancy_tooltips']) ? '1' : '0';
2287
-
2288
- update_option('wp_edit_global', $options_global);
2289
-
2290
- function global_saved_notice(){
2291
-
2292
- echo '<div class="updated"><p>';
2293
- _e('Global options successfully saved.', 'wp-edit');
2294
- echo '</p></div>';
2295
- }
2296
- add_action('admin_notices', 'global_saved_notice');
2297
- }
2298
-
2299
- /*
2300
- ****************************************************************
2301
- If General Tab button was submitted
2302
- ****************************************************************
2303
- */
2304
- if(isset($_POST['submit_general'])) {
2305
-
2306
- // Verify nonce
2307
- $general_opts_nonce = $_REQUEST['_wpnonce'];
2308
- if ( ! wp_verify_nonce( $general_opts_nonce, 'wpe_save_general_opts' ) ) {
2309
-
2310
- echo 'This request could not be verified.';
2311
- exit;
2312
- }
2313
-
2314
- $options_general = get_option('wp_edit_general');
2315
- $options_general['linebreak_shortcode'] = isset($_POST['linebreak_shortcode']) ? '1' : '0';
2316
- $options_general['shortcodes_in_widgets'] = isset($_POST['shortcodes_in_widgets']) ? '1' : '0';
2317
- $options_general['shortcodes_in_excerpts'] = isset($_POST['shortcodes_in_excerpts']) ? '1' : '0';
2318
- $options_general['post_excerpt_editor'] = isset($_POST['post_excerpt_editor']) ? '1' : '0';
2319
- $options_general['page_excerpt_editor'] = isset($_POST['page_excerpt_editor']) ? '1' : '0';
2320
- $options_general['profile_editor'] = isset($_POST['profile_editor']) ? '1' : '0';
2321
-
2322
- // Save cpt excerpts
2323
- $cpt_excerpts = array();
2324
- $options_general['cpt_excerpt_editor'] = array();
2325
-
2326
- if(isset($_POST['cpt_excerpt_editor'])) {
2327
-
2328
- $cpt_excerpts = $_POST['cpt_excerpt_editor'];
2329
-
2330
- // Loop checked cpt's and create array
2331
- foreach($cpt_excerpts as $key => $value) {
2332
-
2333
- if($value === 'on')
2334
- $options_general['cpt_excerpt_editor'][] = $key;
2335
- }
2336
- }
2337
- else {
2338
- $options_general['cpt_excerpt_editor'] = array();
2339
- }
2340
-
2341
- update_option('wp_edit_general', $options_general);
2342
-
2343
- function general_saved_notice(){
2344
-
2345
- echo '<div class="updated"><p>';
2346
- _e('General options successfully saved.', 'wp-edit');
2347
- echo '</p></div>';
2348
- }
2349
- add_action('admin_notices', 'general_saved_notice');
2350
- }
2351
-
2352
- /*
2353
- ****************************************************************
2354
- If Posts Tab button was submitted
2355
- ****************************************************************
2356
- */
2357
- if(isset($_POST['submit_posts'])) {
2358
-
2359
- // Verify nonce
2360
- $posts_pages_opts_nonce = $_REQUEST['_wpnonce'];
2361
- if ( ! wp_verify_nonce( $posts_pages_opts_nonce, 'wpe_save_posts_pages_opts' ) ) {
2362
-
2363
- echo 'This request could not be verified.';
2364
- exit;
2365
- }
2366
-
2367
- // Delete database revisions
2368
- if(isset($_POST['submit_posts']) && isset($_POST['delete_revisions'])) {
2369
-
2370
- function wp_edit_delete_revisions_admin_notice( ){
2371
-
2372
- global $wpdb;
2373
-
2374
- // Get pre DB size
2375
- $query = $wpdb->get_results( "SHOW TABLE STATUS", ARRAY_A );
2376
- $size = 0;
2377
- foreach ($query as $row) {
2378
- $size += $row["Data_length"] + $row["Index_length"];
2379
- }
2380
- $decimals = 2;
2381
- $mbytes = number_format($size/(1024*1024),$decimals);
2382
-
2383
- // Delete Post Revisions from DB
2384
- $query3_raw = "DELETE FROM wp_posts WHERE post_type = 'revision'";
2385
- $query3 = $wpdb->query($query3_raw);
2386
- if ($query3) {
2387
- $deleted_rows = __('Revisions successfully deleted', 'wp-edit');
2388
- } else {
2389
- $deleted_rows = __('No POST revisions were found to delete', 'wp-edit');
2390
- }
2391
-
2392
- // Get post DB size
2393
- $query2 = $wpdb->get_results( "SHOW TABLE STATUS", ARRAY_A );
2394
- $size2 = 0;
2395
- foreach ($query2 as $row2) {
2396
- $size2 += $row2["Data_length"] + $row2["Index_length"];
2397
- }
2398
- $decimals2 = 2;
2399
- $mbytes2 = number_format($size2/(1024*1024),$decimals2);
2400
-
2401
- echo '<div class="updated"><p>';
2402
- _e('Message: ', 'wp-edit');
2403
- echo '<strong>'.$deleted_rows.'</strong>.</p><p>';
2404
- _e('Database size before deletions: ', 'wp-edit');
2405
- echo '<strong>'.$mbytes.'</strong> ';
2406
- _e('megabytes.', 'wp-edit');
2407
- echo '</p><p>';
2408
- _e('Database Size after deletions: ', 'wp-edit');
2409
- echo '<strong>'.$mbytes2.'</strong> ';
2410
- _e('megabytes.', 'wp-edit');
2411
- echo '</p></div>';
2412
- }
2413
- add_action('admin_notices', 'wp_edit_delete_revisions_admin_notice');
2414
- }
2415
-
2416
- $options_posts = get_option('wp_edit_posts');
2417
-
2418
- $options_posts['post_title_field'] = isset($_POST['post_title_field']) ? sanitize_text_field($_POST['post_title_field']) : 'Enter title here';
2419
- $options_posts['column_shortcodes'] = isset($_POST['column_shortcodes']) ? '1' : '0';
2420
- $options_posts['disable_wpautop'] = isset($_POST['disable_wpautop']) ? '1' : '0';
2421
-
2422
- $options_posts['max_post_revisions'] = isset($_POST['max_post_revisions']) ? sanitize_text_field($_POST['max_post_revisions']) : '';
2423
- $options_posts['max_page_revisions'] = isset($_POST['max_page_revisions']) ? sanitize_text_field($_POST['max_page_revisions']) : '';
2424
-
2425
- $options_posts['hide_admin_posts'] = isset($_POST['hide_admin_posts']) ? sanitize_text_field($_POST['hide_admin_posts']) : '';
2426
- $options_posts['hide_admin_pages'] = isset($_POST['hide_admin_pages']) ? sanitize_text_field($_POST['hide_admin_pages']) : '';
2427
-
2428
- update_option('wp_edit_posts', $options_posts);
2429
-
2430
- function posts_saved_notice(){
2431
-
2432
- echo '<div class="updated"><p>';
2433
- _e('Posts/Pages options successfully saved.', 'wp-edit');
2434
- echo '</p></div>';
2435
- }
2436
- add_action('admin_notices', 'posts_saved_notice');
2437
- }
2438
-
2439
- /*
2440
- ****************************************************************
2441
- If Editor button was submitted
2442
- ****************************************************************
2443
- */
2444
- if(isset($_POST['submit_editor'])) {
2445
-
2446
- // Verify nonce
2447
- $editor_opts_nonce = $_REQUEST['_wpnonce'];
2448
- if ( ! wp_verify_nonce( $editor_opts_nonce, 'wpe_save_editor_opts' ) ) {
2449
-
2450
- echo 'This request could not be verified.';
2451
- exit;
2452
- }
2453
-
2454
- $options_editor = get_option('wp_edit_editor');
2455
-
2456
- $options_editor['editor_add_pre_styles'] = isset($_POST['editor_add_pre_styles']) ? '1' : '0';
2457
- $options_editor['default_editor_fontsize_type'] = isset($_POST['default_editor_fontsize_type']) ? $_POST['default_editor_fontsize_type'] : 'pt';
2458
- $options_editor['default_editor_fontsize_values'] = isset($_POST['default_editor_fontsize_values']) ? sanitize_text_field($_POST['default_editor_fontsize_values']) : '';
2459
- $options_editor['bbpress_editor'] = isset($_POST['bbpress_editor']) ? '1' : '0';
2460
-
2461
- update_option('wp_edit_editor', $options_editor);
2462
-
2463
- function editor_saved_notice(){
2464
-
2465
- echo '<div class="updated"><p>';
2466
- _e('Editor options successfully saved.', 'wp-edit');
2467
- echo '</p></div>';
2468
- }
2469
- add_action('admin_notices', 'editor_saved_notice');
2470
- }
2471
-
2472
- /*
2473
- ****************************************************************
2474
- If Extras Tab button was submitted
2475
- ****************************************************************
2476
- */
2477
- if(isset($_POST['submit_extras'])) {
2478
-
2479
- // Verify nonce
2480
- $extras_opts_nonce = $_REQUEST['_wpnonce'];
2481
- if ( ! wp_verify_nonce( $extras_opts_nonce, 'wpe_save_extras_opts' ) ) {
2482
-
2483
- echo 'This request could not be verified.';
2484
- exit;
2485
- }
2486
-
2487
- $options_extras = get_option('wp_edit_extras');
2488
- $options_extras['signoff_text'] = isset($_POST['wp_edit_signoff']) ? stripslashes($_POST['wp_edit_signoff']) : 'Please enter text here...';
2489
-
2490
- update_option('wp_edit_extras', $options_extras);
2491
-
2492
- function extras_saved_notice(){
2493
-
2494
- echo '<div class="updated"><p>';
2495
- _e('Extra options saved.', 'wp-edit');
2496
- echo '</p></div>';
2497
- }
2498
- add_action('admin_notices', 'extras_saved_notice');
2499
- }
2500
-
2501
- /*
2502
- ****************************************************************
2503
- If user specific was submitted
2504
- ****************************************************************
2505
- */
2506
- if(isset($_POST['submit_user_specific'])) {
2507
-
2508
- // Verify nonce
2509
- $user_specific_opts_nonce = $_REQUEST['_wpnonce'];
2510
- if ( ! wp_verify_nonce( $user_specific_opts_nonce, 'wpe_save_user_specific_opts' ) ) {
2511
-
2512
- echo 'This request could not be verified.';
2513
- exit;
2514
- }
2515
-
2516
- // If User Specific was submitted
2517
- $post_vars = isset($_POST['wp_edit_user_specific']) ? $_POST['wp_edit_user_specific'] : '';
2518
-
2519
- global $current_user;
2520
- $options_user_specific_user_meta = get_user_meta($current_user->ID, 'aaa_wp_edit_user_meta', true);
2521
-
2522
- $options_user_specific_user_meta['id_column'] = isset($post_vars['id_column']) ? '1' : '0';
2523
- $options_user_specific_user_meta['thumbnail_column'] = isset($post_vars['thumbnail_column']) ? '1' : '0';
2524
- $options_user_specific_user_meta['hide_text_tab'] = isset($post_vars['hide_text_tab']) ? '1' : '0';
2525
- $options_user_specific_user_meta['default_visual_tab'] = isset($post_vars['default_visual_tab']) ? '1' : '0';
2526
- $options_user_specific_user_meta['dashboard_widget'] = isset($post_vars['dashboard_widget']) ? '1' : '0';
2527
-
2528
- $options_user_specific_user_meta['enable_highlights'] = isset($post_vars['enable_highlights']) ? '1' : '0';
2529
- $options_user_specific_user_meta['draft_highlight'] = isset($post_vars['draft_highlight']) ? $post_vars['draft_highlight'] : '';
2530
- $options_user_specific_user_meta['pending_highlight'] = isset($post_vars['pending_highlight']) ? $post_vars['pending_highlight'] : '';
2531
- $options_user_specific_user_meta['published_highlight'] = isset($post_vars['published_highlight']) ? $post_vars['published_highlight'] : '';
2532
- $options_user_specific_user_meta['future_highlight'] = isset($post_vars['future_highlight']) ? $post_vars['future_highlight'] : '';
2533
- $options_user_specific_user_meta['private_highlight'] = isset($post_vars['private_highlight']) ? $post_vars['private_highlight'] : '';
2534
-
2535
- update_user_meta($current_user->ID, 'aaa_wp_edit_user_meta', $options_user_specific_user_meta);
2536
-
2537
- function user_specific_saved_notice(){
2538
-
2539
- echo '<div class="updated"><p>';
2540
- _e('User specific options saved.', 'wp-edit');
2541
- echo '</p></div>';
2542
- }
2543
- add_action('admin_notices', 'user_specific_saved_notice');
2544
- }
2545
-
2546
- /*
2547
- ****************************************************************
2548
- If reset plugin options
2549
- ****************************************************************
2550
- */
2551
- if (isset($_POST['reset_db_values'])) {
2552
-
2553
- if ( !isset($_POST['reset_db_values_nonce'])) { // Verify nonce
2554
-
2555
- print __('Sorry, your nonce did not verify.', 'wp-edit');
2556
- exit;
2557
- }
2558
- else {
2559
-
2560
- // Get current user
2561
- global $current_user;
2562
-
2563
- // Set DB values (from class vars)
2564
- update_option('wp_edit_buttons', $this->global_options_buttons);
2565
- update_option('wp_edit_global', $this->global_options_global);
2566
- update_option('wp_edit_general', $this->global_options_general);
2567
- update_option('wp_edit_posts', $this->global_options_posts);
2568
- update_option('wp_edit_editor', $this->global_options_editor);
2569
- update_option('wp_edit_extras', $this->global_options_extras);
2570
- update_user_meta($current_user->ID, 'aaa_wp_edit_user_meta', $this->global_options_user_specific);
2571
-
2572
- echo '<div id="message" class="updated"><p>';
2573
- _e('Plugin settings have been restored to defaults.', 'wp-edit');
2574
- echo '</p></div>';
2575
- }
2576
- }
2577
-
2578
- /*
2579
- ****************************************************************
2580
- If uninstall plugin was submitted
2581
- ****************************************************************
2582
- */
2583
- // Display notice if trying to uninstall but forget to check box
2584
- if (isset($_POST['uninstall'] ) && !isset($_POST['uninstall_confirm'])) {
2585
-
2586
- echo '<div id="message" class="error"><p>';
2587
- _e('You must also check the confirm box before options will be uninstalled and deleted.','wp-edit');
2588
- echo '</p></div>';
2589
- }
2590
- // Uninstall plugin
2591
- if (isset($_POST['uninstall'], $_POST['uninstall_confirm'] ) ) {
2592
-
2593
- if ( !isset($_POST['wp_edit_uninstall_nonce']) || !wp_verify_nonce($_POST['wp_edit_uninstall_nonce'],'wp_edit_uninstall_nonce_check') ) { // Verify nonce
2594
-
2595
- print __('Sorry, your nonce did not verify.', 'wp-edit');
2596
- exit;
2597
- }
2598
- else {
2599
-
2600
- global $current_user;
2601
- delete_option('wp_edit_buttons','wp_edit_buttons');
2602
- delete_option('wp_edit_global','wp_edit_global');
2603
- delete_option('wp_edit_general','wp_edit_general');
2604
- delete_option('wp_edit_posts','wp_edit_posts');
2605
- delete_option('wp_edit_editor','wp_edit_editor');
2606
- delete_option('wp_edit_extras','wp_edit_extras');
2607
- delete_option('wp_edit_install','wp_edit_install');
2608
- delete_user_meta($current_user->ID, 'aaa_wp_edit_user_meta');
2609
- delete_user_meta($current_user->ID, 'ignore_wpedit_ag_notice');
2610
-
2611
- // Deactivate the plugin
2612
- $current = get_option('active_plugins');
2613
- array_splice($current, array_search( $_POST['plugin'], $current), 1 );
2614
- update_option('active_plugins', $current);
2615
-
2616
- // Redirect to plugins page with 'plugin deactivated' status message
2617
- wp_redirect( admin_url('/plugins.php?deactivate=true') );
2618
- exit;
2619
- }
2620
- }
2621
- }
2622
-
2623
- /*
2624
- ****************************************************************
2625
- Admin Init
2626
- ****************************************************************
2627
- */
2628
- public function process_activation_redirect() {
2629
-
2630
- // Check for redirect option after plugin activation
2631
- $re_url = admin_url('admin.php?page=wp_edit_options');
2632
- if (get_option('wp_edit_activation_redirect', false)) {
2633
-
2634
- delete_option('wp_edit_activation_redirect');
2635
- wp_redirect($re_url);
2636
- }
2637
- }
2638
-
2639
- /*
2640
- ****************************************************************
2641
- Export Options
2642
- ****************************************************************
2643
- */
2644
- public function process_settings_export() {
2645
-
2646
- if( empty( $_POST['database_action'] ) || 'export_settings' != $_POST['database_action'] )
2647
- return;
2648
-
2649
- if( ! wp_verify_nonce( $_POST['database_action_export_nonce'], 'database_action_export_nonce' ) )
2650
- return;
2651
-
2652
- if( ! current_user_can( 'manage_options' ) )
2653
- return;
2654
-
2655
- // Get DB values
2656
- global $current_user;
2657
-
2658
- $options_buttons = get_option('wp_edit_buttons');
2659
- $options_global = get_option('wp_edit_global');
2660
- $options_general = get_option('wp_edit_general');
2661
- $options_posts = get_option('wp_edit_posts');
2662
- $options_editor = get_option('wp_edit_editor');
2663
- $options_extras = get_option('wp_edit_extras');
2664
- $options_user_specific = get_user_meta($current_user->ID, 'aaa_wp_edit_user_meta', true);
2665
-
2666
- $options_export_array = array(
2667
- 'wp_edit_buttons' => $options_buttons,
2668
- 'wp_edit_global' => $options_global,
2669
- 'wp_edit_general' => $options_general,
2670
- 'wp_edit_posts' => $options_posts,
2671
- 'wp_edit_editor' => $options_editor,
2672
- 'wp_edit_extras' => $options_extras,
2673
- 'wp_edit_user_specific' => $options_user_specific
2674
- );
2675
-
2676
- ignore_user_abort( true );
2677
-
2678
- nocache_headers();
2679
- header( 'Content-Type: application/json; charset=utf-8' );
2680
- header( 'Content-Disposition: attachment; filename=wp_edit_settings_export-' . date( 'm-d-Y' ) . '.json' );
2681
- header( "Expires: 0" );
2682
-
2683
- echo json_encode( $options_export_array );
2684
- exit;
2685
- }
2686
-
2687
- /*
2688
- ****************************************************************
2689
- Import Options
2690
- ****************************************************************
2691
- */
2692
- public function process_settings_import() {
2693
-
2694
- if( empty( $_POST['database_action'] ) || 'import_settings' != $_POST['database_action'] )
2695
- return;
2696
-
2697
- if( ! wp_verify_nonce( $_POST['database_action_import_nonce'], 'database_action_import_nonce' ) )
2698
- return;
2699
-
2700
- if( ! current_user_can( 'manage_options' ) )
2701
- return;
2702
-
2703
- $extension = end( explode( '.', $_FILES['import_file']['name'] ) );
2704
-
2705
- if( $extension != 'json' ) {
2706
- wp_die( __('Please upload a valid .json file', 'wp-edit' ) );
2707
- }
2708
-
2709
- $import_file = $_FILES['import_file']['tmp_name'];
2710
-
2711
- if( empty( $import_file ) ) {
2712
- wp_die( __('Please upload a file to import', 'wp-edit') );
2713
- }
2714
-
2715
- global $current_user;
2716
-
2717
- // Retrieve the settings from the file and convert the json object to an array.
2718
- $settings = (array) json_decode( file_get_contents( $import_file ), true );
2719
- foreach ($settings as $key => $value) {
2720
-
2721
- // First update user meta
2722
- if($key === 'wp_edit_user_specific') {
2723
-
2724
- $value = (array) $value;
2725
- update_user_meta($current_user->ID, 'aaa_wp_edit_user_meta', $value);
2726
- }
2727
- // Else update other options
2728
- else {
2729
-
2730
- $value = (array) $value;
2731
- update_option($key, $value);
2732
- }
2733
- }
2734
-
2735
- // Redirect to database page with added parameter = true
2736
- wp_safe_redirect( admin_url( 'admin.php?page=wp_edit_options&tab=database&import=true' ) );
2737
- exit;
2738
- }
2739
-
2740
- /*
2741
- ****************************************************************
2742
- Before wp tinymce
2743
- ****************************************************************
2744
- */
2745
- public function before_wp_tiny_mce() {
2746
-
2747
- // Add WP dashicons css file to editor
2748
- echo '<link rel="stylesheet" type="text/css" href="'.plugins_url().'/wp-edit/css/tinymce_dashicons.css" />';
2749
- }
2750
-
2751
- /*
2752
- ****************************************************************
2753
- Tinymce before init
2754
- ****************************************************************
2755
- */
2756
- public function wp_edit_tiny_mce_before_init($init) {
2757
-
2758
- // Initialize table ability
2759
- if (isset($init['tools'])) {
2760
- $init['tools'] = $init['tools'].',inserttable';
2761
- } else {
2762
- $init['tools'] = 'inserttable';
2763
- }
2764
-
2765
- // Get editor default fontsize type value
2766
- $opts_editor = get_option('wp_edit_editor');
2767
- $default_editor_fontsize_type = isset($opts_editor['default_editor_fontsize_type']) ? $opts_editor['default_editor_fontsize_type'] : 'pt';
2768
-
2769
- // Pass values to editor initialization
2770
- if($default_editor_fontsize_type === 'px') {
2771
-
2772
- $new_px = isset($opts_editor['default_editor_fontsize_values']) && !empty($opts_editor['default_editor_fontsize_values']) ? $opts_editor['default_editor_fontsize_values'] : '6px 8px 9px 10px 11px 12px 13px 14px 15px 16px 18px 20px 22px 24px 28px 32px 48px 72px';
2773
-
2774
- if(isset($init['fontsize_formats'])) {
2775
- $init['fontsize_formats'] = $init['fontsize_formats'].' '.$new_px;
2776
- } else {
2777
- $init['fontsize_formats'] = $new_px;
2778
- }
2779
- }
2780
- else if($default_editor_fontsize_type === 'pt') {
2781
-
2782
- $new_pt = isset($opts_editor['default_editor_fontsize_values']) && !empty($opts_editor['default_editor_fontsize_values']) ? $opts_editor['default_editor_fontsize_values'] : '6pt 8pt 10pt 12pt 14pt 16pt 18pt 20pt 22pt 24pt 26pt 28pt 30pt 32pt 34pt 36pt 48pt 72pt';
2783
-
2784
- if(isset($init['fontsize_formats'])) {
2785
- $init['fontsize_formats'] = $init['fontsize_formats'].' '.$new_pt;
2786
- } else {
2787
- $init['fontsize_formats'] = $new_pt;
2788
- }
2789
- }
2790
- else if($default_editor_fontsize_type === 'em') {
2791
-
2792
- $new_em = isset($opts_editor['default_editor_fontsize_values']) && !empty($opts_editor['default_editor_fontsize_values']) ? $opts_editor['default_editor_fontsize_values'] : '.8em 1em 1.2em 1.4em 1.6em 1.8em 2em';
2793
-
2794
- if(isset($init['fontsize_formats'])) {
2795
- $init['fontsize_formats'] = $init['fontsize_formats'].' '.$new_em;
2796
- } else {
2797
- $init['fontsize_formats'] = $new_em;
2798
- }
2799
- }
2800
- else if($default_editor_fontsize_type === 'percent') {
2801
-
2802
- $new_percent = isset($opts_editor['default_editor_fontsize_values']) && !empty($opts_editor['default_editor_fontsize_values']) ? $opts_editor['default_editor_fontsize_values'] : '80% 90% 100% 110% 120%';
2803
-
2804
- if(isset($init['fontsize_formats'])) {
2805
- $init['fontsize_formats'] = $init['fontsize_formats'].' '.$new_percent;
2806
- } else {
2807
- $init['fontsize_formats'] = $new_percent;
2808
- }
2809
- }
2810
-
2811
- /*
2812
- ****************************************************************
2813
- Additional initalization if disable wpautop is true for the post
2814
- ****************************************************************
2815
- */
2816
- // Get post id and meta
2817
- $post_id = get_the_ID();
2818
- $post_meta = get_post_meta($post_id);
2819
- $dis_wpautop = isset($post_meta['_jwl_disable_wpautop']) && !empty($post_meta['_jwl_disable_wpautop']) ? $post_meta['_jwl_disable_wpautop'] : false;
2820
-
2821
- // Only initialize if the disable wpautop option is enabled in the post meta
2822
- if ($dis_wpautop != false) {
2823
-
2824
- $init['wpautop'] = false;
2825
- $init['indent'] = true;
2826
- $init['wpep_noautop'] = true;
2827
- }
2828
-
2829
- return $init;
2830
- }
2831
-
2832
- /*
2833
- ****************************************************************
2834
- Tinymce init
2835
- ****************************************************************
2836
- */
2837
- public function wp_edit_init_tinymce() {
2838
-
2839
-
2840
- $options_buttons = get_option( 'wp_edit_buttons', $this->global_options_buttons );
2841
- $default_opts = $this->global_options_buttons;
2842
-
2843
-
2844
- // Define plugin array of database options for comparison
2845
- $new_array = '';
2846
- foreach($options_buttons as $slot_array) {
2847
-
2848
- if(!empty($slot_array) && $slot_array != '') { // Skip containter array if empty
2849
- $new_array .= $slot_array.' '; // Create single string of all default plugin buttons
2850
- }
2851
- }
2852
- $new_array = rtrim($new_array, ' '); // Remove trailing right space
2853
- $new_plugin_array = explode(' ', $new_array); // Explode at spaces to make single array (this is an array of all current plugin buttons)
2854
- $this->new_plugin_array = $new_plugin_array;
2855
-
2856
-
2857
- // Define plugin array of default buttons for comparison
2858
- $default_array = '';
2859
- foreach($default_opts as $slot_array) {
2860
-
2861
- if(!empty($slot_array) && $slot_array != '') { // Skip containter array if empty
2862
- $default_array .= $slot_array.' '; // Create single string of all default plugin buttons
2863
- }
2864
- }
2865
- $default_array = rtrim($default_array, ' '); // Remove trailing right space
2866
- $default_buttons_array = explode(' ', $default_array); // Explode at spaces to make single array (this is an array of all current plugin buttons)
2867
- $this->default_buttons_array = $default_buttons_array;
2868
-
2869
-
2870
- // Get filtered plugin buttons array
2871
- $filtered_plugin_buttons = array();
2872
- $get_filters = $this->filtered_buttons;
2873
- // If the array set is not empty (filters being applied)
2874
- if( ! empty( $get_filters ) ) {
2875
- foreach( $get_filters as $key => $values ) {
2876
-
2877
- $filtered_plugin_buttons[] = $values['button_id'];
2878
- }
2879
- }
2880
- $this->filtered_plugin_buttons = $filtered_plugin_buttons;
2881
-
2882
-
2883
-
2884
- // Build extra plugins array
2885
- add_filter('mce_external_plugins', array($this, 'wp_edit_mce_external_plugins'));
2886
-
2887
- // Get options and set appropriate tinymce toolbars
2888
- foreach ((array)$options_buttons as $key => $value) {
2889
-
2890
- // Magic is happening right here...
2891
- if($key == 'tmce_container') { return; }
2892
- if($key == 'toolbar1') { add_filter('mce_buttons', array($this, 'wp_edit_add_mce')); }
2893
- if($key == 'toolbar2') { add_filter('mce_buttons_2', array($this, 'wp_edit_add_mce_2')); }
2894
- }
2895
- }
2896
-
2897
- /*
2898
- ****************************************************************
2899
- Tinymce external plugins
2900
- ****************************************************************
2901
- */
2902
- public function wp_edit_mce_external_plugins($plugins) {
2903
-
2904
- $options_buttons = get_option('wp_edit_buttons');
2905
-
2906
- // Build array of all button names found in active toolbars
2907
- $final_options = array();
2908
- $final_options = array_merge(explode(' ', $options_buttons['toolbar1']), explode(' ', $options_buttons['toolbar2']));
2909
-
2910
- $plugins['table'] = plugins_url() . '/wp-edit/plugins/table/plugin.min.js';
2911
-
2912
- if(in_array('ltr', $final_options) || in_array('rtl', $final_options)) {
2913
- $plugins['directionality'] = plugins_url() . '/wp-edit/plugins/directionality/plugin.min.js';
2914
- }
2915
- if(in_array('anchor', $final_options)) {
2916
- $plugins['anchor'] = plugins_url() . '/wp-edit/plugins/anchor/plugin.min.js';
2917
- }
2918
- if(in_array('code', $final_options)) {
2919
- $plugins['code'] = plugins_url() . '/wp-edit/plugins/code/plugin.min.js';
2920
- }
2921
- if(in_array('emoticons', $final_options)) {
2922
- $plugins['emoticons'] = plugins_url() . '/wp-edit/plugins/emoticons/plugin.min.js';
2923
- }
2924
- if(in_array('hr', $final_options)) {
2925
- $plugins['hr'] = plugins_url() . '/wp-edit/plugins/hr/plugin.min.js';
2926
- }
2927
- if(in_array('inserttime', $final_options)) {
2928
- $plugins['insertdatetime'] = plugins_url() . '/wp-edit/plugins/insertdatetime/plugin.min.js';
2929
- }
2930
- if(in_array('preview', $final_options)) {
2931
- $plugins['preview'] = plugins_url() . '/wp-edit/plugins/preview/plugin.min.js';
2932
- }
2933
- if(in_array('print', $final_options)) {
2934
- $plugins['print'] = plugins_url() . '/wp-edit/plugins/print/plugin.min.js';
2935
- }
2936
- if(in_array('searchreplace', $final_options)) {
2937
- $plugins['searchreplace'] = plugins_url() . '/wp-edit/plugins/searchreplace/plugin.min.js';
2938
- }
2939
- if(in_array('visualblocks', $final_options)) {
2940
- $plugins['visualblocks'] = plugins_url() . '/wp-edit/plugins/visualblocks/plugin.min.js';
2941
- }
2942
- if(in_array('image_orig', $final_options)) {
2943
- $plugins['image_orig'] = plugins_url() . '/wp-edit/plugins/image_orig/plugin.min.js';
2944
- }
2945
- if(in_array('advlink', $final_options)) {
2946
- $plugins['advlink'] = plugins_url() . '/wp-edit/plugins/advlink/plugin.js';
2947
- }
2948
- if(in_array('acheck', $final_options)) {
2949
- $plugins['acheck'] = plugins_url() . '/wp-edit/plugins/acheck/plugin.js';
2950
- }
2951
- if(in_array('abbr', $final_options)) {
2952
- $plugins['abbr'] = plugins_url() . '/wp-edit/plugins/abbr/plugin.js';
2953
- }
2954
- if(in_array('columnShortcodes', $final_options)) {
2955
- $plugins['columnShortcodes'] = plugins_url() . '/wp-edit/plugins/columnShortcodes/plugin.js';
2956
- }
2957
- if(in_array('nonbreaking', $final_options)) {
2958
- $plugins['nonbreaking'] = plugins_url() . '/wp-edit/plugins/nonbreaking/plugin.min.js';
2959
- }
2960
- if(in_array('eqneditor', $final_options)) {
2961
- $plugins['eqneditor'] = plugins_url() . '/wp-edit/plugins/eqneditor/plugin.min.js';
2962
- }
2963
-
2964
- //*** Tinymce filter if disable wpautop is true for the post ***//
2965
- // Get post id and meta
2966
- $post_id = get_the_ID();
2967
- $post_meta = get_post_meta($post_id);
2968
- $dis_wpautop = isset($post_meta['_jwl_disable_wpautop']) && !empty($post_meta['_jwl_disable_wpautop']) ? $post_meta['_jwl_disable_wpautop'] : false;
2969
-
2970
- // Only filter if the disable wpautop option is enabled in the post meta
2971
- if ($dis_wpautop != false) {
2972
-
2973
- // Custom editor code to process content html
2974
- $plugins['wpep_noautop'] = plugins_url() . '/wp-edit/plugins/wpep_noautop/plugin.js';
2975
- }
2976
-
2977
- return $plugins;
2978
- }
2979
-
2980
- /*
2981
- ****************************************************************
2982
- Tinymce mce buttons
2983
- ****************************************************************
2984
- */
2985
- public function wp_edit_add_mce($buttons) {
2986
-
2987
- $options = get_option('wp_edit_buttons');
2988
- $options_toolbar1 = $options['toolbar1'];
2989
- $default_wp_array_toolbar1 = array('bold','italic','strikethrough','bullist','numlist','blockquote','hr','alignleft','aligncenter','alignright','link','unlink','wp_more');
2990
- $array_back = array();
2991
-
2992
- $new_plugin_array = $this->new_plugin_array;
2993
- $default_buttons_array = $this->default_buttons_array;
2994
- $filtered_plugin_buttons = $this->filtered_plugin_buttons;
2995
-
2996
- // First, we explode the toolbar in the database
2997
- $options_toolbar1 = explode(' ', $options_toolbar1);
2998
-
2999
- // Next, we get the difference between ($options['toolbar1']) and ($buttons)
3000
- $array_diff = array_diff($buttons, $options_toolbar1);
3001
-
3002
- // Now, we take the array and loop it to find original buttons
3003
- if($array_diff) {
3004
-
3005
- foreach($array_diff as $array) {
3006
-
3007
- // If the button is NOT in the original array (WP buttons), we know it is another plugin or theme button..
3008
- if( !in_array( $array, $default_wp_array_toolbar1 ) && !in_array( $array, $new_plugin_array ) ) {
3009
-
3010
- // Create the new array of additional buttons to pass back to end of toolbar
3011
- $array_back[] = $array;
3012
- }
3013
- }
3014
- }
3015
-
3016
- // Loop each saved toolbar button
3017
- foreach( $options_toolbar1 as $key => $value ) {
3018
-
3019
- // If button is not a default button (it is a filtered button); and not in filtered plugin buttons (the button was removed when plugin deactivated)
3020
- if( !in_array( $value, $default_buttons_array ) && !in_array( $value, $filtered_plugin_buttons ) ) {
3021
-
3022
- unset( $options_toolbar1[$key]);
3023
- }
3024
- }
3025
-
3026
- // Merge the difference onto the end of our saved buttons
3027
- $merge_buttons = array_merge($options_toolbar1, $array_back);
3028
-
3029
- return $merge_buttons;
3030
- }
3031
- public function wp_edit_add_mce_2($buttons) {
3032
-
3033
- $options = get_option('wp_edit_buttons');
3034
- $options_toolbar2 = $options['toolbar2'];
3035
- $default_wp_array_toolbar2 = array('formatselect','underline','alignjustify','forecolor','pastetext','removeformat','charmap','outdent','indent','undo','redo','wp_help');
3036
- $array_back = array();
3037
-
3038
- $new_plugin_array = $this->new_plugin_array;
3039
- $default_buttons_array = $this->default_buttons_array;
3040
- $filtered_plugin_buttons = $this->filtered_plugin_buttons;
3041
-
3042
- // First, we explode the toolbar in the database
3043
- $options_toolbar2 = explode(' ', $options_toolbar2);
3044
-
3045
- // Next, we get the difference between ($options['toolbar1']) and ($buttons)
3046
- $array_diff = array_diff($buttons, $options_toolbar2);
3047
-
3048
- // Now, we take the array and loop it to find original buttons
3049
- if($array_diff) {
3050
-
3051
- foreach($array_diff as $array) {
3052
-
3053
- // If the button is NOT in the original array (WP buttons), we know it is another plugin or theme button..
3054
- if( !in_array( $array, $default_wp_array_toolbar2 ) && !in_array( $array, $new_plugin_array ) ) {
3055
-
3056
- // Create the new array of additional buttons to pass back to end of toolbar
3057
- $array_back[] = $array;
3058
- }
3059
- }
3060
- }
3061
-
3062
- // Loop each saved toolbar button
3063
- foreach( $options_toolbar2 as $key => $value ) {
3064
-
3065
- // If button is not a default button (it is a filtered button); and not in filtered plugin buttons (the button was removed when plugin deactivated)
3066
- if( !in_array( $value, $default_buttons_array ) && !in_array( $value, $filtered_plugin_buttons ) ) {
3067
-
3068
- unset( $options_toolbar2[$key]);
3069
- }
3070
- }
3071
-
3072
- // Merge the difference onto the end of our saved buttons
3073
- $merge_buttons = array_merge($options_toolbar2, $array_back);
3074
-
3075
- return $merge_buttons;
3076
- }
3077
-
3078
- public function htlmedit_pre($content) {
3079
-
3080
- // Get post id and meta
3081
- $post_id = get_the_ID();
3082
- $post_meta = get_post_meta($post_id);
3083
- $dis_wpautop = isset($post_meta['_jwl_disable_wpautop']) && !empty($post_meta['_jwl_disable_wpautop']) ? $post_meta['_jwl_disable_wpautop'] : false;
3084
-
3085
- // Only filter if the disable wpautop option is enabled in the post meta
3086
- if ($dis_wpautop != false) {
3087
-
3088
- $content = str_replace( array('&amp;', '&lt;', '&gt;'), array('&', '<', '>'), $content );
3089
- $content = wpautop( $content );
3090
- $content = preg_replace( '/^<p>(https?:\/\/[^<> "]+?)<\/p>$/im', '$1', $content );
3091
- $content = htmlspecialchars( $content, ENT_NOQUOTES, get_option( 'blog_charset' ) );
3092
- }
3093
- return $content;
3094
- }
3095
-
3096
- /*
3097
- ****************************************************************
3098
- Plugin update message
3099
- ****************************************************************
3100
- */
3101
- public function wpedit_plugin_update_cb($plugin_data, $r) {
3102
-
3103
- $admin_email = get_option('admin_email');
3104
-
3105
- echo '<br /><br />';
3106
- echo '<div style="border:1px solid black;border-radius:10px;">';
3107
-
3108
- echo '<div style="width:30%;padding:10px;float:left;">';
3109
- echo '<h3>'; _e('Stay Informed', 'wp-edit'); echo '</h3>';
3110
- _e('Signup to our free <a target="_blank" href="http://www.feedblitz.com/f/?Sub=950320">Feedblitz</a> service; to receive important plugin news, updates and discount offers for our Pro version.', 'wp-edit');
3111
- echo '<br /><br />';
3112
- echo 'Email:<br /><input id="wpedit_feedblitz_signup_email" name="EMAIL" type="text" value="'.$admin_email.'" style="width:50%;margin-right:10px;" /><input id="wpedit_feedblitz_signup" type="button" value="Subscribe me! &raquo;" class="button-primary" />';
3113
- echo '</div>';
3114
-
3115
- echo '<div style="width:30%;padding:10px;float:left;margin-left:20px;">';
3116
- echo '<h3>'; _e('Other Plugin News', 'wp-edit'); echo '</h3>';
3117
- _e('* Plugin documentation is being added to our <a target="_blank" href="http://learn.wpeditpro.com">Knowledge Base</a>. Check back frequently for more tutorial articles.', 'wp-edit');
3118
- echo '</div>';
3119
-
3120
- echo '<div style="clear:both;"></div>';
3121
- echo '</div>';
3122
- }
3123
- public function wpedit_plugin_update_js() {
3124
-
3125
- global $pagenow;
3126
- if($pagenow == 'plugins.php') {
3127
-
3128
- echo "<script language='javascript'>
3129
- jQuery(document).ready(function($) {
3130
-
3131
- $('#wpedit_feedblitz_signup').click(function() {
3132
-
3133
- feed_email = $('#wpedit_feedblitz_signup_email').val();
3134
- window.open('http://www.feedblitz.com/f/?Sub=950320&Email='+feed_email);
3135
- });
3136
- });
3137
- </script>";
3138
- }
3139
- }
3140
-
3141
- }
3142
- $wp_edit_class = new wp_edit_class();
3143
-
3144
-
3145
-
3146
- /*
3147
- ****************************************************************
3148
- Include Plugin Functions
3149
- ****************************************************************
3150
- */
3151
- include 'includes/functions.php';
3152
-
3153
-
3154
- /*
3155
- ****************************************************************
3156
- Include functions for running predefined styles
3157
- ****************************************************************
3158
- */
3159
- include 'includes/style_formats.php';
3160
-
3161
-
3162
- /*
3163
- ****************************************************************
3164
- Pointers Class
3165
- ****************************************************************
3166
- */
3167
- class wpe_admin_pointers {
3168
-
3169
- public function __construct() {
3170
-
3171
- add_action('admin_enqueue_scripts', array($this, 'custom_admin_pointers_header'));
3172
- }
3173
-
3174
- public function custom_admin_pointers_header() {
3175
-
3176
- if ($this->custom_admin_pointers_check()) {
3177
-
3178
- add_action('admin_print_footer_scripts', array($this, 'custom_admin_pointers_footer'));
3179
-
3180
- wp_enqueue_script('wp-pointer');
3181
- wp_enqueue_style('wp-pointer');
3182
- }
3183
- }
3184
-
3185
- public function custom_admin_pointers_check() {
3186
-
3187
- $admin_pointers = $this->custom_admin_pointers();
3188
- foreach ( $admin_pointers as $pointer => $array ) {
3189
- if ( $array['active'] )
3190
- return true;
3191
- }
3192
- }
3193
-
3194
- public function custom_admin_pointers_footer() {
3195
-
3196
- $admin_pointers = $this->custom_admin_pointers();
3197
- ?>
3198
- <script type="text/javascript">
3199
- /* <![CDATA[ */
3200
- ( function($) {
3201
- <?php
3202
- foreach ( $admin_pointers as $pointer => $array ) {
3203
- if ( $array['active'] ) {
3204
- ?>
3205
- $('<?php echo $array['anchor_id']; ?>').pointer({
3206
- content: '<?php echo $array['content']; ?>',
3207
- position: {
3208
- edge: '<?php echo $array['edge']; ?>',
3209
- align: '<?php echo $array['align']; ?>'
3210
- },
3211
- close: function() {
3212
- $.post(ajaxurl, {
3213
- pointer: '<?php echo $pointer; ?>',
3214
- action: 'dismiss-wp-pointer'
3215
- });
3216
- }
3217
- }).pointer('open');
3218
- <?php
3219
- }
3220
- }
3221
- ?>
3222
- } )(jQuery);
3223
- /* ]]> */
3224
- </script>
3225
- <?php
3226
- }
3227
-
3228
- public function custom_admin_pointers() {
3229
-
3230
- $dismissed = explode( ',', (string) get_user_meta( get_current_user_id(), 'dismissed_wp_pointers', true ) );
3231
- $version = '1_0'; // replace all periods in 1.0 with an underscore
3232
- $prefix = 'wpe_admin_pointers_' . $version . '_';
3233
-
3234
- $new_pointer_content = '<h3>' . __( 'WP Edit Tip' ) . '</h3>';
3235
- $new_pointer_content .= '<p>' . __( 'If only one row of buttons is visible; try clicking the <a target="_blank" href="http://learn.wpeditpro.com/wordpress-tinymce-editor/#ipt_kb_toc_73_6">"Toolbar Toggle"</a> button to expand/collapse additional editor button rows.' ) . '</p>';
3236
-
3237
- return array(
3238
- $prefix . 'toggle_toolbar' => array(
3239
- 'content' => $new_pointer_content,
3240
- 'anchor_id' => '#wp-content-editor-container',
3241
- 'edge' => 'bottom',
3242
- 'align' => 'top',
3243
- 'active' => ( ! in_array( $prefix . 'toggle_toolbar', $dismissed ) )
3244
- )
3245
- );
3246
- }
3247
- }
3248
- //Initiate admin pointers
3249
- $wpe_admin_pointers = new wpe_admin_pointers();
3250
-
3251
  ?>
1
+ <?php
2
+ /**
3
+ * Plugin Name: WP Edit
4
+ * Plugin URI: https://wpeditpro.com
5
+ * Description: Ultimate WordPress Content Editing.
6
+ * Version: 4.0.3
7
+ * Author: Josh Lobe
8
+ * Author URI: https://wpeditpro.com
9
+ * License: GPL2
10
+ * Text Domain: wp-edit
11
+ * Domain Path: /langs
12
+ */
13
+
14
+ /*
15
+ ****************************************************************
16
+ Define plugin url
17
+ ****************************************************************
18
+ */
19
+ define('WPEDIT_PLUGIN_URL', plugins_url('', __FILE__).'/');
20
+ define('WPEDIT_PLUGIN_PATH', plugin_dir_path(__FILE__));
21
+
22
+
23
+ /*
24
+ ****************************************************************
25
+ Begin Plugin Class
26
+ ****************************************************************
27
+ */
28
+ class wp_edit_class {
29
+
30
+ /*
31
+ ****************************************************************
32
+ Define WP Edit Plugin Options
33
+ ****************************************************************
34
+ */
35
+ public $global_options_buttons = array(
36
+ 'toolbar1' => 'bold italic strikethrough bullist numlist blockquote alignleft aligncenter alignright link unlink wp_more hr',
37
+ 'toolbar2' => 'formatselect underline alignjustify forecolor pastetext removeformat charmap outdent indent undo redo wp_help',
38
+ 'toolbar3' => '',
39
+ 'toolbar4' => '',
40
+ 'tmce_container' => 'fontselect fontsizeselect styleselect backcolor media rtl ltr table anchor code emoticons inserttime wp_page preview print searchreplace visualblocks subscript superscript image_orig advlink acheck abbr columnShortcodes nonbreaking eqneditor'
41
+ );
42
+ public $global_options_global = array(
43
+ 'jquery_theme' => 'smoothness',
44
+ 'disable_admin_links' => '0',
45
+ 'disable_fancy_tooltips' => '0'
46
+ );
47
+ public $global_options_general = array(
48
+ 'linebreak_shortcode' => '0',
49
+ 'shortcodes_in_widgets' => '0',
50
+ 'shortcodes_in_excerpts' => '0',
51
+ 'post_excerpt_editor' => '0',
52
+ 'page_excerpt_editor' => '0',
53
+ 'profile_editor' => '0',
54
+ 'cpt_excerpt_editor' => array()
55
+ );
56
+ public $global_options_posts = array(
57
+ 'post_title_field' => 'Enter title here',
58
+ 'max_post_revisions' => '',
59
+ 'max_page_revisions' => '',
60
+ 'delete_revisions' => '0',
61
+ 'hide_admin_posts' => '',
62
+ 'hide_admin_pages' => '',
63
+ 'disable_wpautop' => '0',
64
+ 'column_shortcodes' => '0'
65
+ );
66
+ public $global_options_editor = array(
67
+ 'editor_add_pre_styles' => '0',
68
+ 'default_editor_fontsize_type' => 'pt',
69
+ 'default_editor_fontsize_values' => '',
70
+ 'bbpress_editor' => '0'
71
+ );
72
+ public $global_options_extras = array(
73
+ 'signoff_text' => 'Please enter text here...'
74
+ );
75
+ public $global_options_user_specific = array(
76
+ 'id_column' => '0',
77
+ 'thumbnail_column' => '0',
78
+ 'hide_text_tab' => '0',
79
+ 'default_visual_tab' => '0',
80
+ 'dashboard_widget' => '0',
81
+ 'enable_highlights' => '0',
82
+
83
+ 'draft_highlight' => '#FFFFFF',
84
+ 'pending_highlight' => '#FFFFFF',
85
+ 'published_highlight' => '#FFFFFF',
86
+ 'future_highlight' => '#FFFFFF',
87
+ 'private_highlight' => '#FFFFFF'
88
+ );
89
+
90
+ // Prepare global settings array (for future use)
91
+ public $wpedit_options_array = array();
92
+
93
+ public $filtered_buttons = array();
94
+ public $new_plugin_array = array();
95
+ public $default_buttons_array = array();
96
+ public $filtered_plugin_buttons = array();
97
+
98
+ /*
99
+ ****************************************************************
100
+ Class construct
101
+ ****************************************************************
102
+ */
103
+ public function __construct() {
104
+
105
+ register_activation_hook( __FILE__, array( $this, 'plugin_activate' ) ); // Plugin activation hook
106
+
107
+ add_action('plugins_loaded', array($this, 'wp_edit_load_translation')); // Language localization
108
+
109
+ add_filter('plugin_action_links_'.plugin_basename(__FILE__), array($this, 'plugin_settings_link')); // Set plugin settings links
110
+
111
+ add_action('admin_init', array($this, 'upgrade_notice')); // Dismissable upgrade notice
112
+
113
+ add_action('admin_menu', array($this, 'add_page')); // Register main admin page
114
+ add_action('admin_init', array($this, 'process_activation_redirect')); // Redirect after plugin activation
115
+ add_action('admin_init', array($this, 'process_settings_export')); // Export db options
116
+ add_action('admin_init', array($this, 'process_settings_import')); // Import db options
117
+
118
+ add_action('admin_enqueue_scripts', array($this, 'admin_plugins_page_stylesheet'));
119
+
120
+ add_action('before_wp_tiny_mce', array($this, 'before_wp_tiny_mce')); // Add dashicons to tinymce
121
+ add_filter('tiny_mce_before_init', array($this, 'wp_edit_tiny_mce_before_init')); // Before tinymce initialization
122
+ add_action('init', array($this, 'wp_edit_init_tinymce')); // Tinymce initialization
123
+
124
+ add_filter('format_for_editor', array($this, 'htlmedit_pre')); // Filter html content if wpautop is disabled
125
+
126
+ $plugin_file = basename( __FILE__ );
127
+ $plugin_folder = basename( dirname( __FILE__ ) );
128
+ $plugin_hook = "in_plugin_update_message-{$plugin_folder}/{$plugin_file}";
129
+ add_action($plugin_hook, array($this, 'wpedit_plugin_update_cb'), 10, 2); // Plugin update message
130
+ add_action('admin_footer', array($this, 'wpedit_plugin_update_js')); // Plugin update message javascript
131
+
132
+
133
+ // Populate this plugin filtered buttons
134
+ $filter_args = array();
135
+ $get_filters = apply_filters( 'wp_edit_custom_buttons', $filter_args );
136
+ $filters_array = array();
137
+
138
+ // If the array set is not empty (filters being applied)
139
+ if( ! empty( $get_filters ) ) {
140
+ foreach( $get_filters as $key => $values ) {
141
+
142
+ $filters_array[] = $values;
143
+ }
144
+ }
145
+ $this->filtered_buttons = $filters_array;
146
+ }
147
+
148
+ /*
149
+ ****************************************************************
150
+ Activation hook
151
+ ****************************************************************
152
+ */
153
+ public function plugin_activate() {
154
+
155
+ global $current_user;
156
+
157
+ // Get DB values
158
+ $options_buttons = get_option('wp_edit_buttons');
159
+ $options_global = get_option('wp_edit_global');
160
+ $options_general = get_option('wp_edit_general');
161
+ $options_posts = get_option('wp_edit_posts');
162
+ $options_editor = get_option('wp_edit_editor');
163
+ $options_extras = get_option('wp_edit_extras');
164
+ $options_user_specific = get_user_meta($current_user->ID, 'aaa_wp_edit_user_meta', true);
165
+
166
+ // Check if DB value exists.. if YES, then keep value.. if NO, then replace with protected defaults
167
+ $options_buttons = $options_buttons ? $options_buttons : $this->global_options_buttons;
168
+ $options_global = $options_global ? $options_global : $this->global_options_global;
169
+ $options_general = $options_general ? $options_general : $this->global_options_general;
170
+ $options_posts = $options_posts ? $options_posts : $this->global_options_posts;
171
+ $options_editor = $options_editor ? $options_editor : $this->global_options_editor;
172
+ $options_extras = $options_extras ? $options_extras : $this->global_options_extras;
173
+ $options_user_specific = $options_user_specific ? $options_user_specific : $this->global_options_user_specific;
174
+
175
+ // Set DB values
176
+ update_option('wp_edit_buttons', $options_buttons);
177
+ update_option('wp_edit_global', $options_global);
178
+ update_option('wp_edit_general', $options_general);
179
+ update_option('wp_edit_posts', $options_posts);
180
+ update_option('wp_edit_editor', $options_editor);
181
+ update_option('wp_edit_extras', $options_extras);
182
+ update_user_meta($current_user->ID, 'aaa_wp_edit_user_meta', $options_user_specific);
183
+
184
+ // Add option for redirect
185
+ add_option('wp_edit_activation_redirect', true);
186
+ }
187
+
188
+ /*
189
+ ****************************************************************
190
+ Language localization
191
+ ****************************************************************
192
+ */
193
+ public function wp_edit_load_translation() {
194
+
195
+ load_plugin_textdomain( 'wp-edit' );
196
+ }
197
+
198
+ /*
199
+ ****************************************************************
200
+ Plugin settings links
201
+ ****************************************************************
202
+ */
203
+ public function plugin_settings_link($links) {
204
+
205
+ $settings_link = '<a href="admin.php?page=wp_edit_options">'.__('Settings', 'wp-edit').'</a>';
206
+ $settings_link2 = '<a target="_blank" href="https://wpeditpro.com">'.__('Go Pro!', 'wp-edit').'</a>';
207
+ array_push( $links, $settings_link, $settings_link2 );
208
+ return $links;
209
+ }
210
+
211
+ /*
212
+ ****************************************************************
213
+ Dismissable upgrade notice
214
+ ****************************************************************
215
+ */
216
+ public function upgrade_notice() {
217
+
218
+ // Define variables
219
+ global $pagenow;
220
+ global $current_user;
221
+ $userid = $current_user->ID;
222
+
223
+ // If we are only on plugins.php admin page...
224
+ if($pagenow === 'plugins.php') {
225
+
226
+ //******************************************************/
227
+ // Check 30 day installation notice
228
+ //******************************************************/
229
+
230
+ // Check if plugin install date is set in database
231
+ $opt_install = get_option('wp_edit_install');
232
+ if($opt_install === false) {
233
+
234
+ // Set install date to today
235
+ update_option('wp_edit_install', date('Y-m-d'));
236
+ }
237
+
238
+ // Compare install date with today
239
+ $date_install = isset($opt_install) ? $opt_install : date('Y-m-d');
240
+
241
+ // If install date is more than 30 days old...
242
+ if(strtotime($date_install) < strtotime('-30 days')){
243
+
244
+ // If the user clicked to dismiss notice...
245
+ if ( isset( $_GET['dismiss_wpedit_ug_notice'] ) && 'yes' == $_GET['dismiss_wpedit_ug_notice'] ) {
246
+
247
+ // Update user meta
248
+ add_user_meta( $userid, 'ignore_wpedit_ag_notice', 'yes', true );
249
+ }
250
+
251
+ // If user meta is not set...
252
+ if ( !get_user_meta( $userid, 'ignore_wpedit_ag_notice' ) ) {
253
+
254
+ // Alert plugin update message
255
+ function wpedit_wordpress_version_notice() {
256
+
257
+ global $pagenow;
258
+
259
+ echo '<div class="updated" style="padding: 0; margin: 0; border: none; background: none;">
260
+ <div class="wpedit_plugins_page_banner">
261
+ <a href="'.$pagenow.'?dismiss_wpedit_ug_notice=yes"><img class="close_icon" title="" src="'. plugins_url( 'images/close_banner.png', __FILE__ ) .'" alt=""/></a>
262
+ <div class="button_div">
263
+ <a class="button" target="_blank" href="https://wpeditpro.com">Learn More</a>
264
+ </div>
265
+ <div class="text">
266
+ It\'s time to consider upgrading <strong>WP Edit</strong> to the <strong>PRO</strong> version.<br />
267
+ <span>Extend standard plugin functionality with new, enhanced options.</span>
268
+ </div>
269
+ </div>
270
+ </div>';
271
+ }
272
+ add_action('admin_notices', 'wpedit_wordpress_version_notice');
273
+ }
274
+ }
275
+
276
+ //******************************************************/
277
+ // Check Custom Buttons API notice
278
+ //******************************************************/
279
+ // If the user clicked to dismiss notice...
280
+ if ( isset( $_GET['dismiss_wpedit_custom_buttons_notice'] ) && 'yes' == $_GET['dismiss_wpedit_custom_buttons_notice'] ) {
281
+
282
+ // Update user meta
283
+ add_user_meta( $userid, 'ignore_wpedit_custom_buttons_notice', 'yes', true );
284
+ }
285
+
286
+ // If user meta is not set...
287
+ if ( !get_user_meta( $userid, 'ignore_wpedit_custom_buttons_notice' ) ) {
288
+
289
+ // Alert plugin update message
290
+ function wpedit_custom_buttons_notice() {
291
+
292
+ global $pagenow;
293
+
294
+ echo '<div class="updated" style="padding: 0; margin: 0; border: none; background: none;">
295
+ <div class="wpedit_plugins_page_banner">
296
+ <a href="'.$pagenow.'?dismiss_wpedit_custom_buttons_notice=yes"><img class="close_icon" title="" src="'. plugins_url( 'images/close_banner.png', __FILE__ ) .'" alt=""/></a>
297
+ <div class="button_div">
298
+ <a class="button" target="_blank" href="http://learn.wpeditpro.com/custom-buttons-api/">Learn More</a>
299
+ </div>
300
+ <div class="text">
301
+ Introducing the WP Edit Custom Buttons API<br />
302
+ <span>Tell all your favorite plugin/theme developers they can now add their editor buttons to WP Edit and WP Edit Pro.</span>
303
+ </div>
304
+ </div>
305
+ </div>';
306
+ }
307
+ add_action('admin_notices', 'wpedit_custom_buttons_notice');
308
+ }
309
+
310
+ }
311
+ }
312
+
313
+ public function admin_plugins_page_stylesheet( $hook ) {
314
+
315
+ if( $hook == 'plugins.php' ) {
316
+
317
+ wp_register_style( 'wp_edit_admin_plugins_page_styles', plugin_dir_url( __FILE__ ) . 'css/admin_plugins_page.css', array() ); // Main Admin Page Script File
318
+ wp_enqueue_style( 'wp_edit_admin_plugins_page_styles' );
319
+ }
320
+ }
321
+
322
+
323
+ /*
324
+ ****************************************************************
325
+ Page Functions
326
+ ****************************************************************
327
+ */
328
+ public function add_page() {
329
+
330
+ $wp_edit_page = add_menu_page(__('WP Edit', 'wp-edit'), __('WP Edit', 'wp-edit'), 'manage_options', 'wp_edit_options', array($this, 'options_do_page'));
331
+ add_action('admin_print_scripts-'.$wp_edit_page, array($this, 'admin_scripts'));
332
+ add_action('admin_print_styles-'.$wp_edit_page, array($this, 'admin_styles'));
333
+ add_action('load-'.$wp_edit_page, array($this, 'load_page'));
334
+ }
335
+ public function admin_scripts() {
336
+
337
+ wp_enqueue_script('jquery-ui-core');
338
+ wp_enqueue_script('jquery-ui-sortable');
339
+ wp_enqueue_script('jquery-ui-dialog');
340
+ wp_enqueue_script('jquery-ui-tooltip');
341
+ wp_enqueue_script('jquery-ui-tabs');
342
+ wp_enqueue_script('wp-color-picker');
343
+
344
+ wp_register_script( 'wp_edit_js', plugin_dir_url( __FILE__ ) . 'js/admin.js', array() ); // Main Admin Page Script File
345
+ wp_enqueue_script( 'wp_edit_js' );
346
+
347
+ // Pass WP variables to main JS script
348
+ $wp_vars = array( 'jwl_plugin_url' => plugin_dir_url( __FILE__ ));
349
+ wp_localize_script( 'wp_edit_js', 'jwlWpVars', $wp_vars); // Set wp-content
350
+ }
351
+ public function admin_styles() {
352
+
353
+ $options = get_option('wp_edit_global');
354
+ $select_theme = isset($options['jquery_theme']) ? $options['jquery_theme'] : 'smoothness';
355
+
356
+ wp_enqueue_style( 'wp-color-picker' );
357
+ wp_enqueue_style('dashicons');
358
+
359
+ ?><link rel="stylesheet" href="//code.jquery.com/ui/1.10.3/themes/<?php echo $select_theme; ?>/jquery-ui.css"><?php
360
+ ?><link rel="stylesheet" href="<?php echo includes_url().'js/tinymce/skins/lightgray/skin.min.css' ?>"><?php
361
+
362
+ wp_register_style('wp_edit_css', plugin_dir_url( __FILE__ ) . ('css/admin.css'), array()); // css for admin panel presentation
363
+ wp_enqueue_style('wp_edit_css');
364
+ }
365
+
366
+
367
+ /*
368
+ ****************************************************************
369
+ Display Page
370
+ ****************************************************************
371
+ */
372
+ public function options_do_page() {
373
+
374
+ ?>
375
+ <div class="wrap">
376
+
377
+ <div id="icon-themes" class="icon32"></div>
378
+ <h2><?php _e('WP Edit Settings', 'wp-edit'); ?></h2>
379
+
380
+ <?php
381
+ settings_errors();
382
+ $active_tab = isset($_GET['tab']) ? $_GET['tab'] : 'buttons';
383
+
384
+
385
+ /******************************************************************************/
386
+ // Make filtered button comparison; alert users if counts do not match
387
+ /******************************************************************************/
388
+ // First; get all buttons saved in database
389
+ $plugin_buttons = get_option( 'wp_edit_buttons', $this->global_options_buttons );
390
+ $plugin_buttons_string = '';
391
+
392
+ foreach( $plugin_buttons as $key => $button_string ) {
393
+
394
+ if( !empty( $button_string ) )
395
+ $plugin_buttons_string .= $button_string. ' ';
396
+ }
397
+
398
+ $plugin_buttons_string = rtrim( $plugin_buttons_string, ' ' );
399
+ $explode_buttons_string = explode( ' ', $plugin_buttons_string );
400
+
401
+
402
+
403
+ // Second; get all plugin default buttons
404
+ $plugin_buttons = $this->global_options_buttons;
405
+
406
+ // Merge all default plugin buttons into single array
407
+ $all_array = '';
408
+ foreach($plugin_buttons as $slot_array) {
409
+
410
+ if(!empty($slot_array) && $slot_array != '') { // Skip containter array if empty
411
+ $all_array .= $slot_array.' '; // Create single string of all default plugin buttons
412
+ }
413
+ }
414
+ $all_array = rtrim($all_array, ' '); // Remove trailing right space
415
+ $plugin_array = explode(' ', $all_array); // Explode at spaces to make single array (this is an array of all current plugin buttons)
416
+
417
+
418
+ // Third; add filtered buttons to second array
419
+ $get_filters = $this->filtered_buttons;
420
+
421
+ // If the array set is not empty (filters being applied)
422
+ if( ! empty( $get_filters ) ) {
423
+ foreach( $get_filters as $key => $values ) {
424
+
425
+ $plugin_array[] = $values['button_id'];
426
+ }
427
+ }
428
+
429
+
430
+ // Create an array of buttons that have been removed
431
+ $array_diff = array_diff( $explode_buttons_string, $plugin_array );
432
+
433
+
434
+ // Fourth; make comparison and alert user if filtered buttons have been removed (deactivated)
435
+ if( count( $plugin_array ) < count( $explode_buttons_string ) ) {
436
+
437
+ ?>
438
+ <div class="error wpep_info">
439
+
440
+ <p>
441
+ <?php _e('The following buttons have been removed:', 'wp_edit_pro'); ?><br />
442
+ <strong>
443
+ <?php
444
+ $buttons = '';
445
+ foreach( $array_diff as $key => $button ) { $buttons .= $button . ', '; }
446
+ $buttons = rtrim( $buttons, ', ' );
447
+ echo $buttons;
448
+ ?>
449
+ </strong><br /><br />
450
+ <?php _e('These buttons came from a plugin or theme that has been deactivated.', 'wp_edit_pro'); ?><br />
451
+ <?php _e('To remove this message; simply visit the "Buttons" tab and save the buttons.', 'wp_edit_pro'); ?><br />
452
+ </p>
453
+ </div>
454
+ <?php
455
+ }
456
+ ?>
457
+
458
+ <h2 class="nav-tab-wrapper">
459
+ <a href="?page=wp_edit_options&tab=buttons" class="nav-tab <?php echo $active_tab == 'buttons' ? 'nav-tab-active' : ''; ?>"><?php _e('Buttons', 'wp-edit'); ?></a>
460
+ <a href="?page=wp_edit_options&tab=global" class="nav-tab <?php echo $active_tab == 'global' ? 'nav-tab-active' : ''; ?>"><?php _e('Global', 'wp-edit'); ?></a>
461
+ <a href="?page=wp_edit_options&tab=general" class="nav-tab <?php echo $active_tab == 'general' ? 'nav-tab-active' : ''; ?>"><?php _e('General', 'wp-edit'); ?></a>
462
+ <a href="?page=wp_edit_options&tab=posts" class="nav-tab <?php echo $active_tab == 'posts' ? 'nav-tab-active' : ''; ?>"><?php _e('Posts/Pages', 'wp-edit'); ?></a>
463
+ <a href="?page=wp_edit_options&tab=editor" class="nav-tab <?php echo $active_tab == 'editor' ? 'nav-tab-active' : ''; ?>"><?php _e('Editor', 'wp-edit'); ?></a>
464
+ <a href="?page=wp_edit_options&tab=extras" class="nav-tab <?php echo $active_tab == 'extras' ? 'nav-tab-active' : ''; ?>"><?php _e('Extras', 'wp-edit'); ?></a>
465
+ <a href="?page=wp_edit_options&tab=user_specific" class="nav-tab <?php echo $active_tab == 'user_specific' ? 'nav-tab-active' : ''; ?>"><?php _e('User Specific', 'wp-edit'); ?></a>
466
+ <a href="?page=wp_edit_options&tab=database" class="nav-tab <?php echo $active_tab == 'database' ? 'nav-tab-active' : ''; ?>"><?php _e('Database', 'wp-edit'); ?></a>
467
+ <a href="?page=wp_edit_options&tab=about" class="nav-tab <?php echo $active_tab == 'about' ? 'nav-tab-active' : ''; ?>"><?php _e('About', 'wp-edit'); ?></a>
468
+ </h2>
469
+
470
+ <?php
471
+ /*
472
+ ****************************************************************
473
+ Buttons Tab
474
+ ****************************************************************
475
+ */
476
+ if($active_tab == 'buttons'){
477
+
478
+ $options_buttons = get_option( 'wp_edit_buttons', $this->global_options_buttons );
479
+
480
+ echo '<div class="main_container">';
481
+
482
+ echo '<div id="main_buttons_container" class="main_buttons_container_float">';
483
+
484
+ echo '<h3>';
485
+ _e('WP Edit Buttons', 'wp-edit');
486
+ echo '</h3>';
487
+ ?>
488
+
489
+ <div class="metabox-holder">
490
+ <div class="postbox">
491
+
492
+ <div class="inside wpep_act_button_area" id="inside_button_hover">
493
+ <h3><?php _e('Button Rows', 'wp-edit'); ?></h3>
494
+
495
+ <?php
496
+ $no_tooltips = false;
497
+ $icons_filter = '';
498
+
499
+ $options_global = get_option('wp_edit_global');
500
+ if(isset($options_global['disable_fancy_tooltips']) && $options_global['disable_fancy_tooltips'] === '1') {
501
+
502
+ $no_tooltips = true;
503
+ }
504
+
505
+ // Loop each toolbar and create array of icons (for later comparison)
506
+ foreach( $options_buttons as $toolbar => $icons ) {
507
+
508
+ if(!empty($icons)) {
509
+
510
+ $icons_filter .= ' ' . $icons;
511
+ }
512
+ }
513
+
514
+ // Loop all buttons and create sortable divs
515
+ foreach ($options_buttons as $toolbar => $icons) {
516
+
517
+ if($toolbar === 'tmce_container') {
518
+ ?><h3><?php _e('Button Container', 'wp-edit'); ?></h3><?php
519
+ }
520
+
521
+ // Disregard rows 3 and 4
522
+ if($toolbar === 'toolbar1' || $toolbar === 'toolbar2' || $toolbar === 'tmce_container') {
523
+
524
+
525
+ echo '<div id="'.$toolbar.'" class="ui-state-default sortable">';
526
+
527
+ // Create array of icons
528
+ if(!empty($icons)) {
529
+ $icons = explode(' ', $icons);
530
+ }
531
+
532
+ // Loop icons (if is array)
533
+ if(is_array($icons)) {
534
+ foreach ($icons as $icon) {
535
+
536
+ $class = ''; $title = ''; $text = ''; $style = ''; $tooltip = array('title' => '', 'content' => '');
537
+
538
+ // WP Buttons included by default
539
+ if($icon === 'bold') {
540
+ $class = 'dashicons dashicons-editor-bold';
541
+ $title = 'Bold';
542
+ $tooltip['title'] = 'Bold';
543
+ $tooltip['content'] = '<p>Apply <strong>bold</strong> to editor text.</p>';
544
+ }
545
+ else if($icon === 'italic') {
546
+ $class = 'dashicons dashicons-editor-italic';
547
+ $title = 'Italic';
548
+ $tooltip['title'] = 'Italic';
549
+ $tooltip['content'] = '<p>Apply <em>italic</em> to editor text.</p>';
550
+ }
551
+ else if($icon === 'strikethrough') {
552
+ $class = 'dashicons dashicons-editor-strikethrough';
553
+ $title = 'Strikethrough';
554
+ $tooltip['title'] = 'Strikethrough';
555
+ $tooltip['content'] = '<p>Apply <strike>strikethrough</strike> to editor text.</p>';
556
+ }
557
+ else if($icon === 'bullist') {
558
+ $class = 'dashicons dashicons-editor-ul';
559
+ $title = 'Bullet List';
560
+ $tooltip['title'] = 'Bullet List';
561
+ $tooltip['content'] = '<p>Create a list of bulleted items.</p>';
562
+ }
563
+ else if($icon === 'numlist') {
564
+ $class = 'dashicons dashicons-editor-ol';
565
+ $title = 'Numbered List';
566
+ $tooltip['title'] = 'Numbered List';
567
+ $tooltip['content'] = '<p>Create a list of numbered items.</p>';
568
+ }
569
+ else if($icon === 'blockquote') {
570
+ $class = 'dashicons dashicons-editor-quote';
571
+ $title = 'Blockquote';
572
+ $tooltip['title'] = 'Blockquote';
573
+ $tooltip['content'] = '<p>Insert a block level quotation.</p>';
574
+ }
575
+ else if($icon === 'hr') {
576
+ $class = 'dashicons dashicons-minus';
577
+ $title = 'Horizontal Rule';
578
+ $tooltip['title'] = 'Horizontal Rule';
579
+ $tooltip['content'] = '<p>Insert a horizontal rule.</p>';
580
+ }
581
+ else if($icon === 'alignleft') {
582
+ $class = 'dashicons dashicons-editor-alignleft';
583
+ $title = 'Align Left';
584
+ $tooltip['title'] = 'Align Left';
585
+ $tooltip['content'] = '<p>Align editor content to the left side of the editor.</p>';
586
+ }
587
+ else if($icon === 'aligncenter') {
588
+ $class = 'dashicons dashicons-editor-aligncenter';
589
+ $title = 'Align Center';
590
+ $tooltip['title'] = 'Align Center';
591
+ $tooltip['content'] = '<p>Align editor content to the center of the editor.</p>';
592
+ }
593
+ else if($icon === 'alignright') {
594
+ $class = 'dashicons dashicons-editor-alignright';
595
+ $title = 'Align Right';
596
+ $tooltip['title'] = 'Align Right';
597
+ $tooltip['content'] = '<p>Align editor content to the right side of the editor.</p>';
598
+ }
599
+ else if($icon === 'link') {
600
+ $class = 'dashicons dashicons-admin-links';
601
+ $title = 'Link';
602
+ $tooltip['title'] = 'Link';
603
+ $tooltip['content'] = '<p>Insert a link around currently selected content.</p>';
604
+ }
605
+ else if($icon === 'unlink') {
606
+ $class = 'dashicons dashicons-editor-unlink';
607
+ $title = 'Unlink';
608
+ $tooltip['title'] = 'Unlink';
609
+ $tooltip['content'] = '<p>Remove the link around currently selected content.</p>';
610
+ }
611
+ else if($icon === 'wp_more') {
612
+ $class = 'dashicons dashicons-editor-insertmore';
613
+ $title = 'More';
614
+ $tooltip['title'] = 'More';
615
+ $tooltip['content'] = '<p>Inserts the read_more() WordPress function; commonly used for excerpts.</p>';
616
+ }
617
+
618
+ else if($icon === 'formatselect') {
619
+ $title = 'Format Select';
620
+ $text = 'Paragraph';
621
+ $tooltip['title'] = 'Paragraph';
622
+ $tooltip['content'] = '<p>Adds the Format Select dropdown button; used to select different styles.</p>';
623
+ }
624
+ else if($icon === 'underline') {
625
+ $class = 'dashicons dashicons-editor-underline';
626
+ $title = 'Underline';
627
+ $tooltip['title'] = 'Underline';
628
+ $tooltip['content'] = '<p>Apply <u>underline</u> to editor text.</p>';
629
+ }
630
+ else if($icon === 'alignjustify') {
631
+ $class = 'dashicons dashicons-editor-justify';
632
+ $title = 'Align Full';
633
+ $tooltip['title'] = 'Align Full';
634
+ $tooltip['content'] = '<p>Align selected content to full width of the page.</p>';
635
+ }
636
+ else if($icon === 'forecolor') {
637
+ $class = 'dashicons dashicons-editor-textcolor';
638
+ $title = 'Foreground Color';
639
+ $tooltip['title'] = 'Foreground Color';
640
+ $tooltip['content'] = '<p>Change the foreground color of selected content; commonly used to change text color.</p>';
641
+ }
642
+ else if($icon === 'pastetext') {
643
+ $class = 'dashicons dashicons-editor-paste-text';
644
+ $title = 'Paste Text';
645
+ $tooltip['title'] = 'Paste Text';
646
+ $tooltip['content'] = '<p>Paste content as plain text.</p>';
647
+ }
648
+ else if($icon === 'removeformat') {
649
+ $class = 'dashicons dashicons-editor-removeformatting';
650
+ $title = 'Remove Format';
651
+ $tooltip['title'] = 'Remove Format';
652
+ $tooltip['content'] = '<p>Remove all current formatting from selected content.</p>';
653
+ }
654
+ else if($icon === 'charmap') {
655
+ $class = 'dashicons dashicons-editor-customchar';
656
+ $title = 'Character Map';
657
+ $tooltip['title'] = 'Character Map';
658
+ $tooltip['content'] = '<p>Display a characted map used for inserting special characters.</p>';
659
+ }
660
+ else if($icon === 'outdent') {
661
+ $class = 'dashicons dashicons-editor-outdent';
662
+ $title = 'Outdent';
663
+ $tooltip['title'] = 'Outdent';
664
+ $tooltip['content'] = '<p>Outdent selected content; primary used for paragraph elements.</p>';
665
+ }
666
+ else if($icon === 'indent') {
667
+ $class = 'dashicons dashicons-editor-indent';
668
+ $title = 'Indent';
669
+ $tooltip['title'] = 'Indent';
670
+ $tooltip['content'] = '<p>Indent selected content; primary used for paragraph elements.</p>';
671
+ }
672
+ else if($icon === 'undo') {
673
+ $class = 'dashicons dashicons-undo';
674
+ $title = 'Undo';
675
+ $tooltip['title'] = 'Undo';
676
+ $tooltip['content'] = '<p>Undo last editor action.</p>';
677
+ }
678
+ else if($icon === 'redo') {
679
+ $class = 'dashicons dashicons-redo';
680
+ $title = 'Redo';
681
+ $tooltip['title'] = 'Redo';
682
+ $tooltip['content'] = '<p>Redo last editor action.</p>';
683
+ }
684
+ else if($icon === 'wp_help') {
685
+ $class = 'dashicons dashicons-editor-help';
686
+ $title = 'Help';
687
+ $tooltip['title'] = 'Help';
688
+ $tooltip['content'] = '<p>Displays helpful information such as editor information and keyboard shortcuts.</p>';
689
+ }
690
+
691
+ // WP Buttons not included by default
692
+ else if($icon === 'fontselect') {
693
+ $title = 'Font Select';
694
+ $text = 'Font Family';
695
+ $tooltip['title'] = 'Font Select';
696
+ $tooltip['content'] = '<p>Apply various fonts to the editor selection.</p><p>Also displays fonts from Google Fonts options (if activated).</p>';
697
+ }
698
+ else if($icon === 'fontsizeselect') {
699
+ $title = 'Font Size Select';
700
+ $text = 'Font Sizes';
701
+ $tooltip['title'] = 'Font Size Select';
702
+ $tooltip['content'] = '<p>Apply various font sizes to the editor selection.</p><p>Default values can be switched from "pt" to "px" via the Editor tab.</p>';
703
+ }
704
+ else if($icon === 'styleselect') {
705
+ $title = 'Formats';
706
+ $text = 'Formats';
707
+ $tooltip['title'] = 'Formats';
708
+ $tooltip['content'] = '<p>Displays quick access to formats like "Headings", "Inline", "Blocks" and "Alignment".</p><p>Any custom styles created (Styles Tab) will also be shown here.</p>';
709
+ }
710
+ else if($icon === 'backcolor') {
711
+ $title = 'Background Color Picker';
712
+ $text = '<i class="mce-ico mce-i-backcolor"></i>';
713
+ $tooltip['title'] = 'Background Color Picker';
714
+ $tooltip['content'] = '<p>Change the background color of selected content; commonly used for high-lighting text.</p>';
715
+ }
716
+ else if($icon === 'media') {
717
+ $class = 'dashicons dashicons-format-video';
718
+ $title = 'Media';
719
+ $tooltip['title'] = 'Media';
720
+ $tooltip['content'] = '<p>Insert media from an external resource (by link); or embed media content into editor.</p>';
721
+ }
722
+ else if($icon === 'rtl') {
723
+ $title = 'Text Direction Right to Left';
724
+ $text = '<i class="mce-ico mce-i-rtl"></i>';
725
+ $tooltip['title'] = 'Text Direction Right to Left';
726
+ $tooltip['content'] = '<p>Forces the text direction from right to left on selected block element.</p>';
727
+ }
728
+ else if($icon === 'ltr') {
729
+ $title = 'Text Direction Left to Right';
730
+ $text = '<i class="mce-ico mce-i-ltr"></i>';
731
+ $tooltip['title'] = 'Text Direction Left to Right';
732
+ $tooltip['content'] = '<p>Forces the text direction from left to right on selected block element.</p>';
733
+ }
734
+ else if($icon === 'table') {
735
+ $title = 'Tables';
736
+ $text = '<i class="mce-ico mce-i-table"></i>';
737
+ $tooltip['title'] = 'Tables';
738
+ $tooltip['content'] = '<p>Insert, edit and modify html tables.</p>';
739
+ }
740
+ else if($icon === 'anchor') {
741
+ $title = 'Anchor';
742
+ $text = '<i class="mce-ico mce-i-anchor"></i>';
743
+ $tooltip['title'] = 'Anchor';
744
+ $tooltip['content'] = '<p>Create an anchor link on the page.</p>';
745
+ }
746
+ else if($icon === 'code') {
747
+ $title = 'HTML Code';
748
+ $text = '<i class="mce-ico mce-i-code"></i>';
749
+ $tooltip['title'] = 'HTML Code';
750
+ $tooltip['content'] = '<p>Displays the html code of the editor content; in a popup window.</p><p>This can be helpful when editing code is necessary, but switching editor views is undesirable.</p><p>Also, the "Code Magic" button provides a much better interface.</p>';
751
+ }
752
+ else if($icon === 'emoticons') {
753
+ $title = 'Emoticons';
754
+ $text = '<i class="mce-ico mce-i-emoticons"></i>';
755
+ $tooltip['title'] = 'Emoticons';
756
+ $tooltip['content'] = '<p>Opens an overlay window with access to common emoticons.</p>';
757
+ }
758
+ else if($icon === 'inserttime') {
759
+ $title = 'Insert Date Time';
760
+ $text = '<i class="mce-ico mce-i-insertdatetime"></i>';
761
+ $tooltip['title'] = 'Insert Date Time';
762
+ $tooltip['content'] = '<p>Inserts the current date and time into the content editor.</p><p>The date format can be adjusted using the "Configuration" tab.</p>';
763
+ }
764
+ else if($icon === 'wp_page') {
765
+ $title = 'Page Break';
766
+ $text = '<i class="mce-ico mce-i-pagebreak"></i>';
767
+ $tooltip['title'] = 'Page Break';
768
+ $tooltip['content'] = '<p>Inserts a page break; which can created "paged" sections of the content.</p>';
769
+ }
770
+ else if($icon === 'preview') {
771
+ $title = 'Preview';
772
+ $text = '<i class="mce-ico mce-i-preview"></i>';
773
+ $tooltip['title'] = 'Preview';
774
+ $tooltip['content'] = '<p>A quick preview of the editor content.</p>';
775
+ }
776
+ else if($icon === 'print') {
777
+ $title = 'Print';
778
+ $text = '<i class="mce-ico mce-i-print"></i>';
779
+ $tooltip['title'] = 'Print';
780
+ $tooltip['content'] = '<p>Print the editor content directly to a printer.</p>';
781
+ }
782
+ else if($icon === 'searchreplace') {
783
+ $title = 'Search and Replace';
784
+ $text = '<i class="mce-ico mce-i-searchreplace"></i>';
785
+ $tooltip['title'] = 'Search and Replace';
786
+ $tooltip['content'] = '<p>Search and/or replace the editor content with specific characters.</p>';
787
+ }
788
+ else if($icon === 'visualblocks') {
789
+ $title = 'Show Blocks';
790
+ $text = '<i class="mce-ico mce-i-visualblocks"></i>';
791
+ $tooltip['title'] = 'Show Blocks';
792
+ $tooltip['content'] = '<p>Shows all block level editor elements with a light border.</p>';
793
+ }
794
+ else if($icon === 'subscript') {
795
+ $title = 'Subscript';
796
+ $text = '<i class="mce-ico mce-i-subscript"></i>';
797
+ $tooltip['title'] = 'Subscript';
798
+ $tooltip['content'] = '<p>Adds a <sub>subscript</sub> to selected editor content (mainly used with text).</p>';
799
+ }
800
+ else if($icon === 'superscript') {
801
+ $title = 'Superscript';
802
+ $text = '<i class="mce-ico mce-i-superscript"></i>';
803
+ $tooltip['title'] = 'Superscript';
804
+ $tooltip['content'] = '<p>Adds a <sup>superscript</sup> to selected editor content (mainly used with text).</p>';
805
+ }
806
+ else if($icon === 'image_orig') {
807
+ $class = 'dashicons dashicons-format-image';
808
+ $title = 'Image';
809
+ $tooltip['title'] = 'Image';
810
+ $tooltip['content'] = '<p>Insert images (by link).</p>';
811
+ }
812
+ else if($icon === 'p_tags_button') {
813
+ $title = 'Paragraph Tag';
814
+ $style='background-image:url('.WPEDIT_PLUGIN_URL.'plugins/ptags/p_tag.png);width:20px;height:20px;';
815
+ $tooltip['title'] = 'Paragraph Tag';
816
+ $tooltip['content'] = '<p>Insert paragraph tags (along with attributes); which will not be removed from the editor.</p>';
817
+ }
818
+ else if($icon === 'line_break_button') {
819
+ $title = 'Line Break';
820
+ $style='background-image:url('.WPEDIT_PLUGIN_URL.'plugins/linebreak/line_break.png);width:20px;height:20px;';
821
+ $tooltip['title'] = 'Line Break';
822
+ $tooltip['content'] = '<p>Insert line breaks; which will not be removed from the editor.</p><p>This is done by adding a class of "none" to the tag.</p>';
823
+ }
824
+ else if($icon === 'mailto') {
825
+ $title = 'MailTo Link';
826
+ $style='background-image:url('.WPEDIT_PLUGIN_URL.'plugins/mailto/mailto.gif);width:20px;height:20px;';
827
+ $tooltip['title'] = 'MailTo Link';
828
+ $tooltip['content'] = '<p>Turns an email address into an active mail link.</p><p>When clicked, it will open the users default mail client to send a message.</p>';
829
+ }
830
+ else if($icon === 'loremipsum') {
831
+ $title = 'Lorem Ipsum';
832
+ $style='background-image:url('.WPEDIT_PLUGIN_URL.'plugins/loremipsum/loremipsum.png);width:20px;height:20px;';
833
+ $tooltip['title'] = 'Lorem Ipsum';
834
+ $tooltip['content'] = '<p>Esaily insert placeholder text into the editor.</p><p>Select from multiple languages; and choose the number of elements to add.</p>';
835
+ }
836
+ else if($icon === 'shortcodes') {
837
+ $title = 'Shortcodes';
838
+ $style='background-image:url('.WPEDIT_PLUGIN_URL.'plugins/shortcodes/shortcodes.gif);width:20px;height:20px;';
839
+ $tooltip['title'] = 'Shortcodes';
840
+ $tooltip['content'] = '<p>Gathers all available shortcodes and adds them to a dropdown list; for easy editor insertion.</p><p>Note: The shortcodes gathered here do not include any shortcode attributes.</p><p>If shortcode attributes are necessary, they will need to be entered into the shortcode manually.</p>';
841
+ }
842
+ else if($icon === 'youTube') {
843
+ $title = 'YouTube Video';
844
+ $style='background-image:url('.WPEDIT_PLUGIN_URL.'plugins/youTube/images/youtube.png);width:20px;height:20px;';
845
+ $tooltip['title'] = 'YouTube Video';
846
+ $tooltip['content'] = '<p>Browse and insert YouTube videos without ever leaving the editor.</p><p>A custom interface allows browsing YouTube videos directly from the editor.</p>';
847
+ }
848
+ else if($icon === 'clker') {
849
+ $title = 'Clker Images';
850
+ $style='background-image:url('.WPEDIT_PLUGIN_URL.'plugins/clker/img/clker.png);width:20px;height:20px;';
851
+ $tooltip['title'] = 'Clker Images';
852
+ $tooltip['content'] = '<p>Browse and insert images from the Clker.com website.</p>';
853
+ }
854
+ else if($icon === 'cleardiv') {
855
+ $title = 'Clear Div';
856
+ $style='background-image:url('.WPEDIT_PLUGIN_URL.'plugins/cleardiv/images/cleardiv.png);width:20px;height:20px;';
857
+ $tooltip['title'] = 'Clear Div';
858
+ $tooltip['content'] = '<p>Clear editor divs. Selections include "left", "right" and "both".</p>';
859
+ }
860
+ else if($icon === 'codemagic') {
861
+ $title = 'Code Magic';
862
+ $style='background-image:url('.WPEDIT_PLUGIN_URL.'plugins/codemagic/images/codemagic.png);width:20px;height:20px;';
863
+ $tooltip['title'] = 'Code Magic';
864
+ $tooltip['content'] = '<p>An advanced html code editor; view and edit the html code from an overlay window.</p><p>Includes syntax highlighting; search and replace; and proper element spacing.</p><p>This is a great option when editing html code is necessary; but swtiching editor views is undesirable.</p>';
865
+ }
866
+ else if($icon === 'acheck') {
867
+ $title = 'Accessibility Checker';
868
+ $style='background-image:url('.WPEDIT_PLUGIN_URL.'plugins/acheck/img//acheck.png);width:20px;height:20px;';
869
+ $tooltip['title'] = 'Accessibility Checker';
870
+ $tooltip['content'] = '<p>Checks the editor content for accessibility by other devices.</p>';
871
+ }
872
+ else if($icon === 'advlink') {
873
+ $title = 'Insert/Edit Advanced Link';
874
+ $style='background-image:url('.WPEDIT_PLUGIN_URL.'plugins/advlink/images/advlink.png);width:20px;height:20px;';
875
+ $tooltip['title'] = 'Insert/Edit Advanced Link';
876
+ $tooltip['content'] = '<p>Insert and edit links; along with various atttributes.</p><p>Populates with all posts and pages; so linking to current content is a one-click process.</p><p>Also includes javascript attributes (onclick, onmouseover, etc.); which can be used for executing javascript functions.</p>';
877
+ }
878
+ else if($icon === 'advhr') {
879
+ $title = 'Advanced Horizontal Line';
880
+ $style='background-image:url('.WPEDIT_PLUGIN_URL.'plugins/advhr/images/advhr.png);width:20px;height:20px;';
881
+ $tooltip['title'] = 'Advanced Horizontal Line';
882
+ $tooltip['content'] = '<p>Modify various options of the horizontal line; like shadow and width.</p>';
883
+ }
884
+ else if($icon === 'advimage') {
885
+ $title = 'Advanced Insert/Edit Image';
886
+ $style='background-image:url('.WPEDIT_PLUGIN_URL.'plugins/advimage/images//advimage.png);width:20px;height:20px;';
887
+ $tooltip['title'] = 'Advanced Insert/Edit Image';
888
+ $tooltip['content'] = '<p>Insert/Edit images with more control.</p><p>Define image attributes, image margin, image padding and image border.</p><p>Also includes javascript attributes (onclick, onmouseover, etc.); which can be used for executing javascript functions.</p>';
889
+ }
890
+ else if($icon === 'formatPainter') {
891
+ $class = 'dashicons dashicons-admin-appearance';
892
+ $title = 'Format Painter';
893
+ $tooltip['title'] = 'Format Painter';
894
+ $tooltip['content'] = '<p>Copies styling from one element; and applies the same styling to another element.</p>';
895
+ }
896
+ else if($icon === 'googleImages') {
897
+ $title = 'Google Images';
898
+ $style='background-image:url('.WPEDIT_PLUGIN_URL.'plugins/googleImages/images/googleImages.png);width:20px;height:20px;';
899
+ $tooltip['title'] = 'Google Images';
900
+ $tooltip['content'] = '<p>Browse and insert Google images without ever leaving the content editor.</p>';
901
+ }
902
+ else if($icon === 'abbr') {
903
+ $title = 'Abbreviation';
904
+ $style='background-image:url('.WPEDIT_PLUGIN_URL.'plugins/abbr/abbr.png);width:20px;height:20px;';
905
+ $tooltip['title'] = 'Abbreviation';
906
+ $tooltip['content'] = '<p>Add an abbreviation to selected editor content.</p>';
907
+ }
908
+ else if($icon === 'imgmap') {
909
+ $title = 'Image Map';
910
+ $style='background-image:url('.WPEDIT_PLUGIN_URL.'plugins/imgmap/images/imgmap.png);width:20px;height:20px;';
911
+ $tooltip['title'] = 'Image Map';
912
+ $tooltip['content'] = '<p>Create an image map from an image.</p><p>Allows multiple "hot spots" on a single image. Each "hot spot" can link to a different url.</p>';
913
+ }
914
+ else if($icon === 'columnShortcodes') {
915
+ $class = 'dashicons dashicons-schedule';
916
+ $title = 'Column Shortcodes';
917
+ $tooltip['title'] = 'Column Shortcodes';
918
+ $tooltip['content'] = '<p>A tool for easily inserting column shortcode templates.</p>';
919
+ }
920
+ else if($icon === 'nonbreaking') {
921
+ $title = 'Nonbreaking Space';
922
+ $style='background-image:url('.WPEDIT_PLUGIN_URL.'plugins/nonbreaking/nonbreaking.png);width:20px;height:20px;';
923
+ $tooltip['title'] = 'Nonbreaking Space';
924
+ $tooltip['content'] = '<p>Insert a nonbreaking space; which will not be removed from the editor.</p>';
925
+ }
926
+ else if($icon === 'eqneditor') {
927
+ $title = 'CodeCogs Equation Editor';
928
+ $style='background-image:url('.WPEDIT_PLUGIN_URL.'plugins/eqneditor/img/eqneditor.png);width:20px;height:20px;';
929
+ $tooltip['title'] = 'CodeCogs Equation Editor';
930
+ $tooltip['content'] = '<p>Create complex math equations from a simple interface.</p>';
931
+ }
932
+ else {
933
+
934
+ $get_filters = $this->filtered_buttons;
935
+
936
+ // If the array set is not empty (filters being applied)
937
+ if( ! empty( $get_filters ) ) {
938
+
939
+ $check_filter = array();
940
+ foreach( $get_filters as $key => $values ) {
941
+
942
+ $check_filter[$values['button_id']] = $values;
943
+ }
944
+
945
+ // If this button is in filtered array
946
+ if( array_key_exists( $icon, $check_filter ) ) {
947
+
948
+ $array_key = $check_filter[$icon];
949
+
950
+ $title = isset( $array_key['tooltip_title'] ) && $array_key['tooltip_title'] !== '' ? $array_key['tooltip_title'] : '';
951
+ $class = isset( $array_key['dashicon'] ) && $array_key['dashicon'] !== '' ? $array_key['dashicon'] : '';
952
+ $text = isset( $array_key['button_text'] ) && $array_key['button_text'] !== '' ? $array_key['button_text'] : '';
953
+ $style = isset( $array_key['custom_icon'] ) && $array_key['custom_icon'] !== '' ? 'background-image:url(' . $array_key['custom_icon'] . ');width:20px;height:20px;' : '';
954
+ $tooltip['title'] = isset( $array_key['tooltip_title'] ) && $array_key['tooltip_title'] !== '' ? $array_key['tooltip_title'] : '';
955
+ $tooltip['content'] = isset( $array_key['tooltip_content'] ) && $array_key['tooltip_content'] !== '' ? $array_key['tooltip_content'] : '';
956
+ }
957
+ }
958
+ }
959
+
960
+ // Process tooltips
961
+ $tooltip_title = isset($tooltip['title']) ? $tooltip['title'] : 'Title not found';
962
+ $tooltip_content = isset($tooltip['content']) ? $tooltip['content'] : '<p>Content not found. Please report to the plugin developer.</p>';
963
+
964
+ // Are we displaying fancy tooltips?
965
+ $tooltip_att = ($no_tooltips === false) ? 'data-tooltip="<h4 class=\'data_tooltip_title\'>'.htmlspecialchars($tooltip_title).'</h4><hr />'.htmlspecialchars($tooltip_content).'" ' : '';
966
+
967
+
968
+ // ARRAY CHECKING BEFORE DISPLAYING BUTTON FROM DATABASE
969
+ // This will keep saved filtered buttons from displaying (and removes when user saves); if their parent was deactivated
970
+
971
+ // Create array of default buttons (and filter buttons)
972
+ $plugin_buttons = $this->global_options_buttons;
973
+ $check_array = '';
974
+
975
+ foreach( $plugin_buttons as $button ) {
976
+ if( !empty( $button ) && $button != '' ) { // Skip containter array if empty
977
+
978
+ $check_array .= $button . ' '; // Create single string of all default plugin buttons
979
+ }
980
+ }
981
+
982
+ $get_filters = $this->filtered_buttons;
983
+
984
+ // If the array set is not empty (filters being applied)
985
+ if( ! empty( $get_filters ) ) {
986
+ foreach( $get_filters as $key => $values ) {
987
+
988
+ $check_array .= $values['button_id'] . ' ';
989
+ }
990
+ }
991
+
992
+ $trim_check_array = rtrim( $check_array, ' ' );
993
+ $explode_check_array = explode( ' ', $trim_check_array );
994
+
995
+
996
+ // If button is in active array; display div
997
+ if( in_array( $icon, $explode_check_array ) ) {
998
+
999
+ // Display button
1000
+ echo '<div '.$tooltip_att.' id="'.$icon.'" class="ui-state-default draggable '.$class.'" title="'.$title.'"><span style="'.esc_attr($style).'">'.$text.'</span></div>';
1001
+ }
1002
+ }
1003
+ }
1004
+
1005
+
1006
+ /**************************************/
1007
+ // Button filter for plugins/themes
1008
+ /**************************************/
1009
+ $filter_flag = false;
1010
+
1011
+ // Create array of saved buttons
1012
+ if( $icons_filter !== '' ) {
1013
+
1014
+ $trim_filter = trim( $icons_filter );
1015
+ $icons_filter_array = explode( ' ', $trim_filter );
1016
+ }
1017
+
1018
+ $get_filters = $this->filtered_buttons;
1019
+
1020
+ // If the array set is not empty (filters being applied)
1021
+ if( ! empty( $get_filters ) ) {
1022
+ foreach( $get_filters as $key => $values ) {
1023
+
1024
+ if( ! in_array( $values['button_id'], $icons_filter_array ) ) {
1025
+
1026
+ $title = isset( $values['tooltip_title'] ) && $values['tooltip_title'] !== '' ? $values['tooltip_title'] : '';
1027
+ $content = isset( $values['tooltip_content'] ) && $values['tooltip_content'] !== '' ? $values['tooltip_content'] : '';
1028
+ $class = isset( $values['dashicon'] ) && $values['dashicon'] !== '' ? $values['dashicon'] : '';
1029
+ $text = isset( $values['button_text'] ) && $values['button_text'] !== '' ? $values['button_text'] : '';
1030
+ $style = isset( $values['custom_icon'] ) && $values['custom_icon'] !== '' ? 'background-image:url(' . $values['custom_icon'] . ');width:20px;height:20px;' : '';
1031
+ $span = $style !== '' ? '<span style="' . $style . '">' . $text . '</span>' : '<span>' . $text . '</span>';
1032
+ $row = isset( $values['editor_row'] ) && $values['editor_row'] !== '' ? $values['editor_row'] : 'tmce_container';
1033
+
1034
+ /// Filter buttons by row
1035
+ if( $toolbar === $row ) {
1036
+
1037
+ echo '<div
1038
+ data-tooltip="<h4 class=\'data_tooltip_title\'>'.htmlspecialchars( $title ) . '</h4>
1039
+ <hr /><p>'.htmlspecialchars( $content ).'</p>"
1040
+ id="' . $values['button_id'] . '"
1041
+ class="ui-state-default draggable new_button ' . $class . '"
1042
+ title="' . $title . '">' . $span .
1043
+ '</div>'
1044
+ ;
1045
+ }
1046
+
1047
+ $filter_flag = true;
1048
+ }
1049
+ }
1050
+ }
1051
+ echo '</div>'; // End foreach .sortable
1052
+ } // End not rows 3 and 4
1053
+ }
1054
+
1055
+ if( $filter_flag === true ) {
1056
+
1057
+ echo '<div class="error">';
1058
+ echo '<h4>';
1059
+ _e('New buttons have been added via other plugins (or theme).', 'wp_edit_pro');
1060
+ echo '<br />';
1061
+ _e('Move them to a new location (if desired) and click "Save Buttons".', 'wp_edit_pro');
1062
+ echo '</h4>';
1063
+ echo '</div>';
1064
+ }
1065
+ ?>
1066
+ </div> <!-- End #inside_button_hover -->
1067
+ </div> <!-- End .postbox -->
1068
+ </div> <!-- End .metabox -->
1069
+ </div> <!-- End .main_buttons_container_float -->
1070
+ <?php
1071
+
1072
+ // Build input for passing button arrangements
1073
+ echo '<form method="post" action="">';
1074
+
1075
+ echo '<input type="hidden" class="get_sorted_array" name="get_sorted_array_results" value="" />';
1076
+
1077
+ // Submit save buttons
1078
+ echo '<input type="submit" value="'.__('Save Buttons', 'wp-edit').'" name="wpep_save_buttons" class="button-primary" />';
1079
+
1080
+ // Submit reset buttons
1081
+ echo '<span style="margin-left:10px;"></span>';
1082
+ echo '<input type="button" value="'.__('Reset Buttons', 'wp-edit').'" class="button-primary reset_dd_buttons" />';
1083
+ echo '<input type="submit" name="wpep_reset_buttons" class="button-primary wpep_reset_buttons" style="display:none;" />';
1084
+
1085
+ // Create nonce
1086
+ wp_nonce_field( 'wpe_save_buttons_opts' );
1087
+
1088
+ echo '</form>';
1089
+ echo '</div>';
1090
+
1091
+ echo '<div class="main_container">';
1092
+
1093
+ echo '<h3>';
1094
+ _e('Buttons Tips', 'wp-edit');
1095
+ echo '</h3>';
1096
+ ?>
1097
+
1098
+ <div class="metabox-holder">
1099
+ <div class="postbox">
1100
+ <div class="inside">
1101
+
1102
+ <div id="button_help_tabs">
1103
+
1104
+ <ul>
1105
+ <li><a href="#dragdrop"><?php _e('Drag/Drop', 'wp-edit'); ?></a></li>
1106
+ <li><a href="#multiselect"><?php _e('Multi Select', 'wp-edit'); ?></a></li>
1107
+ <li><a href="#reset"><?php _e('Reset', 'wp-edit'); ?></a></li>
1108
+ <li><a href="#custom_api"><?php _e('Custom Buttons API', 'wp-edit'); ?></a></li>
1109
+ </ul>
1110
+
1111
+ <div id="dragdrop">
1112
+ <p>
1113
+ <?php _e('Buttons can be dragged and dropped into desired button rows.', 'wp-edit'); ?><br />
1114
+ <?php _e('The "Button Container" is a placeholder for buttons not used in the editor; these buttons will not appear when editing a post or page.', 'wp-edit'); ?>
1115
+ </p>
1116
+ </div>
1117
+ <div id="multiselect">
1118
+ <p>
1119
+ <?php _e('Buttons may also be selected in quantities; or multiple selections, before being moved.', 'wp-edit'); ?>
1120
+ </p>
1121
+ <p>
1122
+ <?php _e('Clicking a button will set it as "active"; a yellowish highlight color. Multiple buttons can be clicked and set as "active".', 'wp-edit'); ?><br />
1123
+ <?php _e('Clicking and dragging one of the "active" buttons will move the entire "active" selection.', 'wp-edit'); ?><br />
1124
+ <?php _e('Clicking outside the button area will remove all currently active button selections.', 'wp-edit'); ?>
1125
+ </p>
1126
+ </div>
1127
+ <div id="reset">
1128
+ <p>
1129
+ <?php _e('Clicking "Reset Buttons" will restore the editor buttons to their original default values.', 'wp-edit'); ?><br />
1130
+ <?php _e('All button rows will get the default WordPress button arrangements; and the extra buttons will be added to the "Button Container".', 'wp-edit'); ?>
1131
+ </p>
1132
+ </div>
1133
+ <div id="custom_api">
1134
+ <p>
1135
+ <?php _e('WP Edit now uses a Custom Buttons API which allows other plugin/theme developers to add their editor buttons into the system.', 'wp-edit'); ?><br />
1136
+ <?php printf( __('Please direct all your favorite plugin/theme developers to the <a target="_blank" href="%s">Custom Buttons API</a> documentation.', 'wp-edit'), 'http://learn.wpeditpro.com/custom-buttons-api/'); ?>
1137
+ </p>
1138
+ </div>
1139
+ </div>
1140
+ </div>
1141
+ </div>
1142
+ </div>
1143
+ <?php
1144
+ echo '</div>';
1145
+ }
1146
+ /*
1147
+ ****************************************************************
1148
+ Global Tab
1149
+ ****************************************************************
1150
+ */
1151
+ else if($active_tab == 'global') {
1152
+
1153
+ echo '<div class="main_container">';
1154
+
1155
+ ?>
1156
+ <h3><?php _e('Global Options', 'wp-edit'); ?></h3>
1157
+ <form method="post" action="">
1158
+ <div class="metabox-holder">
1159
+ <div class="postbox">
1160
+ <div class="inside">
1161
+
1162
+ <?php
1163
+ $options_global = get_option('wp_edit_global');
1164
+ $jquery_theme = isset($options_global['jquery_theme']) ? $options_global['jquery_theme'] : 'smoothness';
1165
+ $disable_admin_links = isset($options_global['disable_admin_links']) && $options_global['disable_admin_links'] === '1' ? 'checked="checked"' : '';
1166
+ $disable_fancy_tooltips = isset($options_global['disable_fancy_tooltips']) && $options_global['disable_fancy_tooltips'] === '1' ? 'checked="checked"' : '';
1167
+ ?>
1168
+
1169
+ <table cellpadding="10">
1170
+ <tbody>
1171
+ <tr><td><?php _e('jQuery Theme', 'wp-edit'); ?></td>
1172
+ <td>
1173
+
1174
+ <select id="jquery_theme" name="jquery_theme"/>
1175
+ <?php
1176
+ $jquery_themes = array('base','black-tie','blitzer','cupertino','dark-hive','dot-luv','eggplant','excite-bike','flick','hot-sneaks','humanity','le-frog','mint-choc','overcast','pepper-grinder','redmond','smoothness','south-street','start','sunny','swanky-purse','trontastic','ui-darkness','ui-lightness','vader');
1177
+
1178
+ foreach($jquery_themes as $jquery_theme) {
1179
+ $selected = ($options_global['jquery_theme']==$jquery_theme) ? 'selected="selected"' : '';
1180
+ echo "<option value='$jquery_theme' $selected>$jquery_theme</option>";
1181
+ }
1182
+ ?>
1183
+ </select>
1184
+ <label for="jquery_theme"> <?php _e('Selects the jQuery theme for plugin alerts and notices.', 'wp-edit'); ?></label>
1185
+ </td>
1186
+ </tr>
1187
+ <tr><td><?php _e('Disable Admin Links', 'wp-edit'); ?></td>
1188
+ <td>
1189
+ <input id="disable_admin_links" type="checkbox" value="1" name="disable_admin_links" <?php echo $disable_admin_links; ?> />
1190
+ <label for="disable_admin_links"><?php _e('Disables the WP Edit top admin bar links.', 'wp-edit'); ?></label>
1191
+ </td>
1192
+ </tr>
1193
+ <tr><td><?php _e('Disable Fancy Tooltips', 'wp-edit'); ?></td>
1194
+ <td>
1195
+ <input id="disable_fancy_tooltips" type="checkbox" value="1" name="disable_fancy_tooltips" <?php echo $disable_fancy_tooltips; ?> />
1196
+ <label for="disable_fancy_tooltips"><?php _e('Disables the fancy tooltips used on button hover.', 'wp-edit'); ?></label>
1197
+ </td>
1198
+ </tr>
1199
+ </tbody>
1200
+ </table>
1201
+ </div>
1202
+ </div>
1203
+ </div>
1204
+ <input type="submit" value="<?php _e('Save Global Options', 'wp-edit'); ?>" class="button button-primary" id="submit_global" name="submit_global">
1205
+ <?php wp_nonce_field( 'wpe_save_global_opts' ); ?>
1206
+ </form>
1207
+ <?php
1208
+ echo '</div>';
1209
+ }
1210
+ /*
1211
+ ****************************************************************
1212
+ General Tab
1213
+ ****************************************************************
1214
+ */
1215
+ else if($active_tab == 'general'){
1216
+
1217
+ // Get all cpt's (_builtin will exclude default post types)
1218
+ $post_types = get_post_types( array( 'public' => true, '_builtin' => false ), 'names' );
1219
+
1220
+ echo '<div class="main_container">';
1221
+
1222
+ ?>
1223
+ <h3><?php _e('General Options', 'wp-edit'); ?></h3>
1224
+ <form method="post" action="">
1225
+ <div class="metabox-holder">
1226
+ <div class="postbox">
1227
+ <div class="inside">
1228
+
1229
+ <?php
1230
+ $options_general = get_option('wp_edit_general');
1231
+ $linebreak_shortcode = isset($options_general['linebreak_shortcode']) && $options_general['linebreak_shortcode'] === '1' ? 'checked="checked"' : '';
1232
+ $shortcodes_in_widgets = isset($options_general['shortcodes_in_widgets']) && $options_general['shortcodes_in_widgets'] === '1' ? 'checked="checked"' : '';
1233
+ $shortcodes_in_excerpts = isset($options_general['shortcodes_in_excerpts']) && $options_general['shortcodes_in_excerpts'] === '1' ? 'checked="checked"' : '';
1234
+ $post_excerpt_editor = isset($options_general['post_excerpt_editor']) && $options_general['post_excerpt_editor'] === '1' ? 'checked="checked"' : '';
1235
+ $page_excerpt_editor = isset($options_general['page_excerpt_editor']) && $options_general['page_excerpt_editor'] === '1' ? 'checked="checked"' : '';
1236
+ $profile_editor = isset($options_general['profile_editor']) && $options_general['profile_editor'] === '1' ? 'checked="checked"' : '';
1237
+ $cpt_excerpts = isset($options_general['cpt_excerpt_editor']) ? $options_general['cpt_excerpt_editor'] : array();
1238
+ ?>
1239
+
1240
+ <table cellpadding="8">
1241
+ <tbody>
1242
+ <tr><td><?php _e('Linebreak Shortcode', 'wp-edit'); ?></td>
1243
+ <td>
1244
+ <input id="linebreak_shortcode" type="checkbox" value="1" name="linebreak_shortcode" <?php echo $linebreak_shortcode; ?> />
1245
+ <label for="linebreak_shortcode"><?php _e('Use the [break] shortcode to insert linebreaks in the editor.', 'wp-edit'); ?></label>
1246
+ </td>
1247
+ </tr>
1248
+ <tr><td><?php _e('Shortcodes in Widgets', 'wp-edit'); ?></td>
1249
+ <td>
1250
+ <input id="shortcodes_in_widgets" type="checkbox" value="1" name="shortcodes_in_widgets" <?php echo $shortcodes_in_widgets; ?> />
1251
+ <label for="shortcodes_in_widgets"><?php _e('Use shortcodes in widget areas.', 'wp-edit'); ?></label>
1252
+ </td>
1253
+ </tr>
1254
+ <tr><td><?php _e('Shortcodes in Excerpts', 'wp-edit'); ?></td>
1255
+ <td>
1256
+ <input id="shortcodes_in_excerpts" type="checkbox" value="1" name="shortcodes_in_excerpts" <?php echo $shortcodes_in_excerpts; ?> />
1257
+ <label for="shortcodes_in_excerpts"><?php _e('Use shortcodes in excerpt areas.', 'wp-edit'); ?></label>
1258
+ </td>
1259
+ </tr>
1260
+ <tr><td><?php _e('Profile Editor', 'wp-edit'); ?></td>
1261
+ <td class="jwl_user_cell">
1262
+ <input id="profile_editor" type="checkbox" value="1" name="profile_editor" <?php echo $profile_editor; ?> />
1263
+ <label for="profile_editor"><?php _e('Use modified editor in profile biography field.', 'wp-edit'); ?></label>
1264
+ </td>
1265
+ </tr>
1266
+ </tbody>
1267
+ </table>
1268
+ </div>
1269
+ </div>
1270
+
1271
+ <div class="postbox">
1272
+ <div class="inside">
1273
+
1274
+ <table cellpadding="8">
1275
+ <tbody>
1276
+ <tr><td><?php _e('WP Edit Post Excerpt', 'wp-edit'); ?></td>
1277
+ <td>
1278
+ <input id="post_excerpt_editor" type="checkbox" value="1" name="post_excerpt_editor" <?php echo $post_excerpt_editor; ?> />
1279
+ <label for="post_excerpt_editor"><?php _e('Add the WP Edit editor to the Post Excerpt area.', 'wp-edit'); ?></label>
1280
+ </td>
1281
+ </tr>
1282
+ <tr><td><?php _e('WP Edit Page Excerpt', 'wp-edit'); ?></td>
1283
+ <td>
1284
+ <input id="page_excerpt_editor" type="checkbox" value="1" name="page_excerpt_editor" <?php echo $page_excerpt_editor; ?> />
1285
+ <label for="page_excerpt_editor"><?php _e('Add the WP Edit editor to the Page Excerpt area.', 'wp-edit'); ?></label>
1286
+ </td>
1287
+ </tr>
1288
+ </tbody>
1289
+ </table>
1290
+
1291
+ <h3><?php _e('Custom Post Type Excerpts', 'wp-edit'); ?></h3>
1292
+ <table cellpadding="3" style="margin-left:7px;">
1293
+ <tbody>
1294
+ <?php
1295
+ if( !empty( $post_types) ) {
1296
+ foreach ( $post_types as $post_type ) {
1297
+
1298
+ $selected = in_array($post_type, $cpt_excerpts) ? 'checked="checked"' : '';
1299
+ echo '<tr><td><input type="checkbox" name="cpt_excerpt_editor['.$post_type.']" '.$selected.'> '.$post_type.'</td></tr>';
1300
+ }
1301
+ }
1302
+ else {
1303
+
1304
+ echo '<tr><td>';
1305
+ _e('No registered custom post types were found.', 'wp-edit');
1306
+ echo '</td></tr>';
1307
+ }
1308
+ ?>
1309
+ </tbody>
1310
+ </table>
1311
+ </div>
1312
+ </div>
1313
+ </div>
1314
+
1315
+ <input type="submit" value="<?php _e('Save General Options', 'wp-edit'); ?>" class="button button-primary" id="submit_general" name="submit_general">
1316
+ <?php wp_nonce_field( 'wpe_save_general_opts' ); ?>
1317
+ </form>
1318
+ <?php
1319
+ echo '</div>';
1320
+ }
1321
+ /*
1322
+ ****************************************************************
1323
+ Posts/Pages Tab
1324
+ ****************************************************************
1325
+ */
1326
+ else if($active_tab == 'posts'){
1327
+
1328
+ $options_posts = get_option('wp_edit_posts');
1329
+
1330
+ $post_title_field = isset($options_posts['post_title_field']) ? $options_posts['post_title_field'] : 'Enter title here';
1331
+ $column_shortcodes = isset($options_posts['column_shortcodes']) && $options_posts['column_shortcodes'] === '1' ? 'checked="checked"' : '';
1332
+ $disable_wpautop = isset($options_posts['disable_wpautop']) && $options_posts['disable_wpautop'] === '1' ? 'checked="checked"' : '';
1333
+
1334
+ $max_post_revisions = isset($options_posts['max_post_revisions']) ? $options_posts['max_post_revisions'] : '';
1335
+ $max_page_revisions = isset($options_posts['max_page_revisions']) ? $options_posts['max_page_revisions'] : '';
1336
+
1337
+ $hide_admin_posts = isset($options_posts['hide_admin_posts']) ? $options_posts['hide_admin_posts'] : '';
1338
+ $hide_admin_pages = isset($options_posts['hide_admin_pages']) ? $options_posts['hide_admin_pages'] : '';
1339
+
1340
+ echo '<div class="main_container">';
1341
+
1342
+ ?>
1343
+ <h3><?php _e('Posts/pages Options', 'wp-edit'); ?></h3>
1344
+ <form method="post" action="">
1345
+ <div class="metabox-holder">
1346
+ <div class="postbox">
1347
+ <div class="inside">
1348
+ <table cellpadding="8">
1349
+ <tbody>
1350
+ <tr><td><?php _e('Post/Page Default Title', 'wp-edit'); ?></td>
1351
+ <td>
1352
+ <input type="text" name="post_title_field" value="<?php echo $post_title_field ?>" />
1353
+ <label for="post_title_field"><?php _e('Change the default "add new" post/page title field.', 'wp-edit'); ?></label>
1354
+ </td>
1355
+ </tr>
1356
+ <tr><td><?php _e('Column Shortcodes', 'wp-edit'); ?></td>
1357
+ <td>
1358
+ <input id="column_shortcodes" type="checkbox" value="1" name="column_shortcodes" <?php echo $column_shortcodes; ?> />
1359
+ <label for="column_shortcodes"><?php _e('Enable the column shortcodes functionality.', 'wp-edit'); ?></label>
1360
+ </td>
1361
+ </tr>
1362
+ <tr><td><?php _e('Disable wpautop()', 'wp-edit'); ?></td>
1363
+ <td>
1364
+ <input id="disable_wpautop" type="checkbox" value="1" name="disable_wpautop" <?php echo $disable_wpautop; ?> />
1365
+ <label for="disable_wpautop"><?php _e('Disable the filter responsible for removing p and br tags.', 'wp-edit'); ?></label>
1366
+ </td>
1367
+ </tr>
1368
+ </tbody>
1369
+ </table>
1370
+ </div>
1371
+ </div>
1372
+ </div>
1373
+
1374
+ <h3><?php _e('Page Revisions', 'wp-edit'); ?></h3>
1375
+ <div class="metabox-holder">
1376
+ <div class="postbox">
1377
+ <div class="inside">
1378
+ <table cellpadding="8">
1379
+ <tbody>
1380
+ <tr><td><?php _e('Max Post Revisions', 'wp-edit'); ?></td>
1381
+ <td>
1382
+ <input type="text" name="max_post_revisions" value="<?php echo $max_post_revisions ?>" />
1383
+ <label for="max_post_revisions"><?php _e('Set max number of Post Revisions to store in database. (empty = unlimited)', 'wp-edit'); ?></label>
1384
+ </td>
1385
+ </tr>
1386
+ <tr><td><?php _e('Max Page Revisions', 'wp-edit'); ?></td>
1387
+ <td>
1388
+ <input type="text" name="max_page_revisions" value="<?php echo $max_page_revisions ?>" />
1389
+ <label for="max_page_revisions"><?php _e('Set max number of Page Revisions to store in database. (empty = unlimited)', 'wp-edit'); ?></label>
1390
+ </td>
1391
+ </tr>
1392
+ <tr><td><?php _e('Delete Revisions', 'wp-edit'); ?></td>
1393
+ <td>
1394
+ <input id="delete_revisions" type="checkbox" value="1" name="delete_revisions" />
1395
+ <label for="delete_revisions"><?php _e('Delete all database revisions.', 'wp-edit'); ?></label>
1396
+ </td>
1397
+ </tr>
1398
+ <tr><td><?php _e('Revisions DB Size', 'wp-edit'); ?></td>
1399
+ <td>
1400
+ <?php
1401
+ global $wpdb;
1402
+ $query = $wpdb->get_results( "SELECT * FROM $wpdb->posts WHERE post_type = 'revision'", ARRAY_A );
1403
+ $lengths = 0;
1404
+ foreach ($query as $row) {
1405
+ $lengths += strlen($row['post_content']);
1406
+ }
1407
+ _e('Current size of revisions stored in database:', 'wp-edit');
1408
+ echo ' <strong>'.number_format($lengths/(1024*1024),3).' mb</strong>';
1409
+ ?>
1410
+ </td>
1411
+ </tr>
1412
+ </tbody>
1413
+ </table>
1414
+ </div>
1415
+ </div>
1416
+ </div>
1417
+
1418
+ <h3><?php _e('Hide Posts and Pages', 'wp-edit'); ?></h3>
1419
+ <div class="metabox-holder">
1420
+ <div class="postbox">
1421
+ <div class="inside">
1422
+ <table cellpadding="8">
1423
+ <tbody>
1424
+ <tr><td><?php _e('Hide Admin Posts', 'wp-edit'); ?></td>
1425
+ <td>
1426
+ <input type="text" name="hide_admin_posts" value="<?php echo $hide_admin_posts ?>" />
1427
+ <label for="hide_admin_posts"><?php _e('Hide selected posts from admin view. ID comma separated (1,5,14,256)', 'wp-edit'); ?></label>
1428
+ </td>
1429
+ </tr>
1430
+ <tr><td><?php _e('Hide Admin Pages', 'wp-edit'); ?></td>
1431
+ <td>
1432
+ <input type="text" name="hide_admin_pages" value="<?php echo $hide_admin_pages ?>" />
1433
+ <label for="hide_admin_pages"><?php _e('Hide selected pages from admin view. ID comma separated (1,5,14,256)', 'wp-edit'); ?></label>
1434
+ </td>
1435
+ </tr>
1436
+ </tbody>
1437
+ </table>
1438
+ </div>
1439
+ </div>
1440
+ </div>
1441
+ <input type="submit" value="<?php _e('Save Posts/Pages Options', 'wp-edit'); ?>" class="button button-primary" id="submit_posts" name="submit_posts">
1442
+ <?php wp_nonce_field( 'wpe_save_posts_pages_opts' ); ?>
1443
+ </form>
1444
+ <?php
1445
+ echo '</div>';
1446
+ }
1447
+ /*
1448
+ ****************************************************************
1449
+ Editor Tab
1450
+ ****************************************************************
1451
+ */
1452
+ else if($active_tab == 'editor'){
1453
+
1454
+ ?>
1455
+ <form method="post" action="">
1456
+ <div class="main_container">
1457
+
1458
+ <h3><?php _e('Styles Options', 'wp-edit'); ?></h3>
1459
+ <div class="metabox-holder">
1460
+ <div class="postbox">
1461
+ <div class="inside">
1462
+ <p style="margin-left:10px;"><?php _e('Adds predefined styles; which can be applied to editor content.', 'wp-edit'); ?><br />
1463
+ <?php _e('Please be sure the "Formats" button is active in the editor.', 'wp-edit'); ?></p>
1464
+
1465
+ <?php
1466
+ $options_editor = get_option('wp_edit_editor');
1467
+ $editor_add_pre_styles = isset($options_editor['editor_add_pre_styles']) && $options_editor['editor_add_pre_styles'] === '1' ? 'checked="checked"' : '';
1468
+ $default_editor_fontsize_type = isset($options_editor['default_editor_fontsize_type']) ? $options_editor['default_editor_fontsize_type'] : 'pt';
1469
+ $default_editor_fontsize_values = isset($options_editor['default_editor_fontsize_values']) ? $options_editor['default_editor_fontsize_values'] : '';
1470
+ $bbpress_editor = isset($options_editor['bbpress_editor']) && $options_editor['bbpress_editor'] === '1' ? 'checked="checked"' : '';
1471
+ ?>
1472
+
1473
+ <table cellpadding="8">
1474
+ <tbody>
1475
+ <tr><td><?php _e('Add Pre-defined Styles', 'wp-edit'); ?></td>
1476
+ <td>
1477
+ <input id="editor_add_pre_styles" type="checkbox" value="1" name="editor_add_pre_styles" <?php echo $editor_add_pre_styles; ?> />
1478
+ <label for="editor_add_pre_styles"><?php _e('Adds predefined styles to the "Formats" dropdown button.', 'wp-edit'); ?></label>
1479
+ </td>
1480
+ </tr>
1481
+ </tbody>
1482
+ </table>
1483
+ </div>
1484
+ </div>
1485
+ </div>
1486
+
1487
+ <h3><?php _e('TinyMCE Options', 'wp-edit'); ?></h3>
1488
+ <div class="metabox-holder">
1489
+ <div class="postbox">
1490
+ <div class="inside">
1491
+ <p style="margin-left:10px;"><?php _e('These options will adjust various parts of the TinyMCE initialization process.', 'wp-edit'); ?></p>
1492
+
1493
+ <table cellpadding="8">
1494
+ <tbody>
1495
+ <tr><td><?php _e('Dropdown Editor Font-Size Type', 'wp-edit'); ?></td>
1496
+ <td>
1497
+ <input type="radio" name="default_editor_fontsize_type" value="px" <?php if($default_editor_fontsize_type === 'px') echo 'checked="checked"'; ?> /> <?php _e('px', 'wp-edit'); ?><span style="margin-left:10px;"></span>
1498
+ <input type="radio" name="default_editor_fontsize_type" value="pt" <?php if($default_editor_fontsize_type === 'pt') echo 'checked="checked"'; ?> /> <?php _e('pt', 'wp-edit'); ?><span style="margin-left:10px;"></span>
1499
+ <input type="radio" name="default_editor_fontsize_type" value="em" <?php if($default_editor_fontsize_type === 'em') echo 'checked="checked"'; ?> /> <?php _e('em', 'wp-edit'); ?><span style="margin-left:10px;"></span>
1500
+ <input type="radio" name="default_editor_fontsize_type" value="percent" <?php if($default_editor_fontsize_type === 'percent') echo 'checked="checked"'; ?> /> <?php _e('%', 'wp-edit'); ?><br />
1501
+
1502
+ <?php _e('Select the editor font size type displayed in the "Font Size" button dropdown menu.', 'wp-edit'); ?>
1503
+ </td>
1504
+ </tr>
1505
+ <tr><td style="vertical-align:top;"><?php _e('Dropdown Editor Font-Size Type Values', 'wp-edit'); ?></td>
1506
+ <td>
1507
+ <input type="text" name="default_editor_fontsize_values" value="<?php echo $default_editor_fontsize_values; ?>" /><br />
1508
+ <?php _e('Define available font-size values for Font Size dropdown box.', 'wp-edit'); ?><br />
1509
+ <?php _e('Values should be space separated; and end with the chosen font size type (selected above).', 'wp-edit'); ?><br />
1510
+ <?php _e('For Example: If <strong>em</strong> is selected; possible values could be <strong>1em 1.1em 1.2em</strong> etc.', 'wp-edit'); ?>
1511
+ </td>
1512
+ </tr>
1513
+ </tbody>
1514
+ </table>
1515
+ </div>
1516
+ </div>
1517
+ </div>
1518
+
1519
+ <h3><?php _e('BBPress Options', 'wp-edit'); ?></h3>
1520
+ <div class="metabox-holder">
1521
+ <div class="postbox">
1522
+ <div class="inside">
1523
+
1524
+ <p style="margin-left:10px;"><?php _e('Options for the editor used in the BBPress forums.', 'wp-edit'); ?></p>
1525
+
1526
+ <table cellpadding="8">
1527
+ <tbody>
1528
+ <tr><td><?php _e('Enable Visual BBPRess Editor', 'wp-edit'); ?></td>
1529
+ <td>
1530
+ <input id="bbpress_editor" type="checkbox" value="1" name="bbpress_editor" <?php echo $bbpress_editor; ?> />
1531
+ <label for="bbpress_editor"><?php _e('Replaces default textarea with modified visual editor.', 'wp-edit'); ?></label>
1532
+ </td>
1533
+ </tr>
1534
+ </tbody>
1535
+ </table>
1536
+ </div>
1537
+ </div>
1538
+ </div>
1539
+ <input type="submit" value="<?php _e('Save Editor Options', 'wp-edit'); ?>" class="button button-primary" id="submit_editor" name="submit_editor">
1540
+ <?php wp_nonce_field( 'wpe_save_editor_opts' ); ?>
1541
+ </div>
1542
+ </form>
1543
+ <?php
1544
+ }
1545
+ /*
1546
+ ****************************************************************
1547
+ Extras Tab
1548
+ ****************************************************************
1549
+ */
1550
+ else if($active_tab == 'extras') {
1551
+
1552
+ ?>
1553
+ <form method="post" action="">
1554
+ <div class="main_container">
1555
+
1556
+ <h3><?php _e('Extra Options', 'wp-edit'); ?></h3>
1557
+
1558
+ <div class="metabox-holder">
1559
+ <div class="postbox">
1560
+ <div class="inside">
1561
+
1562
+ <h3><?php _e('Signoff Text', 'wp-edit'); ?></h3>
1563
+ <p style="margin-left:10px;"><?php _e('Use the editor below to create a content chunk that can be inserted anywhere using the', 'wp-edit'); ?> <strong>[signoff]</strong> <?php _e('shortcode.', 'wp-edit'); ?></p>
1564
+
1565
+ <table cellpadding="8" width="100%">
1566
+ <tbody>
1567
+ <tr><td>
1568
+ <?php
1569
+ $options_extras = get_option('wp_edit_extras');
1570
+ $content = isset($options_extras['signoff_text']) ? $options_extras['signoff_text'] : 'Please enter text here...';
1571
+ $editor_id = 'wp_edit_signoff';
1572
+ $args = array('textarea_rows' => 10, 'width' => '100px');
1573
+ wp_editor( $content, $editor_id, $args );
1574
+ ?>
1575
+ </td></tr>
1576
+ </tbody>
1577
+ </table>
1578
+ </div>
1579
+ </div>
1580
+ </div>
1581
+
1582
+ <input type="submit" value="Save Extras Options" class="button button-primary" id="submit_extras" name="submit_extras">
1583
+ <?php wp_nonce_field( 'wpe_save_extras_opts' ); ?>
1584
+ </div>
1585
+ </form>
1586
+ <?php
1587
+ }
1588
+ /*
1589
+ ****************************************************************
1590
+ User Specific Tab
1591
+ ****************************************************************
1592
+ */
1593
+ else if($active_tab == 'user_specific') {
1594
+
1595
+ global $current_user;
1596
+ $options_user_meta = get_user_meta($current_user->ID, 'aaa_wp_edit_user_meta', true);
1597
+
1598
+ $id_column = isset($options_user_meta['id_column']) && $options_user_meta['id_column'] === '1' ? 'checked="checked"' : '';
1599
+ $thumbnail_column = isset($options_user_meta['thumbnail_column']) && $options_user_meta['thumbnail_column'] === '1' ? 'checked="checked"' : '';
1600
+ $hide_text_tab = isset($options_user_meta['hide_text_tab']) && $options_user_meta['hide_text_tab'] === '1' ? 'checked="checked"' : '';
1601
+ $default_visual_tab = isset($options_user_meta['default_visual_tab']) && $options_user_meta['default_visual_tab'] === '1' ? 'checked="checked"' : '';
1602
+ $dashboard_widget = isset($options_user_meta['dashboard_widget']) && $options_user_meta['dashboard_widget'] === '1' ? 'checked="checked"' : '';
1603
+
1604
+ $enable_highlights = isset($options_user_meta['enable_highlights']) && $options_user_meta['enable_highlights'] === '1' ? 'checked="checked"' : '';
1605
+ $draft_highlight = isset($options_user_meta['draft_highlight']) ? $options_user_meta['draft_highlight'] : '#FFFFFF';
1606
+ $pending_highlight = isset($options_user_meta['pending_highlight']) ? $options_user_meta['pending_highlight'] : '#FFFFFF';
1607
+ $published_highlight = isset($options_user_meta['published_highlight']) ? $options_user_meta['published_highlight'] : '#FFFFFF';
1608
+ $future_highlight = isset($options_user_meta['future_highlight']) ? $options_user_meta['future_highlight'] : '#FFFFFF';
1609
+ $private_highlight = isset($options_user_meta['private_highlight']) ? $options_user_meta['private_highlight'] : '#FFFFFF';
1610
+ ?>
1611
+
1612
+ <form method="post" action="">
1613
+ <div class="main_container">
1614
+
1615
+ <h3><?php _e('User Specific Options', 'wp-edit'); ?></h3>
1616
+ <div class="metabox-holder">
1617
+ <div class="postbox">
1618
+ <div class="inside">
1619
+
1620
+ <p style="margin-left:10px;"><?php _e('These options are stored in individual user meta; meaning each user can set these options independently from one another.', 'wp-edit'); ?></p>
1621
+
1622
+ <table cellpadding="8">
1623
+ <tbody>
1624
+ <tr><td><?php _e('ID Column', 'wp-edit'); ?></td>
1625
+ <td>
1626
+ <input id="id_column" type="checkbox" value="1" name="wp_edit_user_specific[id_column]" <?php echo $id_column; ?> />
1627
+ <label for="id_column"><?php _e('Adds a column to post/page list view for displaying the post/page ID.', 'wp-edit'); ?></label>
1628
+ </td>
1629
+ </tr>
1630
+ <tr><td><?php _e('Thumbnail Column', 'wp-edit'); ?></td>
1631
+ <td>
1632
+ <input id="thumbnail_column" type="checkbox" value="1" name="wp_edit_user_specific[thumbnail_column]" <?php echo $thumbnail_column; ?> />
1633
+ <label for="thumbnail_column"><?php _e('Adds a column to post/page list view for displaying thumbnails.', 'wp-edit'); ?></label>
1634
+ </td>
1635
+ </tr>
1636
+ <tr><td><?php _e('Hide TEXT Tab', 'wp-edit'); ?></td>
1637
+ <td>
1638
+ <input id="hide_text_tab" type="checkbox" value="1" name="wp_edit_user_specific[hide_text_tab]" <?php echo $hide_text_tab; ?> />
1639
+ <label for="hide_text_tab"><?php _e('Hide the editor TEXT tab from view.', 'wp-edit'); ?></label>
1640
+ </td>
1641
+ </tr>
1642
+ <tr><td><?php _e('Default VISUAL Tab', 'wp-edit'); ?></td>
1643
+ <td>
1644
+ <input id="default_visual_tab" type="checkbox" value="1" name="wp_edit_user_specific[default_visual_tab]" <?php echo $default_visual_tab; ?> />
1645
+ <label for="default_visual_tab"><?php _e('Always display VISUAL tab when editor loads.', 'wp-edit'); ?></label>
1646
+ </td>
1647
+ </tr>
1648
+ <tr><td><?php _e('Disable Dashboard Widget', 'wp-edit'); ?></td>
1649
+ <td>
1650
+ <input id="dashboard_widget" type="checkbox" value="1" name="wp_edit_user_specific[dashboard_widget]" <?php echo $dashboard_widget; ?> />
1651
+ <label for="dashboard_widget"><?php _e('Disables WP Edit Pro News Feed dashboard widget.', 'wp-edit'); ?></label>
1652
+ </td>
1653
+ </tr>
1654
+ </tbody>
1655
+ </table>
1656
+ </div>
1657
+ </div>
1658
+ </div>
1659
+
1660
+ <h3><?php _e('Post/Page Highlight Colors', 'wp-edit'); ?></h3>
1661
+ <div class="metabox-holder">
1662
+ <div class="postbox">
1663
+ <div class="inside">
1664
+
1665
+ <p style="margin-left:10px;"><?php _e('These options will allow each user to customize highlight colors for each post/page status.', 'wp-edit'); ?><br />
1666
+ <?php _e('Meaning.. saved posts can be yellow, published posts can be blue, etc.', 'wp-edit'); ?></p>
1667
+
1668
+ <table cellpadding="8">
1669
+ <tbody>
1670
+ <tr><td><?php _e('Enable Highlights', 'wp-edit'); ?></td>
1671
+ <td>
1672
+ <input id="enable_highlights" type="checkbox" value="1" name="wp_edit_user_specific[enable_highlights]" <?php echo $enable_highlights; ?> />
1673
+ <label for="enable_highlights"><?php _e('Enable the Highlight Options below.', 'wp-edit'); ?></label>
1674
+ </td>
1675
+ </tr>
1676
+ <tr><td><?php _e('Draft Highlight', 'wp-edit'); ?></td>
1677
+ <td class="jwl_user_cell">
1678
+ <input id="draft_highlight" type="text" name="wp_edit_user_specific[draft_highlight]" class="color_field" value="<?php echo $draft_highlight; ?>" />
1679
+ </td>
1680
+ </tr>
1681
+ <tr><td><?php _e('Pending Highlight', 'wp-edit'); ?></td>
1682
+ <td class="jwl_user_cell">
1683
+ <input id="pending_highlight" type="text" name="wp_edit_user_specific[pending_highlight]" class="color_field" value="<?php echo $pending_highlight; ?>" />
1684
+ </td>
1685
+ </tr>
1686
+ <tr><td><?php _e('Published Highlight', 'wp-edit'); ?></td>
1687
+ <td class="jwl_user_cell">
1688
+ <input id="published_highlight" type="text" name="wp_edit_user_specific[published_highlight]" class="color_field" value="<?php echo $published_highlight; ?>" />
1689
+ </td>
1690
+ </tr>
1691
+ <tr><td><?php _e('Future Highlight', 'wp-edit'); ?></td>
1692
+ <td class="jwl_user_cell">
1693
+ <input id="future_highlight" type="text" name="wp_edit_user_specific[future_highlight]" class="color_field" value="<?php echo $future_highlight; ?>" />
1694
+ </td>
1695
+ </tr>
1696
+ <tr><td><?php _e('Private Highlight', 'wp-edit'); ?></td>
1697
+ <td class="jwl_user_cell">
1698
+ <input id="private_highlight" type="text" name="wp_edit_user_specific[private_highlight]" class="color_field" value="<?php echo $private_highlight; ?>" />
1699
+ </td>
1700
+ </tr>
1701
+ </tbody>
1702
+ </table>
1703
+ </div>
1704
+ </div>
1705
+ </div>
1706
+
1707
+ <input type="submit" value="<?php _e('Save User Specific Options', 'wp-edit'); ?>" class="button button-primary" id="submit_user_specific" name="submit_user_specific">
1708
+ <?php wp_nonce_field( 'wpe_save_user_specific_opts' ); ?>
1709
+ </div>
1710
+ </form><?php
1711
+ }
1712
+ /*
1713
+ ****************************************************************
1714
+ Database Tab
1715
+ ****************************************************************
1716
+ */
1717
+ else if($active_tab == 'database') {
1718
+ ?>
1719
+ <div class="main_container">
1720
+
1721
+ <h3><?php _e('Database Options', 'wp-edit'); ?></h3>
1722
+
1723
+ <div class="metabox-holder">
1724
+
1725
+ <div class="postbox">
1726
+ <h3><span><?php _e('Export WP Edit Options', 'wp-edit'); ?></span></h3>
1727
+ <div class="inside">
1728
+ <p><?php _e('Export the plugin settings for this site as a .json file. This allows you to easily import the configuration into another site.', 'wp-edit'); ?></p>
1729
+ <form method="post" action="">
1730
+ <p><input type="hidden" name="database_action" value="export_settings" /></p>
1731
+ <p>
1732
+ <?php wp_nonce_field( 'database_action_export_nonce', 'database_action_export_nonce' ); ?>
1733
+ <?php submit_button( __('Export', 'wp-edit'), 'primary', 'submit', false ); ?>
1734
+ </p>
1735
+ </form>
1736
+ </div><!-- .inside -->
1737
+ </div><!-- .postbox -->
1738
+
1739
+ <div class="postbox">
1740
+ <h3><span><?php _e('Import WP Edit Options', 'wp-edit'); ?></span></h3>
1741
+ <div class="inside">
1742
+ <p><?php _e('Import the plugin settings from a .json file. This file can be obtained by exporting the settings on another site using the form above.', 'wp-edit'); ?></p>
1743
+ <form method="post" enctype="multipart/form-data">
1744
+ <p><input type="file" name="import_file"/></p>
1745
+ <p>
1746
+ <input type="hidden" name="database_action" value="import_settings" />
1747
+ <?php wp_nonce_field( 'database_action_import_nonce', 'database_action_import_nonce' ); ?>
1748
+ <?php submit_button( __('Import', 'wp-edit'), 'primary', 'submit', false ); ?>
1749
+ </p>
1750
+ </form>
1751
+ </div><!-- .inside -->
1752
+ </div><!-- .postbox -->
1753
+
1754
+ <div class="postbox">
1755
+ <h3><span><?php _e('Reset WP Edit Options', 'wp-edit'); ?></span></h3>
1756
+ <div class="inside">
1757
+ <p><?php _e('Reset all plugin settings to their original default states.', 'wp-edit'); ?></p>
1758
+ <form method="post" action="">
1759
+ <?php wp_nonce_field( 'reset_db_values_nonce', 'reset_db_values_nonce' ); ?>
1760
+ <input class="button-primary reset_db_values" name="reset_db_values" type="submit" style="display:none;" />
1761
+ <input class="button-primary reset_db_values_confirm" name="reset_db_values_confirm" type="button" value="<?php _e('Reset', 'wp-edit'); ?>" />
1762
+ </p>
1763
+ </form>
1764
+ </div><!-- .inside -->
1765
+ </div><!-- .postbox -->
1766
+
1767
+ <div class="postbox">
1768
+ <h3><span><?php _e('Uninstall WP Edit (Completely)', 'wp-edit'); ?></span></h3>
1769
+ <div class="inside">
1770
+ <p><?php _e('Designed by intention, this plugin will not delete the associated database tables when activating and deactivating.', 'wp-edit'); ?><br />
1771
+ <?php _e('This ensures the data is kept safe when troubleshooting other WordPress conflicts.', 'wp-edit'); ?><br />
1772
+ <?php _e('In order to completely uninstall the plugin, AND remove all associated database tables, please use the option below.', 'wp-edit'); ?><br />
1773
+ </p>
1774
+ <form method="post" action="">
1775
+ <?php wp_nonce_field('wp_edit_uninstall_nonce_check', 'wp_edit_uninstall_nonce'); ?>
1776
+ <input id="plugin" name="plugin" type="hidden" value="wp-edit/main.php" />
1777
+ <input name="uninstall_confirm" id="uninstall_confirm" type="checkbox" value="1" /><label for="uninstall_confirm"></label> <strong><?php _e('Please confirm before proceeding','wp-edit'); ?><br /><br /></strong>
1778
+ <input class="button-primary" name="uninstall" type="submit" value="<?php _e('Uninstall','wp-edit'); ?>" />
1779
+ </form>
1780
+ </div><!-- .inside -->
1781
+ </div><!-- .postbox -->
1782
+
1783
+ </div><!-- .metabox-holder -->
1784
+ </div><!-- .main_container -->
1785
+ <?php
1786
+ }
1787
+ /*
1788
+ ****************************************************************
1789
+ About Tab
1790
+ ****************************************************************
1791
+ */
1792
+ else if($active_tab == 'about') {
1793
+
1794
+ // Get mysql version number (scrape php_info module)
1795
+ ob_start();
1796
+ phpinfo(INFO_MODULES);
1797
+ $info = ob_get_contents();
1798
+ ob_end_clean();
1799
+ $info = stristr($info, 'Client API version');
1800
+ preg_match('/[1-9].[0-9].[1-9][0-9]/', $info, $match);
1801
+ $sql_version = $match[0];
1802
+
1803
+ // Get plugin info
1804
+ $url = WPEDIT_PLUGIN_PATH.'main.php';
1805
+ $plugin_data = get_plugin_data( $url );
1806
+
1807
+ global $wp_version;
1808
+
1809
+ echo '<div class="main_container">';
1810
+
1811
+ ?>
1812
+ <h3><?php _e('Information','wp-edit'); ?></h3>
1813
+
1814
+ <div class="metabox-holder">
1815
+ <div class="postbox">
1816
+ <div class="inside">
1817
+
1818
+ <p><?php _e('Plugin and server version information.', 'wp-edit'); ?></p>
1819
+
1820
+ <table class="table table-bordered" cellpadding="3" style="width:50%;">
1821
+ <tbody>
1822
+ <tr><td><?php _e('WP Edit Pro Version:','wp-edit'); ?></td>
1823
+ <td>
1824
+ <?php echo $plugin_data['Version']; ?>
1825
+ </td>
1826
+ </tr>
1827
+ <tr><td><?php _e('WordPress Version:','wp-edit'); ?></td>
1828
+ <td>
1829
+ <?php echo $wp_version; ?>
1830
+ </td>
1831
+ </tr>
1832
+ <tr><td><?php _e('PHP Version:','wp-edit'); ?></td>
1833
+ <td>
1834
+ <?php echo phpversion(); ?>
1835
+ </td>
1836
+ </tr>
1837
+ <tr><td><?php _e('HTML Version:','wp-edit'); ?></td>
1838
+ <td>
1839
+ <span class="wpep_html_version"></span>
1840
+ </td>
1841
+ </tr>
1842
+ <tr><td><?php _e('MySql Version:','wp-edit'); ?></td>
1843
+ <td>
1844
+ <?php echo $sql_version; ?>
1845
+ </td>
1846
+ </tr>
1847
+ <tr><td><?php _e('jQuery Version:','wp-edit'); ?></td>
1848
+ <td>
1849
+ <?php echo $GLOBALS['wp_scripts']->registered['jquery-core']->ver; ?>
1850
+ </td>
1851
+ </tr>
1852
+ </tbody>
1853
+ </table>
1854
+ </div>
1855
+ </div>
1856
+ </div>
1857
+
1858
+ <h3><?php _e('Support','wp-edit'); ?></h3>
1859
+ <div class="metabox-holder">
1860
+ <div class="postbox">
1861
+ <div class="inside">
1862
+
1863
+ <p><?php _e('Please use the following helpful links for plugin support.', 'wp-edit'); ?></p>
1864
+
1865
+ <table class="table table-bordered" cellpadding="3" style="width:30%;">
1866
+ <tbody>
1867
+ <tr><td><?php _e('Support Forum:','wp-edit'); ?></td>
1868
+ <td>
1869
+ <?php echo '<a target="_blank" href="https://wordpress.org/support/plugin/wp-edit">'.__('Support Forum', 'wp-edit').'</a>'; ?>
1870
+ </td>
1871
+ </tr>
1872
+ <tr><td><?php _e('Knowledge Base:','wp-edit'); ?></td>
1873
+ <td>
1874
+ <?php echo '<a target="_blank" href="http://learn.wpeditpro.com">'.__('Knowledge Base', 'wp-edit').'</a>'; ?>
1875
+ </td>
1876
+ </tr>
1877
+ </tbody>
1878
+ </table>
1879
+ </div>
1880
+ </div>
1881
+ </div>
1882
+
1883
+ <h3><?php _e('Documentation','wp-edit'); ?></h3>
1884
+ <div class="metabox-holder">
1885
+ <div class="postbox">
1886
+ <div class="inside">
1887
+
1888
+ <p><?php _e('Remember, complete plugin documentation can be found on our <a target="_blank" href="http://learn.wpeditpro.com">Knowledge Base</a>.', 'wp-edit'); ?></p>
1889
+ <p><?php _e('Visit the <a target="_blank" href="http://learn.wpeditpro.com/category/plugin-options/">Knowledge Base Plugin Options</a> page to get started.','wp-edit'); ?></p>
1890
+ </div>
1891
+ </div>
1892
+ </div>
1893
+ <?php
1894
+ echo '</div>';
1895
+ }
1896
+ ?>
1897
+ </div><!-- .wrap -->
1898
+
1899
+ <div id="right_column_metaboxes">
1900
+
1901
+ <div class="main_container">
1902
+ <h3><?php _e('WP Edit Pro', 'wp-edit'); ?></h3>
1903
+ <div class="metabox-holder">
1904
+ <div class="postbox">
1905
+ <div class="inside">
1906
+
1907
+ <p><?php _e('Upgrade to WP Edit Pro today; and enjoy additional options such as:', 'wp-edit'); ?></p>
1908
+ <ul class="wpep_pro_upgrade_list">
1909
+ <li><span class="dashicons dashicons-yes"></span><?php _e('4 customizable button rows instead of only 2.', 'wp-edit'); ?></li>
1910
+ <li><span class="dashicons dashicons-yes"></span><?php _e('Create multiple button arrangements.', 'wp-edit'); ?></li>
1911
+ <li><span class="dashicons dashicons-yes"></span><?php _e('Limit users over what buttons they can access.', 'wp-edit'); ?></li>
1912
+ <li><span class="dashicons dashicons-yes"></span><?php _e('Powerful "Snidget" Builder.', 'wp-edit'); ?></li>
1913
+ <li><span class="dashicons dashicons-yes"></span><?php _e('Over 30 additional options and settings.', 'wp-edit'); ?></li>
1914
+ <li><span class="dashicons dashicons-yes"></span><?php _e('Over a dozen additional editor buttons (Image maps, YouTube Videos, and many more!).', 'wp-edit'); ?></li>
1915
+ </ul>
1916
+ <a href="https://wpeditpro.com" target="_blank" class="button-primary"><?php _e('WP Edit Pro', 'wp-edit'); ?></a>
1917
+ </div>
1918
+ </div>
1919
+ </div>
1920
+ </div>
1921
+
1922
+ <div class="main_container">
1923
+ <h3><?php _e('Like this Plugin?', 'wp-edit'); ?></h3>
1924
+ <div class="metabox-holder">
1925
+ <div class="postbox">
1926
+ <div class="inside">
1927
+
1928
+ <p><?php _e('Please take a moment to rate and review this plugin on the WordPress Plugin Repository.', 'wp-edit'); ?></p>
1929
+ <p><a href="https://wordpress.org/plugins/wp-edit/" target="_blank" class="button-primary"><?php _e('Rate Plugin', 'wp-edit'); ?></a></p>
1930
+
1931
+ <?php
1932
+ if ( ! function_exists( 'plugins_api' ) ) {
1933
+ require_once( ABSPATH . 'wp-admin/includes/plugin-install.php' );
1934
+ }
1935
+
1936
+ /** Prepare our query */
1937
+ $call_api = plugins_api( 'plugin_information', array( 'slug' => 'wp-edit', 'fields' => array( 'active_installs' => true ) ) );
1938
+
1939
+ /** Check for Errors & Display the results */
1940
+ if ( is_wp_error( $call_api ) ) {
1941
+
1942
+ echo '<pre>' . print_r( $call_api->get_error_message(), true ) . '</pre>';
1943
+ }
1944
+ else {
1945
+
1946
+ echo '<h3>';
1947
+ _e( 'WP Edit Rating Statistics', 'wp_edit_pro' );
1948
+ echo '</h3>';
1949
+
1950
+ // Get ratings array
1951
+ $ratings = $call_api->ratings;
1952
+
1953
+ echo '<table><tbody>';
1954
+ echo '<tr><td>Downloaded:</td><td>' . number_format( $call_api->downloaded ) . ' times</td></tr>';
1955
+ echo '<tr><td>Active Installs:</td><td>' . number_format( $call_api->active_installs ) . '+</td></tr>';
1956
+ echo '<tr><td>Number of Ratings:</td><td>' . $call_api->num_ratings . '</td></tr>';
1957
+ echo '</tbody></table>';
1958
+ echo '<br />';
1959
+
1960
+ // Calculations
1961
+ $total_ratings = $call_api->num_ratings;
1962
+
1963
+ $five_star = round( ( $ratings[5] / $total_ratings ) * 100 );
1964
+ $four_star = round( ( $ratings[4] / $total_ratings ) * 100 );
1965
+ $three_star = round( ( $ratings[3] / $total_ratings ) * 100 );
1966
+ $two_star = round( ( $ratings[2] / $total_ratings ) * 100 );
1967
+ $one_star = round( ( $ratings[1] / $total_ratings ) * 100 );
1968
+
1969
+ $overall_stars = number_format( ( $call_api->rating / 20 ), 1 );
1970
+
1971
+ // Setup plugin star container
1972
+ echo '<div class="plugin_star_container">';
1973
+ echo '<div class="empty-stars"></div>';
1974
+ echo '<div class="full-stars" style="width:' . $call_api->rating . '%"></div>';
1975
+ echo '</div>';
1976
+
1977
+ echo '<p style="margin:0px 0px 10px;">' . $overall_stars . ' out of 5 stars</p>';
1978
+
1979
+ // Setup plugin rating table
1980
+ echo '<table class="table table_plugin_ratings"><tbody>';
1981
+ echo '<tr><td>5 stars:</td><td><div class="plugin_rating_container"><div class="plugin_rating_percentage" style="width:' . $five_star . '%;"></div></div>' . $ratings[5] . '</td></tr>';
1982
+ echo '<tr><td>4 stars:</td><td><div class="plugin_rating_container"><div class="plugin_rating_percentage" style="width:' . $four_star . '%;"></div></div>' . $ratings[4] . '</td></tr>';
1983
+ echo '<tr><td>3 stars:</td><td><div class="plugin_rating_container"><div class="plugin_rating_percentage" style="width:' . $three_star . '%;"></div></div>' . $ratings[3] . '</td></tr>';
1984
+ echo '<tr><td>2 stars:</td><td><div class="plugin_rating_container"><div class="plugin_rating_percentage" style="width:' . $two_star . '%;"></div></div>' . $ratings[2] . '</td></tr>';
1985
+ echo '<tr><td>1 star:</td><td><div class="plugin_rating_container"><div class="plugin_rating_percentage" style="width:' . $one_star . '%;"></div></div>' . $ratings[1] . '</td></tr>';
1986
+ echo '</tbody></table>';
1987
+ }
1988
+ ?>
1989
+
1990
+ </div>
1991
+ </div>
1992
+ </div>
1993
+ </div>
1994
+ </div>
1995
+
1996
+ <div style="clear:both;"></div>
1997
+ <?php
1998
+ }
1999
+
2000
+
2001
+ /*
2002
+ ****************************************************************
2003
+ Load/Save Page
2004
+ ****************************************************************
2005
+ */
2006
+ public function load_page() {
2007
+
2008
+ /*
2009
+ ****************************************************************
2010
+ If Import Settings was successful... let's alert a message
2011
+ ****************************************************************
2012
+ */
2013
+ if(isset($_GET['import']) && $_GET['import'] === 'true') {
2014
+
2015
+ echo '<div id="message" class="updated"><p>';
2016
+ _e('Plugin settings have been successfully imported.' ,'wp-edit');
2017
+ echo '</p></div>';
2018
+ }
2019
+
2020
+ /*
2021
+ ****************************************************************
2022
+ If Buttons Tab options are submitted
2023
+ ****************************************************************
2024
+ */
2025
+ if(isset($_POST['wpep_reset_buttons'])) {
2026
+
2027
+ // Verify nonce
2028
+ $buttons_opts_nonce = $_REQUEST['_wpnonce'];
2029
+ if ( ! wp_verify_nonce( $buttons_opts_nonce, 'wpe_save_buttons_opts' ) ) {
2030
+
2031
+ echo 'This request could not be verified.';
2032
+ exit;
2033
+ }
2034
+
2035
+ // Check if DB value exists.. if YES, then keep value.. if NO, then replace with protected defaults
2036
+ $options_buttons = $this->global_options_buttons;
2037
+
2038
+ // Set DB values
2039
+ update_option('wp_edit_buttons', $options_buttons);
2040
+
2041
+ // Alert user
2042
+ function wpe_reset_buttons_from_input(){
2043
+
2044
+ echo '<div class="updated">';
2045
+ echo '<p>';
2046
+ _e('Buttons have been reset successfully.','wp-edit');
2047
+ echo '</p>';
2048
+ echo '</div>';
2049
+ }
2050
+ add_action('admin_notices', 'wpe_reset_buttons_from_input');
2051
+ }
2052
+
2053
+ if(isset($_POST['wpep_save_buttons'])) {
2054
+
2055
+ // Verify nonce
2056
+ $buttons_opts_nonce = $_REQUEST['_wpnonce'];
2057
+ if ( ! wp_verify_nonce( $buttons_opts_nonce, 'wpe_save_buttons_opts' ) ) {
2058
+
2059
+ echo 'This request could not be verified.';
2060
+ exit;
2061
+ }
2062
+
2063
+ if(isset($_POST['get_sorted_array_results']) && ($_POST['get_sorted_array_results'] != '')) {
2064
+
2065
+ //***************************************************
2066
+ // Get buttons from hidden div and update database
2067
+ //***************************************************
2068
+ $post_buttons = $_POST['get_sorted_array_results'];
2069
+ $final_button_array = array();
2070
+
2071
+ // Explode first set of containers (breaks into "toolbar1:bold,italic,etc."
2072
+ $explode_containers = explode('*', $post_buttons);
2073
+
2074
+ // Loop each container
2075
+ foreach($explode_containers as $container) {
2076
+
2077
+ // Get rid of first container (empty)
2078
+ if($container != '') {
2079
+
2080
+ // Explode each container
2081
+ $explode_each_container = explode(':', $container);
2082
+ // Replace commas (from js array) with spaces
2083
+ $explode_each_container = str_replace(',', ' ', $explode_each_container);
2084
+
2085
+ // Push key (container) and value (buttons) to final array
2086
+ $final_button_array[$explode_each_container[0]] = $explode_each_container[1];
2087
+ }
2088
+ }
2089
+
2090
+ // Update database buttons
2091
+ update_option('wp_edit_buttons', $final_button_array);
2092
+
2093
+ // Alert user
2094
+ function wpe_save_buttons_from_input(){
2095
+
2096
+ echo '<div class="updated">';
2097
+ echo '<p>';
2098
+ _e('Buttons have been saved successfully.','wp-edit');
2099
+ echo '</p>';
2100
+ echo '</div>';
2101
+ }
2102
+ add_action('admin_notices', 'wpe_save_buttons_from_input');
2103
+ }
2104
+
2105
+ //***************************************************
2106
+ // Check for new buttons
2107
+ //***************************************************
2108
+ /*** Get page buttons ***/
2109
+ $buttons = '';
2110
+ $active_buttons = $_POST['get_sorted_array_results']; // Get each button container value (string)
2111
+ $explode1 = explode('*', $active_buttons); // Explode into button containers (toolbar1:bold,italic,etc)
2112
+ $final_buttons = '';
2113
+
2114
+ foreach($explode1 as $value) {
2115
+
2116
+ $explode2 = explode(':', $value); // Explodes from (toolbar1:bold,italic,link,etc)
2117
+ $button_string = isset($explode2[1]) ? $explode2[1] : ''; // Get second array item (buttons (comma separated))
2118
+
2119
+ if(!empty($button_string)) { // If the buttons string is not empty
2120
+
2121
+ $final_buttons .= $button_string.','; // Create long string of comma separated butttons
2122
+ }
2123
+ }
2124
+
2125
+ // Right trim comma from string
2126
+ $final_buttons = rtrim($final_buttons, ',');
2127
+
2128
+ // Create array of all buttons on page ((bold)(italic)(etc))
2129
+ $page_array = array_filter(explode(',', $final_buttons));
2130
+
2131
+
2132
+ /*** Get default buttons ***/
2133
+ // Get all buttons from initialization code (including any new buttons)
2134
+ $new_wp_edit_class_buttons = new wp_edit_class();
2135
+ $options_buttons = $new_wp_edit_class_buttons->global_options_buttons;
2136
+ $buttons_option = '';
2137
+
2138
+ // Loop each container and extract buttons
2139
+ foreach($options_buttons as $option) {
2140
+
2141
+ $buttons_option .= ' ' . $option; // The list of initialization buttons (as string)
2142
+ }
2143
+
2144
+ // Trim whitespace from left of $buttons_option string (space separated)
2145
+ $buttons_option = ltrim($buttons_option);
2146
+
2147
+ // Explode space separated string into array
2148
+ $buttons_option_array = array_filter(explode(' ', $buttons_option));
2149
+
2150
+ /*** Compare arrays ***/
2151
+ $array_diff = array_diff($buttons_option_array, $page_array);
2152
+
2153
+ // If new buttons were discovered
2154
+ if(!empty($array_diff)) {
2155
+
2156
+ // Get each button name from array difference
2157
+ global $each_button_trim;
2158
+ $each_button = '';
2159
+ foreach($array_diff as $button) { // Loop array to get each button name
2160
+
2161
+ $each_button .= ' '.$button;
2162
+ }
2163
+ // Remove white space from far left of string
2164
+ $each_button_trim = ltrim($each_button);
2165
+
2166
+
2167
+ // Get buttons option and append new buttons to tmce container
2168
+ $db_buttons = get_option('wp_edit_buttons');
2169
+ $db_buttons['tmce_container'] = $db_buttons['tmce_container'].$each_button;
2170
+
2171
+ // Update database
2172
+ update_option('wp_edit_buttons', $db_buttons);
2173
+
2174
+ // Alert user
2175
+ function wpe_alert_user_new_buttons() {
2176
+
2177
+ global $each_button_trim;
2178
+ echo '<div id="message" class="updated"><p>';
2179
+ _e('New buttons were discovered. The following buttons have been added to the Button Container:','wp-edit');
2180
+ echo '<br /><strong>'.$each_button_trim.'</strong>';
2181
+ echo '</p></div>';
2182
+ }
2183
+ add_action('admin_notices', 'wpe_alert_user_new_buttons');
2184
+ }
2185
+
2186
+ //*************************************************************************************************
2187
+ // Check saved database buttons against plugin default buttons.
2188
+ // - Will remove any buttons from rows if they are no longer supported by plugin.
2189
+ //*************************************************************************************************
2190
+
2191
+ // Get user saved buttons
2192
+ $options_buttons = get_option('wp_edit_buttons');
2193
+ // Get default plugin buttons
2194
+ $new_wp_edit_class_buttons = new wp_edit_class();
2195
+ $plugin_buttons = $new_wp_edit_class_buttons->global_options_buttons;
2196
+
2197
+ // Merge all default plugin buttons into single array
2198
+ $all_array = '';
2199
+ foreach($plugin_buttons as $slot_array) {
2200
+
2201
+ if(!empty($slot_array) && $slot_array != '') { // Skip containter array if empty
2202
+ $all_array .= $slot_array.' '; // Create single string of all default plugin buttons
2203
+ }
2204
+ }
2205
+ $all_array = rtrim($all_array, ' '); // Remove trailing right space
2206
+ $plugin_array = explode(' ', $all_array); // Explode at spaces to make single array (this is an array of all current plugin buttons)
2207
+
2208
+
2209
+ // Get filtered plugin buttons
2210
+ $get_filters = $this->filtered_buttons;
2211
+
2212
+ // If the array set is not empty (filters being applied)
2213
+ if( ! empty( $get_filters ) ) {
2214
+ foreach( $get_filters as $key => $values ) {
2215
+
2216
+ $plugin_array[] = $values['button_id'];
2217
+ }
2218
+ }
2219
+
2220
+
2221
+
2222
+ // Create arrays of user saved buttons
2223
+ global $tot_array;
2224
+ $val_array = array();
2225
+ $tot_array = array(); // Used to display results to user
2226
+ foreach($options_buttons as $cont=>$val) { // Break down array
2227
+
2228
+ if(!empty($val) && $val !='') { // Skip container if empty
2229
+ $val_array = explode(' ', $val); // Explode at spaces into array (this is multiarray of each container array of user buttons)
2230
+
2231
+ $rem_array = array(); // Setup removal array
2232
+ foreach($val_array as $item) {
2233
+ if(!in_array($item, $plugin_array)) {
2234
+ // Removed array items
2235
+ $rem_array[] = $item;
2236
+ $tot_array[] = $item;
2237
+ }
2238
+ }
2239
+
2240
+ if($rem_array) {
2241
+
2242
+ $old_opts = $options_buttons[$cont]; // Get option from database values
2243
+ $old_opts = explode(' ', $old_opts); // Explode to array
2244
+ $new_opt_array = array_diff($old_opts, $rem_array); // Compare arrays to remove non-supported buttons
2245
+ $new_opt_array = implode(' ', $new_opt_array); // Implode back to string
2246
+ $options_buttons[$cont] = $new_opt_array; // Set container to new string
2247
+
2248
+ // Update buttons options
2249
+ update_option('wp_edit_buttons', $options_buttons);
2250
+
2251
+ function wpe_remove_buttons_notice() {
2252
+
2253
+ global $tot_array;
2254
+ echo '<div class="updated"><p>';
2255
+ $tot_array = implode(', ', $tot_array);
2256
+ _e('The following buttons have been removed from WP Edit Pro:', 'wp-edit');
2257
+ echo '<br />';
2258
+ echo '<strong>'.$tot_array.'</strong>';
2259
+ echo '</p></div>';
2260
+ }
2261
+ add_action('admin_notices', 'wpe_remove_buttons_notice');
2262
+ }
2263
+ }
2264
+ }
2265
+ }
2266
+
2267
+
2268
+ /*
2269
+ ****************************************************************
2270
+ If Global Tab button was submitted
2271
+ ****************************************************************
2272
+ */
2273
+ if(isset($_POST['submit_global'])) {
2274
+
2275
+ // Verify nonce
2276
+ $global_opts_nonce = $_REQUEST['_wpnonce'];
2277
+ if ( ! wp_verify_nonce( $global_opts_nonce, 'wpe_save_global_opts' ) ) {
2278
+
2279
+ echo 'This request could not be verified.';
2280
+ exit;
2281
+ }
2282
+
2283
+ $options_global = get_option('wp_edit_global');
2284
+ $options_global['jquery_theme'] = isset($_POST['jquery_theme']) ? $_POST['jquery_theme'] : 'smoothness';
2285
+ $options_global['disable_admin_links'] = isset($_POST['disable_admin_links']) ? '1' : '0';
2286
+ $options_global['disable_fancy_tooltips'] = isset($_POST['disable_fancy_tooltips']) ? '1' : '0';
2287
+
2288
+ update_option('wp_edit_global', $options_global);
2289
+
2290
+ function global_saved_notice(){
2291
+
2292
+ echo '<div class="updated"><p>';
2293
+ _e('Global options successfully saved.', 'wp-edit');
2294
+ echo '</p></div>';
2295
+ }
2296
+ add_action('admin_notices', 'global_saved_notice');
2297
+ }
2298
+
2299
+ /*
2300
+ ****************************************************************
2301
+ If General Tab button was submitted
2302
+ ****************************************************************
2303
+ */
2304
+ if(isset($_POST['submit_general'])) {
2305
+
2306
+ // Verify nonce
2307
+ $general_opts_nonce = $_REQUEST['_wpnonce'];
2308
+ if ( ! wp_verify_nonce( $general_opts_nonce, 'wpe_save_general_opts' ) ) {
2309
+
2310
+ echo 'This request could not be verified.';
2311
+ exit;
2312
+ }
2313
+
2314
+ $options_general = get_option('wp_edit_general');
2315
+ $options_general['linebreak_shortcode'] = isset($_POST['linebreak_shortcode']) ? '1' : '0';
2316
+ $options_general['shortcodes_in_widgets'] = isset($_POST['shortcodes_in_widgets']) ? '1' : '0';
2317
+ $options_general['shortcodes_in_excerpts'] = isset($_POST['shortcodes_in_excerpts']) ? '1' : '0';
2318
+ $options_general['post_excerpt_editor'] = isset($_POST['post_excerpt_editor']) ? '1' : '0';
2319
+ $options_general['page_excerpt_editor'] = isset($_POST['page_excerpt_editor']) ? '1' : '0';
2320
+ $options_general['profile_editor'] = isset($_POST['profile_editor']) ? '1' : '0';
2321
+
2322
+ // Save cpt excerpts
2323
+ $cpt_excerpts = array();
2324
+ $options_general['cpt_excerpt_editor'] = array();
2325
+
2326
+ if(isset($_POST['cpt_excerpt_editor'])) {
2327
+
2328
+ $cpt_excerpts = $_POST['cpt_excerpt_editor'];
2329
+
2330
+ // Loop checked cpt's and create array
2331
+ foreach($cpt_excerpts as $key => $value) {
2332
+
2333
+ if($value === 'on')
2334
+ $options_general['cpt_excerpt_editor'][] = $key;
2335
+ }
2336
+ }
2337
+ else {
2338
+ $options_general['cpt_excerpt_editor'] = array();
2339
+ }
2340
+
2341
+ update_option('wp_edit_general', $options_general);
2342
+
2343
+ function general_saved_notice(){
2344
+
2345
+ echo '<div class="updated"><p>';
2346
+ _e('General options successfully saved.', 'wp-edit');
2347
+ echo '</p></div>';
2348
+ }
2349
+ add_action('admin_notices', 'general_saved_notice');
2350
+ }
2351
+
2352
+ /*
2353
+ ****************************************************************
2354
+ If Posts Tab button was submitted
2355
+ ****************************************************************
2356
+ */
2357
+ if(isset($_POST['submit_posts'])) {
2358
+
2359
+ // Verify nonce
2360
+ $posts_pages_opts_nonce = $_REQUEST['_wpnonce'];
2361
+ if ( ! wp_verify_nonce( $posts_pages_opts_nonce, 'wpe_save_posts_pages_opts' ) ) {
2362
+
2363
+ echo 'This request could not be verified.';
2364
+ exit;
2365
+ }
2366
+
2367
+ // Delete database revisions
2368
+ if(isset($_POST['submit_posts']) && isset($_POST['delete_revisions'])) {
2369
+
2370
+ function wp_edit_delete_revisions_admin_notice( ){
2371
+
2372
+ global $wpdb;
2373
+
2374
+ // Get pre DB size
2375
+ $query = $wpdb->get_results( "SHOW TABLE STATUS", ARRAY_A );
2376
+ $size = 0;
2377
+ foreach ($query as $row) {
2378
+ $size += $row["Data_length"] + $row["Index_length"];
2379
+ }
2380
+ $decimals = 2;
2381
+ $mbytes = number_format($size/(1024*1024),$decimals);
2382
+
2383
+ // Delete Post Revisions from DB
2384
+ $query3_raw = "DELETE FROM wp_posts WHERE post_type = 'revision'";
2385
+ $query3 = $wpdb->query($query3_raw);
2386
+ if ($query3) {
2387
+ $deleted_rows = __('Revisions successfully deleted', 'wp-edit');
2388
+ } else {
2389
+ $deleted_rows = __('No POST revisions were found to delete', 'wp-edit');
2390
+ }
2391
+
2392
+ // Get post DB size
2393
+ $query2 = $wpdb->get_results( "SHOW TABLE STATUS", ARRAY_A );
2394
+ $size2 = 0;
2395
+ foreach ($query2 as $row2) {
2396
+ $size2 += $row2["Data_length"] + $row2["Index_length"];
2397
+ }
2398
+ $decimals2 = 2;
2399
+ $mbytes2 = number_format($size2/(1024*1024),$decimals2);
2400
+
2401
+ echo '<div class="updated"><p>';
2402
+ _e('Message: ', 'wp-edit');
2403
+ echo '<strong>'.$deleted_rows.'</strong>.</p><p>';
2404
+ _e('Database size before deletions: ', 'wp-edit');
2405
+ echo '<strong>'.$mbytes.'</strong> ';
2406
+ _e('megabytes.', 'wp-edit');
2407
+ echo '</p><p>';
2408
+ _e('Database Size after deletions: ', 'wp-edit');
2409
+ echo '<strong>'.$mbytes2.'</strong> ';
2410
+ _e('megabytes.', 'wp-edit');
2411
+ echo '</p></div>';
2412
+ }
2413
+ add_action('admin_notices', 'wp_edit_delete_revisions_admin_notice');
2414
+ }
2415
+
2416
+ $options_posts = get_option('wp_edit_posts');
2417
+
2418
+ $options_posts['post_title_field'] = isset($_POST['post_title_field']) ? sanitize_text_field($_POST['post_title_field']) : 'Enter title here';
2419
+ $options_posts['column_shortcodes'] = isset($_POST['column_shortcodes']) ? '1' : '0';
2420
+ $options_posts['disable_wpautop'] = isset($_POST['disable_wpautop']) ? '1' : '0';
2421
+
2422
+ $options_posts['max_post_revisions'] = isset($_POST['max_post_revisions']) ? sanitize_text_field($_POST['max_post_revisions']) : '';
2423
+ $options_posts['max_page_revisions'] = isset($_POST['max_page_revisions']) ? sanitize_text_field($_POST['max_page_revisions']) : '';
2424
+
2425
+ $options_posts['hide_admin_posts'] = isset($_POST['hide_admin_posts']) ? sanitize_text_field($_POST['hide_admin_posts']) : '';
2426
+ $options_posts['hide_admin_pages'] = isset($_POST['hide_admin_pages']) ? sanitize_text_field($_POST['hide_admin_pages']) : '';
2427
+
2428
+ update_option('wp_edit_posts', $options_posts);
2429
+
2430
+ function posts_saved_notice(){
2431
+
2432
+ echo '<div class="updated"><p>';
2433
+ _e('Posts/Pages options successfully saved.', 'wp-edit');
2434
+ echo '</p></div>';
2435
+ }
2436
+ add_action('admin_notices', 'posts_saved_notice');
2437
+ }
2438
+
2439
+ /*
2440
+ ****************************************************************
2441
+ If Editor button was submitted
2442
+ ****************************************************************
2443
+ */
2444
+ if(isset($_POST['submit_editor'])) {
2445
+
2446
+ // Verify nonce
2447
+ $editor_opts_nonce = $_REQUEST['_wpnonce'];
2448
+ if ( ! wp_verify_nonce( $editor_opts_nonce, 'wpe_save_editor_opts' ) ) {
2449
+
2450
+ echo 'This request could not be verified.';
2451
+ exit;
2452
+ }
2453
+
2454
+ $options_editor = get_option('wp_edit_editor');
2455
+
2456
+ $options_editor['editor_add_pre_styles'] = isset($_POST['editor_add_pre_styles']) ? '1' : '0';
2457
+ $options_editor['default_editor_fontsize_type'] = isset($_POST['default_editor_fontsize_type']) ? $_POST['default_editor_fontsize_type'] : 'pt';
2458
+ $options_editor['default_editor_fontsize_values'] = isset($_POST['default_editor_fontsize_values']) ? sanitize_text_field($_POST['default_editor_fontsize_values']) : '';
2459
+ $options_editor['bbpress_editor'] = isset($_POST['bbpress_editor']) ? '1' : '0';
2460
+
2461
+ update_option('wp_edit_editor', $options_editor);
2462
+
2463
+ function editor_saved_notice(){
2464
+
2465
+ echo '<div class="updated"><p>';
2466
+ _e('Editor options successfully saved.', 'wp-edit');
2467
+ echo '</p></div>';
2468
+ }
2469
+ add_action('admin_notices', 'editor_saved_notice');
2470
+ }
2471
+
2472
+ /*
2473
+ ****************************************************************
2474
+ If Extras Tab button was submitted
2475
+ ****************************************************************
2476
+ */
2477
+ if(isset($_POST['submit_extras'])) {
2478
+
2479
+ // Verify nonce
2480
+ $extras_opts_nonce = $_REQUEST['_wpnonce'];
2481
+ if ( ! wp_verify_nonce( $extras_opts_nonce, 'wpe_save_extras_opts' ) ) {
2482
+
2483
+ echo 'This request could not be verified.';
2484
+ exit;
2485
+ }
2486
+
2487
+ $options_extras = get_option('wp_edit_extras');
2488
+ $options_extras['signoff_text'] = isset($_POST['wp_edit_signoff']) ? stripslashes($_POST['wp_edit_signoff']) : 'Please enter text here...';
2489
+
2490
+ update_option('wp_edit_extras', $options_extras);
2491
+
2492
+ function extras_saved_notice(){
2493
+
2494
+ echo '<div class="updated"><p>';
2495
+ _e('Extra options saved.', 'wp-edit');
2496
+ echo '</p></div>';
2497
+ }
2498
+ add_action('admin_notices', 'extras_saved_notice');
2499
+ }
2500
+
2501
+ /*
2502
+ ****************************************************************
2503
+ If user specific was submitted
2504
+ ****************************************************************
2505
+ */
2506
+ if(isset($_POST['submit_user_specific'])) {
2507
+
2508
+ // Verify nonce
2509
+ $user_specific_opts_nonce = $_REQUEST['_wpnonce'];
2510
+ if ( ! wp_verify_nonce( $user_specific_opts_nonce, 'wpe_save_user_specific_opts' ) ) {
2511
+
2512
+ echo 'This request could not be verified.';
2513
+ exit;
2514
+ }
2515
+
2516
+ // If User Specific was submitted
2517
+ $post_vars = isset($_POST['wp_edit_user_specific']) ? $_POST['wp_edit_user_specific'] : '';
2518
+
2519
+ global $current_user;
2520
+ $options_user_specific_user_meta = get_user_meta($current_user->ID, 'aaa_wp_edit_user_meta', true);
2521
+
2522
+ $options_user_specific_user_meta['id_column'] = isset($post_vars['id_column']) ? '1' : '0';
2523
+ $options_user_specific_user_meta['thumbnail_column'] = isset($post_vars['thumbnail_column']) ? '1' : '0';
2524
+ $options_user_specific_user_meta['hide_text_tab'] = isset($post_vars['hide_text_tab']) ? '1' : '0';
2525
+ $options_user_specific_user_meta['default_visual_tab'] = isset($post_vars['default_visual_tab']) ? '1' : '0';
2526
+ $options_user_specific_user_meta['dashboard_widget'] = isset($post_vars['dashboard_widget']) ? '1' : '0';
2527
+
2528
+ $options_user_specific_user_meta['enable_highlights'] = isset($post_vars['enable_highlights']) ? '1' : '0';
2529
+ $options_user_specific_user_meta['draft_highlight'] = isset($post_vars['draft_highlight']) ? $post_vars['draft_highlight'] : '';
2530
+ $options_user_specific_user_meta['pending_highlight'] = isset($post_vars['pending_highlight']) ? $post_vars['pending_highlight'] : '';
2531
+ $options_user_specific_user_meta['published_highlight'] = isset($post_vars['published_highlight']) ? $post_vars['published_highlight'] : '';
2532
+ $options_user_specific_user_meta['future_highlight'] = isset($post_vars['future_highlight']) ? $post_vars['future_highlight'] : '';
2533
+ $options_user_specific_user_meta['private_highlight'] = isset($post_vars['private_highlight']) ? $post_vars['private_highlight'] : '';
2534
+
2535
+ update_user_meta($current_user->ID, 'aaa_wp_edit_user_meta', $options_user_specific_user_meta);
2536
+
2537
+ function user_specific_saved_notice(){
2538
+
2539
+ echo '<div class="updated"><p>';
2540
+ _e('User specific options saved.', 'wp-edit');
2541
+ echo '</p></div>';
2542
+ }
2543
+ add_action('admin_notices', 'user_specific_saved_notice');
2544
+ }
2545
+
2546
+ /*
2547
+ ****************************************************************
2548
+ If reset plugin options
2549
+ ****************************************************************
2550
+ */
2551
+ if (isset($_POST['reset_db_values'])) {
2552
+
2553
+ if ( !isset($_POST['reset_db_values_nonce'])) { // Verify nonce
2554
+
2555
+ print __('Sorry, your nonce did not verify.', 'wp-edit');
2556
+ exit;
2557
+ }
2558
+ else {
2559
+
2560
+ // Get current user
2561
+ global $current_user;
2562
+
2563
+ // Set DB values (from class vars)
2564
+ update_option('wp_edit_buttons', $this->global_options_buttons);
2565
+ update_option('wp_edit_global', $this->global_options_global);
2566
+ update_option('wp_edit_general', $this->global_options_general);
2567
+ update_option('wp_edit_posts', $this->global_options_posts);
2568
+ update_option('wp_edit_editor', $this->global_options_editor);
2569
+ update_option('wp_edit_extras', $this->global_options_extras);
2570
+ update_user_meta($current_user->ID, 'aaa_wp_edit_user_meta', $this->global_options_user_specific);
2571
+
2572
+ echo '<div id="message" class="updated"><p>';
2573
+ _e('Plugin settings have been restored to defaults.', 'wp-edit');
2574
+ echo '</p></div>';
2575
+ }
2576
+ }
2577
+
2578
+ /*
2579
+ ****************************************************************
2580
+ If uninstall plugin was submitted
2581
+ ****************************************************************
2582
+ */
2583
+ // Display notice if trying to uninstall but forget to check box
2584
+ if (isset($_POST['uninstall'] ) && !isset($_POST['uninstall_confirm'])) {
2585
+
2586
+ echo '<div id="message" class="error"><p>';
2587
+ _e('You must also check the confirm box before options will be uninstalled and deleted.','wp-edit');
2588
+ echo '</p></div>';
2589
+ }
2590
+ // Uninstall plugin
2591
+ if (isset($_POST['uninstall'], $_POST['uninstall_confirm'] ) ) {
2592
+
2593
+ if ( !isset($_POST['wp_edit_uninstall_nonce']) || !wp_verify_nonce($_POST['wp_edit_uninstall_nonce'],'wp_edit_uninstall_nonce_check') ) { // Verify nonce
2594
+
2595
+ print __('Sorry, your nonce did not verify.', 'wp-edit');
2596
+ exit;
2597
+ }
2598
+ else {
2599
+
2600
+ global $current_user;
2601
+ delete_option('wp_edit_buttons','wp_edit_buttons');
2602
+ delete_option('wp_edit_global','wp_edit_global');
2603
+ delete_option('wp_edit_general','wp_edit_general');
2604
+ delete_option('wp_edit_posts','wp_edit_posts');
2605
+ delete_option('wp_edit_editor','wp_edit_editor');
2606
+ delete_option('wp_edit_extras','wp_edit_extras');
2607
+ delete_option('wp_edit_install','wp_edit_install');
2608
+ delete_user_meta($current_user->ID, 'aaa_wp_edit_user_meta');
2609
+ delete_user_meta($current_user->ID, 'ignore_wpedit_ag_notice');
2610
+
2611
+ // Deactivate the plugin
2612
+ $current = get_option('active_plugins');
2613
+ array_splice($current, array_search( $_POST['plugin'], $current), 1 );
2614
+ update_option('active_plugins', $current);
2615
+
2616
+ // Redirect to plugins page with 'plugin deactivated' status message
2617
+ wp_redirect( admin_url('/plugins.php?deactivate=true') );
2618
+ exit;
2619
+ }
2620
+ }
2621
+ }
2622
+
2623
+ /*
2624
+ ****************************************************************
2625
+ Admin Init
2626
+ ****************************************************************
2627
+ */
2628
+ public function process_activation_redirect() {
2629
+
2630
+ // Check for redirect option after plugin activation
2631
+ $re_url = admin_url('admin.php?page=wp_edit_options');
2632
+ if (get_option('wp_edit_activation_redirect', false)) {
2633
+
2634
+ delete_option('wp_edit_activation_redirect');
2635
+ wp_redirect($re_url);
2636
+ }
2637
+ }
2638
+
2639
+ /*
2640
+ ****************************************************************
2641
+ Export Options
2642
+ ****************************************************************
2643
+ */
2644
+ public function process_settings_export() {
2645
+
2646
+ if( empty( $_POST['database_action'] ) || 'export_settings' != $_POST['database_action'] )
2647
+ return;
2648
+
2649
+ if( ! wp_verify_nonce( $_POST['database_action_export_nonce'], 'database_action_export_nonce' ) )
2650
+ return;
2651
+
2652
+ if( ! current_user_can( 'manage_options' ) )
2653
+ return;
2654
+
2655
+ // Get DB values
2656
+ global $current_user;
2657
+
2658
+ $options_buttons = get_option('wp_edit_buttons');
2659
+ $options_global = get_option('wp_edit_global');
2660
+ $options_general = get_option('wp_edit_general');
2661
+ $options_posts = get_option('wp_edit_posts');
2662
+ $options_editor = get_option('wp_edit_editor');
2663
+ $options_extras = get_option('wp_edit_extras');
2664
+ $options_user_specific = get_user_meta($current_user->ID, 'aaa_wp_edit_user_meta', true);
2665
+
2666
+ $options_export_array = array(
2667
+ 'wp_edit_buttons' => $options_buttons,
2668
+ 'wp_edit_global' => $options_global,
2669
+ 'wp_edit_general' => $options_general,
2670
+ 'wp_edit_posts' => $options_posts,
2671
+ 'wp_edit_editor' => $options_editor,
2672
+ 'wp_edit_extras' => $options_extras,
2673
+ 'wp_edit_user_specific' => $options_user_specific
2674
+ );
2675
+
2676
+ ignore_user_abort( true );
2677
+
2678
+ nocache_headers();
2679
+ header( 'Content-Type: application/json; charset=utf-8' );
2680
+ header( 'Content-Disposition: attachment; filename=wp_edit_settings_export-' . date( 'm-d-Y' ) . '.json' );
2681
+ header( "Expires: 0" );
2682
+
2683
+ echo json_encode( $options_export_array );
2684
+ exit;
2685
+ }
2686
+
2687
+ /*
2688
+ ****************************************************************
2689
+ Import Options
2690
+ ****************************************************************
2691
+ */
2692
+ public function process_settings_import() {
2693
+
2694
+ if( empty( $_POST['database_action'] ) || 'import_settings' != $_POST['database_action'] )
2695
+ return;
2696
+
2697
+ if( ! wp_verify_nonce( $_POST['database_action_import_nonce'], 'database_action_import_nonce' ) )
2698
+ return;
2699
+
2700
+ if( ! current_user_can( 'manage_options' ) )
2701
+ return;
2702
+
2703
+ $extension = end( explode( '.', $_FILES['import_file']['name'] ) );
2704
+
2705
+ if( $extension != 'json' ) {
2706
+ wp_die( __('Please upload a valid .json file', 'wp-edit' ) );
2707
+ }
2708
+
2709
+ $import_file = $_FILES['import_file']['tmp_name'];
2710
+
2711
+ if( empty( $import_file ) ) {
2712
+ wp_die( __('Please upload a file to import', 'wp-edit') );
2713
+ }
2714
+
2715
+ global $current_user;
2716
+
2717
+ // Retrieve the settings from the file and convert the json object to an array.
2718
+ $settings = (array) json_decode( file_get_contents( $import_file ), true );
2719
+ foreach ($settings as $key => $value) {
2720
+
2721
+ // First update user meta
2722
+ if($key === 'wp_edit_user_specific') {
2723
+
2724
+ $value = (array) $value;
2725
+ update_user_meta($current_user->ID, 'aaa_wp_edit_user_meta', $value);
2726
+ }
2727
+ // Else update other options
2728
+ else {
2729
+
2730
+ $value = (array) $value;
2731
+ update_option($key, $value);
2732
+ }
2733
+ }
2734
+
2735
+ // Redirect to database page with added parameter = true
2736
+ wp_safe_redirect( admin_url( 'admin.php?page=wp_edit_options&tab=database&import=true' ) );
2737
+ exit;
2738
+ }
2739
+
2740
+ /*
2741
+ ****************************************************************
2742
+ Before wp tinymce
2743
+ ****************************************************************
2744
+ */
2745
+ public function before_wp_tiny_mce() {
2746
+
2747
+ // Add WP dashicons css file to editor
2748
+ echo '<link rel="stylesheet" type="text/css" href="'.plugins_url().'/wp-edit/css/tinymce_dashicons.css" />';
2749
+ }
2750
+
2751
+ /*
2752
+ ****************************************************************
2753
+ Tinymce before init
2754
+ ****************************************************************
2755
+ */
2756
+ public function wp_edit_tiny_mce_before_init($init) {
2757
+
2758
+ // Initialize table ability
2759
+ if (isset($init['tools'])) {
2760
+ $init['tools'] = $init['tools'].',inserttable';
2761
+ } else {
2762
+ $init['tools'] = 'inserttable';
2763
+ }
2764
+
2765
+ // Get editor default fontsize type value
2766
+ $opts_editor = get_option('wp_edit_editor');
2767
+ $default_editor_fontsize_type = isset($opts_editor['default_editor_fontsize_type']) ? $opts_editor['default_editor_fontsize_type'] : 'pt';
2768
+
2769
+ // Pass values to editor initialization
2770
+ if($default_editor_fontsize_type === 'px') {
2771
+
2772
+ $new_px = isset($opts_editor['default_editor_fontsize_values']) && !empty($opts_editor['default_editor_fontsize_values']) ? $opts_editor['default_editor_fontsize_values'] : '6px 8px 9px 10px 11px 12px 13px 14px 15px 16px 18px 20px 22px 24px 28px 32px 48px 72px';
2773
+
2774
+ if(isset($init['fontsize_formats'])) {
2775
+ $init['fontsize_formats'] = $init['fontsize_formats'].' '.$new_px;
2776
+ } else {
2777
+ $init['fontsize_formats'] = $new_px;
2778
+ }
2779
+ }
2780
+ else if($default_editor_fontsize_type === 'pt') {
2781
+
2782
+ $new_pt = isset($opts_editor['default_editor_fontsize_values']) && !empty($opts_editor['default_editor_fontsize_values']) ? $opts_editor['default_editor_fontsize_values'] : '6pt 8pt 10pt 12pt 14pt 16pt 18pt 20pt 22pt 24pt 26pt 28pt 30pt 32pt 34pt 36pt 48pt 72pt';
2783
+
2784
+ if(isset($init['fontsize_formats'])) {
2785
+ $init['fontsize_formats'] = $init['fontsize_formats'].' '.$new_pt;
2786
+ } else {
2787
+ $init['fontsize_formats'] = $new_pt;
2788
+ }
2789
+ }
2790
+ else if($default_editor_fontsize_type === 'em') {
2791
+
2792
+ $new_em = isset($opts_editor['default_editor_fontsize_values']) && !empty($opts_editor['default_editor_fontsize_values']) ? $opts_editor['default_editor_fontsize_values'] : '.8em 1em 1.2em 1.4em 1.6em 1.8em 2em';
2793
+
2794
+ if(isset($init['fontsize_formats'])) {
2795
+ $init['fontsize_formats'] = $init['fontsize_formats'].' '.$new_em;
2796
+ } else {
2797
+ $init['fontsize_formats'] = $new_em;
2798
+ }
2799
+ }
2800
+ else if($default_editor_fontsize_type === 'percent') {
2801
+
2802
+ $new_percent = isset($opts_editor['default_editor_fontsize_values']) && !empty($opts_editor['default_editor_fontsize_values']) ? $opts_editor['default_editor_fontsize_values'] : '80% 90% 100% 110% 120%';
2803
+
2804
+ if(isset($init['fontsize_formats'])) {
2805
+ $init['fontsize_formats'] = $init['fontsize_formats'].' '.$new_percent;
2806
+ } else {
2807
+ $init['fontsize_formats'] = $new_percent;
2808
+ }
2809
+ }
2810
+
2811
+ /*
2812
+ ****************************************************************
2813
+ Additional initalization if disable wpautop is true for the post
2814
+ ****************************************************************
2815
+ */
2816
+ // Get post id and meta
2817
+ $post_id = get_the_ID();
2818
+ $post_meta = get_post_meta($post_id);
2819
+ $dis_wpautop = isset($post_meta['_jwl_disable_wpautop']) && !empty($post_meta['_jwl_disable_wpautop']) ? $post_meta['_jwl_disable_wpautop'] : false;
2820
+
2821
+ // Only initialize if the disable wpautop option is enabled in the post meta
2822
+ if ($dis_wpautop != false) {
2823
+
2824
+ $init['wpautop'] = false;
2825
+ $init['indent'] = true;
2826
+ $init['wpep_noautop'] = true;
2827
+ }
2828
+
2829
+ return $init;
2830
+ }
2831
+
2832
+ /*
2833
+ ****************************************************************
2834
+ Tinymce init
2835
+ ****************************************************************
2836
+ */
2837
+ public function wp_edit_init_tinymce() {
2838
+
2839
+
2840
+ $options_buttons = get_option( 'wp_edit_buttons', $this->global_options_buttons );
2841
+ $default_opts = $this->global_options_buttons;
2842
+
2843
+
2844
+ // Define plugin array of database options for comparison
2845
+ $new_array = '';
2846
+ foreach($options_buttons as $slot_array) {
2847
+
2848
+ if(!empty($slot_array) && $slot_array != '') { // Skip containter array if empty
2849
+ $new_array .= $slot_array.' '; // Create single string of all default plugin buttons
2850
+ }
2851
+ }
2852
+ $new_array = rtrim($new_array, ' '); // Remove trailing right space
2853
+ $new_plugin_array = explode(' ', $new_array); // Explode at spaces to make single array (this is an array of all current plugin buttons)
2854
+ $this->new_plugin_array = $new_plugin_array;
2855
+
2856
+
2857
+ // Define plugin array of default buttons for comparison
2858
+ $default_array = '';
2859
+ foreach($default_opts as $slot_array) {
2860
+
2861
+ if(!empty($slot_array) && $slot_array != '') { // Skip containter array if empty
2862
+ $default_array .= $slot_array.' '; // Create single string of all default plugin buttons
2863
+ }
2864
+ }
2865
+ $default_array = rtrim($default_array, ' '); // Remove trailing right space
2866
+ $default_buttons_array = explode(' ', $default_array); // Explode at spaces to make single array (this is an array of all current plugin buttons)
2867
+ $this->default_buttons_array = $default_buttons_array;
2868
+
2869
+
2870
+ // Get filtered plugin buttons array
2871
+ $filtered_plugin_buttons = array();
2872
+ $get_filters = $this->filtered_buttons;
2873
+ // If the array set is not empty (filters being applied)
2874
+ if( ! empty( $get_filters ) ) {
2875
+ foreach( $get_filters as $key => $values ) {
2876
+
2877
+ $filtered_plugin_buttons[] = $values['button_id'];
2878
+ }
2879
+ }
2880
+ $this->filtered_plugin_buttons = $filtered_plugin_buttons;
2881
+
2882
+
2883
+
2884
+ // Build extra plugins array
2885
+ add_filter('mce_external_plugins', array($this, 'wp_edit_mce_external_plugins'));
2886
+
2887
+ // Get options and set appropriate tinymce toolbars
2888
+ foreach ((array)$options_buttons as $key => $value) {
2889
+
2890
+ // Magic is happening right here...
2891
+ if($key == 'tmce_container') { return; }
2892
+ if($key == 'toolbar1') { add_filter('mce_buttons', array($this, 'wp_edit_add_mce')); }
2893
+ if($key == 'toolbar2') { add_filter('mce_buttons_2', array($this, 'wp_edit_add_mce_2')); }
2894
+ }
2895
+ }
2896
+
2897
+ /*
2898
+ ****************************************************************
2899
+ Tinymce external plugins
2900
+ ****************************************************************
2901
+ */
2902
+ public function wp_edit_mce_external_plugins($plugins) {
2903
+
2904
+ $options_buttons = get_option('wp_edit_buttons');
2905
+
2906
+ // Build array of all button names found in active toolbars
2907
+ $final_options = array();
2908
+ $final_options = array_merge(explode(' ', $options_buttons['toolbar1']), explode(' ', $options_buttons['toolbar2']));
2909
+
2910
+ $plugins['table'] = plugins_url() . '/wp-edit/plugins/table/plugin.min.js';
2911
+
2912
+ if(in_array('ltr', $final_options) || in_array('rtl', $final_options)) {
2913
+ $plugins['directionality'] = plugins_url() . '/wp-edit/plugins/directionality/plugin.min.js';
2914
+ }
2915
+ if(in_array('anchor', $final_options)) {
2916
+ $plugins['anchor'] = plugins_url() . '/wp-edit/plugins/anchor/plugin.min.js';
2917
+ }
2918
+ if(in_array('code', $final_options)) {
2919
+ $plugins['code'] = plugins_url() . '/wp-edit/plugins/code/plugin.min.js';
2920
+ }
2921
+ if(in_array('emoticons', $final_options)) {
2922
+ $plugins['emoticons'] = plugins_url() . '/wp-edit/plugins/emoticons/plugin.min.js';
2923
+ }
2924
+ if(in_array('hr', $final_options)) {
2925
+ $plugins['hr'] = plugins_url() . '/wp-edit/plugins/hr/plugin.min.js';
2926
+ }
2927
+ if(in_array('inserttime', $final_options)) {
2928
+ $plugins['insertdatetime'] = plugins_url() . '/wp-edit/plugins/insertdatetime/plugin.min.js';
2929
+ }
2930
+ if(in_array('preview', $final_options)) {
2931
+ $plugins['preview'] = plugins_url() . '/wp-edit/plugins/preview/plugin.min.js';
2932
+ }
2933
+ if(in_array('print', $final_options)) {
2934
+ $plugins['print'] = plugins_url() . '/wp-edit/plugins/print/plugin.min.js';
2935
+ }
2936
+ if(in_array('searchreplace', $final_options)) {
2937
+ $plugins['searchreplace'] = plugins_url() . '/wp-edit/plugins/searchreplace/plugin.min.js';
2938
+ }
2939
+ if(in_array('visualblocks', $final_options)) {
2940
+ $plugins['visualblocks'] = plugins_url() . '/wp-edit/plugins/visualblocks/plugin.min.js';
2941
+ }
2942
+ if(in_array('image_orig', $final_options)) {
2943
+ $plugins['image_orig'] = plugins_url() . '/wp-edit/plugins/image_orig/plugin.min.js';
2944
+ }
2945
+ if(in_array('advlink', $final_options)) {
2946
+ $plugins['advlink'] = plugins_url() . '/wp-edit/plugins/advlink/plugin.js';
2947
+ }
2948
+ if(in_array('acheck', $final_options)) {
2949
+ $plugins['acheck'] = plugins_url() . '/wp-edit/plugins/acheck/plugin.js';
2950
+ }
2951
+ if(in_array('abbr', $final_options)) {
2952
+ $plugins['abbr'] = plugins_url() . '/wp-edit/plugins/abbr/plugin.js';
2953
+ }
2954
+ if(in_array('columnShortcodes', $final_options)) {
2955
+ $plugins['columnShortcodes'] = plugins_url() . '/wp-edit/plugins/columnShortcodes/plugin.js';
2956
+ }
2957
+ if(in_array('nonbreaking', $final_options)) {
2958
+ $plugins['nonbreaking'] = plugins_url() . '/wp-edit/plugins/nonbreaking/plugin.min.js';
2959
+ }
2960
+ if(in_array('eqneditor', $final_options)) {
2961
+ $plugins['eqneditor'] = plugins_url() . '/wp-edit/plugins/eqneditor/plugin.min.js';
2962
+ }
2963
+
2964
+ //*** Tinymce filter if disable wpautop is true for the post ***//
2965
+ // Get post id and meta
2966
+ $post_id = get_the_ID();
2967
+ $post_meta = get_post_meta($post_id);
2968
+ $dis_wpautop = isset($post_meta['_jwl_disable_wpautop']) && !empty($post_meta['_jwl_disable_wpautop']) ? $post_meta['_jwl_disable_wpautop'] : false;
2969
+
2970
+ // Only filter if the disable wpautop option is enabled in the post meta
2971
+ if ($dis_wpautop != false) {
2972
+
2973
+ // Custom editor code to process content html
2974
+ $plugins['wpep_noautop'] = plugins_url() . '/wp-edit/plugins/wpep_noautop/plugin.js';
2975
+ }
2976
+
2977
+ return $plugins;
2978
+ }
2979
+
2980
+ /*
2981
+ ****************************************************************
2982
+ Tinymce mce buttons
2983
+ ****************************************************************
2984
+ */
2985
+ public function wp_edit_add_mce($buttons) {
2986
+
2987
+ $options = get_option('wp_edit_buttons');
2988
+ $options_toolbar1 = $options['toolbar1'];
2989
+ $default_wp_array_toolbar1 = array('bold','italic','strikethrough','bullist','numlist','blockquote','hr','alignleft','aligncenter','alignright','link','unlink','wp_more');
2990
+ $array_back = array();
2991
+
2992
+ $new_plugin_array = $this->new_plugin_array;
2993
+ $default_buttons_array = $this->default_buttons_array;
2994
+ $filtered_plugin_buttons = $this->filtered_plugin_buttons;
2995
+
2996
+ // First, we explode the toolbar in the database
2997
+ $options_toolbar1 = explode(' ', $options_toolbar1);
2998
+
2999
+ // Next, we get the difference between ($options['toolbar1']) and ($buttons)
3000
+ $array_diff = array_diff($buttons, $options_toolbar1);
3001
+
3002
+ // Now, we take the array and loop it to find original buttons
3003
+ if($array_diff) {
3004
+
3005
+ foreach($array_diff as $array) {
3006
+
3007
+ // If the button is NOT in the original array (WP buttons), we know it is another plugin or theme button..
3008
+ if( !in_array( $array, $default_wp_array_toolbar1 ) && !in_array( $array, $new_plugin_array ) ) {
3009
+
3010
+ // Create the new array of additional buttons to pass back to end of toolbar
3011
+ $array_back[] = $array;
3012
+ }
3013
+ }
3014
+ }
3015
+
3016
+ // Loop each saved toolbar button
3017
+ foreach( $options_toolbar1 as $key => $value ) {
3018
+
3019
+ // If button is not a default button (it is a filtered button); and not in filtered plugin buttons (the button was removed when plugin deactivated)
3020
+ if( !in_array( $value, $default_buttons_array ) && !in_array( $value, $filtered_plugin_buttons ) ) {
3021
+
3022
+ unset( $options_toolbar1[$key]);
3023
+ }
3024
+ }
3025
+
3026
+ // Merge the difference onto the end of our saved buttons
3027
+ $merge_buttons = array_merge($options_toolbar1, $array_back);
3028
+
3029
+ return $merge_buttons;
3030
+ }
3031
+ public function wp_edit_add_mce_2($buttons) {
3032
+
3033
+ $options = get_option('wp_edit_buttons');
3034
+ $options_toolbar2 = $options['toolbar2'];
3035
+ $default_wp_array_toolbar2 = array('formatselect','underline','alignjustify','forecolor','pastetext','removeformat','charmap','outdent','indent','undo','redo','wp_help');
3036
+ $array_back = array();
3037
+
3038
+ $new_plugin_array = $this->new_plugin_array;
3039
+ $default_buttons_array = $this->default_buttons_array;
3040
+ $filtered_plugin_buttons = $this->filtered_plugin_buttons;
3041
+
3042
+ // First, we explode the toolbar in the database
3043
+ $options_toolbar2 = explode(' ', $options_toolbar2);
3044
+
3045
+ // Next, we get the difference between ($options['toolbar1']) and ($buttons)
3046
+ $array_diff = array_diff($buttons, $options_toolbar2);
3047
+
3048
+ // Now, we take the array and loop it to find original buttons
3049
+ if($array_diff) {
3050
+
3051
+ foreach($array_diff as $array) {
3052
+
3053
+ // If the button is NOT in the original array (WP buttons), we know it is another plugin or theme button..
3054
+ if( !in_array( $array, $default_wp_array_toolbar2 ) && !in_array( $array, $new_plugin_array ) ) {
3055
+
3056
+ // Create the new array of additional buttons to pass back to end of toolbar
3057
+ $array_back[] = $array;
3058
+ }
3059
+ }
3060
+ }
3061
+
3062
+ // Loop each saved toolbar button
3063
+ foreach( $options_toolbar2 as $key => $value ) {
3064
+
3065
+ // If button is not a default button (it is a filtered button); and not in filtered plugin buttons (the button was removed when plugin deactivated)
3066
+ if( !in_array( $value, $default_buttons_array ) && !in_array( $value, $filtered_plugin_buttons ) ) {
3067
+
3068
+ unset( $options_toolbar2[$key]);
3069
+ }
3070
+ }
3071
+
3072
+ // Merge the difference onto the end of our saved buttons
3073
+ $merge_buttons = array_merge($options_toolbar2, $array_back);
3074
+
3075
+ return $merge_buttons;
3076
+ }
3077
+
3078
+ public function htlmedit_pre($content) {
3079
+
3080
+ // Get post id and meta
3081
+ $post_id = get_the_ID();
3082
+ $post_meta = get_post_meta($post_id);
3083
+ $dis_wpautop = isset($post_meta['_jwl_disable_wpautop']) && !empty($post_meta['_jwl_disable_wpautop']) ? $post_meta['_jwl_disable_wpautop'] : false;
3084
+
3085
+ // Only filter if the disable wpautop option is enabled in the post meta
3086
+ if ($dis_wpautop != false) {
3087
+
3088
+ $content = str_replace( array('&amp;', '&lt;', '&gt;'), array('&', '<', '>'), $content );
3089
+ $content = wpautop( $content );
3090
+ $content = preg_replace( '/^<p>(https?:\/\/[^<> "]+?)<\/p>$/im', '$1', $content );
3091
+ $content = htmlspecialchars( $content, ENT_NOQUOTES, get_option( 'blog_charset' ) );
3092
+ }
3093
+ return $content;
3094
+ }
3095
+
3096
+ /*
3097
+ ****************************************************************
3098
+ Plugin update message
3099
+ ****************************************************************
3100
+ */
3101
+ public function wpedit_plugin_update_cb($plugin_data, $r) {
3102
+
3103
+ $admin_email = get_option('admin_email');
3104
+
3105
+ echo '<br /><br />';
3106
+ echo '<div style="border:1px solid black;border-radius:10px;">';
3107
+
3108
+ echo '<div style="width:30%;padding:10px;float:left;">';
3109
+ echo '<h3>'; _e('Stay Informed', 'wp-edit'); echo '</h3>';
3110
+ _e('Signup to our free <a target="_blank" href="http://www.feedblitz.com/f/?Sub=950320">Feedblitz</a> service; to receive important plugin news, updates and discount offers for our Pro version.', 'wp-edit');
3111
+ echo '<br /><br />';
3112
+ echo 'Email:<br /><input id="wpedit_feedblitz_signup_email" name="EMAIL" type="text" value="'.$admin_email.'" style="width:50%;margin-right:10px;" /><input id="wpedit_feedblitz_signup" type="button" value="Subscribe me! &raquo;" class="button-primary" />';
3113
+ echo '</div>';
3114
+
3115
+ echo '<div style="width:30%;padding:10px;float:left;margin-left:20px;">';
3116
+ echo '<h3>'; _e('Other Plugin News', 'wp-edit'); echo '</h3>';
3117
+ _e('* Plugin documentation is being added to our <a target="_blank" href="http://learn.wpeditpro.com">Knowledge Base</a>. Check back frequently for more tutorial articles.', 'wp-edit');
3118
+ echo '</div>';
3119
+
3120
+ echo '<div style="clear:both;"></div>';
3121
+ echo '</div>';
3122
+ }
3123
+ public function wpedit_plugin_update_js() {
3124
+
3125
+ global $pagenow;
3126
+ if($pagenow == 'plugins.php') {
3127
+
3128
+ echo "<script language='javascript'>
3129
+ jQuery(document).ready(function($) {
3130
+
3131
+ $('#wpedit_feedblitz_signup').click(function() {
3132
+
3133
+ feed_email = $('#wpedit_feedblitz_signup_email').val();
3134
+ window.open('http://www.feedblitz.com/f/?Sub=950320&Email='+feed_email);
3135
+ });
3136
+ });
3137
+ </script>";
3138
+ }
3139
+ }
3140
+
3141
+ }
3142
+ $wp_edit_class = new wp_edit_class();
3143
+
3144
+
3145
+
3146
+ /*
3147
+ ****************************************************************
3148
+ Include Plugin Functions
3149
+ ****************************************************************
3150
+ */
3151
+ include 'includes/functions.php';
3152
+
3153
+
3154
+ /*
3155
+ ****************************************************************
3156
+ Include functions for running predefined styles
3157
+ ****************************************************************
3158
+ */
3159
+ include 'includes/style_formats.php';
3160
+
3161
+
3162
+ /*
3163
+ ****************************************************************
3164
+ Pointers Class
3165
+ ****************************************************************
3166
+ */
3167
+ class wpe_admin_pointers {
3168
+
3169
+ public function __construct() {
3170
+
3171
+ add_action('admin_enqueue_scripts', array($this, 'custom_admin_pointers_header'));
3172
+ }
3173
+
3174
+ public function custom_admin_pointers_header() {
3175
+
3176
+ if ($this->custom_admin_pointers_check()) {
3177
+
3178
+ add_action('admin_print_footer_scripts', array($this, 'custom_admin_pointers_footer'));
3179
+
3180
+ wp_enqueue_script('wp-pointer');
3181
+ wp_enqueue_style('wp-pointer');
3182
+ }
3183
+ }
3184
+
3185
+ public function custom_admin_pointers_check() {
3186
+
3187
+ $admin_pointers = $this->custom_admin_pointers();
3188
+ foreach ( $admin_pointers as $pointer => $array ) {
3189
+ if ( $array['active'] )
3190
+ return true;
3191
+ }
3192
+ }
3193
+
3194
+ public function custom_admin_pointers_footer() {
3195
+
3196
+ $admin_pointers = $this->custom_admin_pointers();
3197
+ ?>
3198
+ <script type="text/javascript">
3199
+ /* <![CDATA[ */
3200
+ ( function($) {
3201
+ <?php
3202
+ foreach ( $admin_pointers as $pointer => $array ) {
3203
+ if ( $array['active'] ) {
3204
+ ?>
3205
+ $('<?php echo $array['anchor_id']; ?>').pointer({
3206
+ content: '<?php echo $array['content']; ?>',
3207
+ position: {
3208
+ edge: '<?php echo $array['edge']; ?>',
3209
+ align: '<?php echo $array['align']; ?>'
3210
+ },
3211
+ close: function() {
3212
+ $.post(ajaxurl, {
3213
+ pointer: '<?php echo $pointer; ?>',
3214
+ action: 'dismiss-wp-pointer'
3215
+ });
3216
+ }
3217
+ }).pointer('open');
3218
+ <?php
3219
+ }
3220
+ }
3221
+ ?>
3222
+ } )(jQuery);
3223
+ /* ]]> */
3224
+ </script>
3225
+ <?php
3226
+ }
3227
+
3228
+ public function custom_admin_pointers() {
3229
+
3230
+ $dismissed = explode( ',', (string) get_user_meta( get_current_user_id(), 'dismissed_wp_pointers', true ) );
3231
+ $version = '1_0'; // replace all periods in 1.0 with an underscore
3232
+ $prefix = 'wpe_admin_pointers_' . $version . '_';
3233
+
3234
+ $new_pointer_content = '<h3>' . __( 'WP Edit Tip' ) . '</h3>';
3235
+ $new_pointer_content .= '<p>' . __( 'If only one row of buttons is visible; try clicking the <a target="_blank" href="http://learn.wpeditpro.com/wordpress-tinymce-editor/#ipt_kb_toc_73_6">"Toolbar Toggle"</a> button to expand/collapse additional editor button rows.' ) . '</p>';
3236
+
3237
+ return array(
3238
+ $prefix . 'toggle_toolbar' => array(
3239
+ 'content' => $new_pointer_content,
3240
+ 'anchor_id' => '#wp-content-editor-container',
3241
+ 'edge' => 'bottom',
3242
+ 'align' => 'top',
3243
+ 'active' => ( ! in_array( $prefix . 'toggle_toolbar', $dismissed ) )
3244
+ )
3245
+ );
3246
+ }
3247
+ }
3248
+ //Initiate admin pointers
3249
+ $wpe_admin_pointers = new wpe_admin_pointers();
3250
+
3251
  ?>
readme.txt CHANGED
@@ -1,161 +1,166 @@
1
- === WP Edit ===
2
- 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.9
7
- Stable tag: 4.0.2
8
- License: GPLv2 or later
9
- License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
-
11
- Take complete control over the WordPress content editor.
12
-
13
- == Description ==
14
-
15
- = Welcome =
16
- Welcome to WP Edit. Finally, take control of the default WordPress editor and unlock the power of additional editor tools. Arrange buttons into toolbars the way you want; to ease your workflow. WP Edit adds dozens of additional custom options to the WordPress editor.
17
-
18
- = NEW Custom Buttons API =
19
- WP Edit now uses a custom buttons API which allows other plugin/theme developers to add their editor buttons into the WP Edit button configuration; allowing a WP Edit user to place the plugin/theme buttons into any desired location.
20
-
21
- Refer your favorite plugin/theme developers to the [WP Edit Custom Buttons API](http://learn.wpeditpro.com/custom-buttons-api/) documentation to get your favorite buttons added to WP Edit.
22
-
23
- = Introduction =
24
- For a riveting video introduction into the possibilities available with WP Edit; please visit [Jupiter Jim's Marketing Team](http://jupiterjim.club/wordpress/tutorials/change-font-family-font-size-wordpress-4-4-1/).
25
-
26
- = Description =
27
-
28
- WP Edit is built around three years of custom WordPress development. WP Edit adds extensive, additional editing functionality to the default WordPress editor. Begin creating content like the pros; without knowing a single bit of HTML or CSS.
29
-
30
- [Subscribe to our Feedblitz List](http://www.feedblitz.com/f/?Sub=950320), and receive news, update notices and more.
31
- [<img title="Subscribe to get updates by email and more!" border="0" src="http://assets.feedblitz.com/chicklets/email/i/25/950320.bmp">](http://www.feedblitz.com/f/?Sub=950320)
32
-
33
- = Most Powerful Features =
34
- WP Edit will provide new buttons, additional options, and extended formatting abilities to the exisiting content editor.
35
-
36
- * Easily insert images, media, YouTube videos, and clip art.
37
- * Create tables via a graphical interface.
38
- * Adjust table cell border and background colors.
39
- * No need to learn HTML and CSS (although the basics can certainly help); use buttons with visual interfaces instead!
40
- * Easily access all shortcodes available to your WordPress environment; and insert them into the content editor.
41
- * Use shortcodes to insert columns.. similar to "magazine" style layouts, in your content areas.
42
-
43
- = Why should you use this plugin? =
44
- Because WP Edit is the culmination of three years development in the WordPress content editor. You can begin creating content (with advanced layouts); easily insert all types of external media (YouTube, Vimeo, etc.); adjust fonts, styles, colors, and sizes; and much more!
45
-
46
- = What is included in the free version? =
47
- * Drag and drop functionality for custom creation of the top row of editor buttons.
48
- * Adds additional editor buttons such as subscript, superscript, insert media, emoticons, search and replace, html editor, preview.. and many more.
49
- * Add your custom editor to excerpt areas and profile descriptions.
50
- * Allow shortcodes in excerpt and widget areas.
51
- * Highlight admin posts/pages based on status (green = published, yellow = draft, etc.)
52
- * Easily import/export plugin options.
53
-
54
- = Why should you upgrade to WP Edit Pro? =
55
- * Drag and drop functionality for custom creation of all rows of editor buttons.
56
- * Powerful network installation functionality; WP Network Ready.
57
- * User roles for custom button arrangements; allow different user roles access to different editor buttons.
58
- * Extreme Custom Widget Builder - create custom widgets just like posts or pages.. and insert them into any widget area or the content editor.
59
-
60
- = Translations =
61
- * Spanish - Provided by Andrew Kurtis with ["WebHostingHub"](http://www.webhostinghub.com).
62
-
63
- = Notes =
64
- * This plugin is provided "as-is"; within the scope of WordPress. We will update this plugin to remain secure, and to follow WP coding standards.
65
- * If you prefer more "dedicated" support, with more advanced and powerful plugin features, please consider upgrading to ["WP Edit Pro"](http://wpeditpro.com).
66
-
67
- = Resources =
68
- * ["Complete Guide to WP Edit Buttons"](http://learn.wpeditpro.com/wp-edit-buttons-guide/)
69
-
70
-
71
- == Installation ==
72
-
73
- * From the WP admin panel, click "Plugins" -> "Add new".
74
- * In the browser input box, type "WP Edit".
75
- * Select the "WP Edit" plugin (authored by "josh401"), and click "Install".
76
- * Activate the plugin.
77
-
78
- OR...
79
-
80
- * Download the plugin from this page.
81
- * Save the .zip file to a location on your computer.
82
- * Open the WP admin panel, and click "Plugins" -> "Add new".
83
- * Click "upload".. then browse to the .zip file downloaded from this page.
84
- * Click "Install".. and then "Activate plugin".
85
-
86
- OR...
87
-
88
- * Download the plugin from this page.
89
- * Extract the .zip file to a location on your computer.
90
- * Use either FTP or your hosts cPanel to gain access to your website file directories.
91
- * Browse to the `wp-content/plugins` directory.
92
- * Upload the extracted `wp_edit` folder to this directory location.
93
- * Open the WP admin panel.. click the "Plugins" page.. and click "Activate" under the newly added "WP Edit" plugin.
94
-
95
-
96
-
97
- == Frequently asked questions ==
98
-
99
- * Nothing at the moment.
100
-
101
- == Screenshots ==
102
-
103
- 1. Create custom button arrangements from a friendly drag and drop interface.
104
- 2. The custom button arrangement will be loaded in the content editor.
105
- 3. Eight tabs packed with options.
106
-
107
- == Changelog ==
108
-
109
- = 4.0.2 =
110
- * 11/17/2017
111
- * Tested to ensure WP 4.9 compatibility.
112
- * Fixed icon to insert date/time.
113
- * Fixed advanced link nofollow checkbox.
114
-
115
-
116
- = 4.0.1 =
117
- * 04/20/2017
118
- * Fixed warnings when plugin is network activated (pertaining to buttons options).
119
- * Altered readme file to better display in new WordPress plugins repository design.
120
-
121
- = 4.0 =
122
- * 10/03/2016
123
- * Added Custom Buttons API; other plugins/themes can add buttons to WP Edit.
124
- * Added dismissable admin notice for Custom Buttons API (help spread the word!).
125
- * Added plugin rating statistics to sidebar (Please rate and review).
126
- * Added nonce fields for every form submission used to save database options.
127
- * Moved plugins.php page styles to properly enqueue (used for notices).
128
-
129
- = 3.9 =
130
- * 09/05/2016
131
- * Added functionality to enable visual editor on BBPress forums (Editor tab).
132
- * Fixed strict standards error on wp_widget_rss_output() function (final fix will be done upstream when WordPress 4.7 is released).
133
- * Adjusted plugin css file.
134
-
135
- = 3.8.1 =
136
- * 05/11/2016
137
- * Removed a stray var_dump() function.
138
-
139
- = 3.8 =
140
- * 05/11/2016
141
- * Added support for WP Edit toolbars in custom post types excerpt areas.
142
- * Fixed deprecated function. (htmledit_pre changed to format_for_editor) (main.php ~line 115).
143
- * Updated introduction video link.
144
- * Minor changes to ensure WordPress 4.6 compatibility.
145
- * Increased stable tag version.
146
-
147
- = 3.7 =
148
- * 01/11/2016
149
-
150
- * Fixed Feedblitz image loading insecure over https.
151
- * Fixed WP_PLUGIN_URL constant; switched to using plugins_url() function.
152
- * Fixed profile biography editor.
153
- * Updated compatibility version.
154
-
155
- = 3.6 =
156
- * 12/16/2015
157
- * Update to be stable with WordPress 4.4.
158
-
159
- == Upgrade Notice ==
160
-
 
 
 
 
 
161
  Nothing at the moment.
1
+ === WP Edit ===
2
+ 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.9.6
7
+ Stable tag: 4.0.3
8
+ License: GPLv2 or later
9
+ License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
+
11
+ Take complete control over the WordPress content editor.
12
+
13
+ == Description ==
14
+
15
+ = Welcome =
16
+ Welcome to WP Edit. Finally, take control of the default WordPress editor and unlock the power of additional editor tools. Arrange buttons into toolbars the way you want; to ease your workflow. WP Edit adds dozens of additional custom options to the WordPress editor.
17
+
18
+ = NEW Custom Buttons API =
19
+ WP Edit now uses a custom buttons API which allows other plugin/theme developers to add their editor buttons into the WP Edit button configuration; allowing a WP Edit user to place the plugin/theme buttons into any desired location.
20
+
21
+ Refer your favorite plugin/theme developers to the [WP Edit Custom Buttons API](http://learn.wpeditpro.com/custom-buttons-api/) documentation to get your favorite buttons added to WP Edit.
22
+
23
+ = Introduction =
24
+ For a riveting video introduction into the possibilities available with WP Edit; please visit [Jupiter Jim's Marketing Team](http://jupiterjim.club/wordpress/tutorials/change-font-family-font-size-wordpress-4-4-1/).
25
+
26
+ = Description =
27
+
28
+ WP Edit is built around three years of custom WordPress development. WP Edit adds extensive, additional editing functionality to the default WordPress editor. Begin creating content like the pros; without knowing a single bit of HTML or CSS.
29
+
30
+ [Subscribe to our Feedblitz List](http://www.feedblitz.com/f/?Sub=950320), and receive news, update notices and more.
31
+ [<img title="Subscribe to get updates by email and more!" border="0" src="http://assets.feedblitz.com/chicklets/email/i/25/950320.bmp">](http://www.feedblitz.com/f/?Sub=950320)
32
+
33
+ = Most Powerful Features =
34
+ WP Edit will provide new buttons, additional options, and extended formatting abilities to the exisiting content editor.
35
+
36
+ * Easily insert images, media, YouTube videos, and clip art.
37
+ * Create tables via a graphical interface.
38
+ * Adjust table cell border and background colors.
39
+ * No need to learn HTML and CSS (although the basics can certainly help); use buttons with visual interfaces instead!
40
+ * Easily access all shortcodes available to your WordPress environment; and insert them into the content editor.
41
+ * Use shortcodes to insert columns.. similar to "magazine" style layouts, in your content areas.
42
+
43
+ = Why should you use this plugin? =
44
+ Because WP Edit is the culmination of three years development in the WordPress content editor. You can begin creating content (with advanced layouts); easily insert all types of external media (YouTube, Vimeo, etc.); adjust fonts, styles, colors, and sizes; and much more!
45
+
46
+ = What is included in the free version? =
47
+ * Drag and drop functionality for custom creation of the top row of editor buttons.
48
+ * Adds additional editor buttons such as subscript, superscript, insert media, emoticons, search and replace, html editor, preview.. and many more.
49
+ * Add your custom editor to excerpt areas and profile descriptions.
50
+ * Allow shortcodes in excerpt and widget areas.
51
+ * Highlight admin posts/pages based on status (green = published, yellow = draft, etc.)
52
+ * Easily import/export plugin options.
53
+
54
+ = Why should you upgrade to WP Edit Pro? =
55
+ * Drag and drop functionality for custom creation of all rows of editor buttons.
56
+ * Powerful network installation functionality; WP Network Ready.
57
+ * User roles for custom button arrangements; allow different user roles access to different editor buttons.
58
+ * Extreme Custom Widget Builder - create custom widgets just like posts or pages.. and insert them into any widget area or the content editor.
59
+
60
+ = Translations =
61
+ * Spanish - Provided by Andrew Kurtis with ["WebHostingHub"](http://www.webhostinghub.com).
62
+
63
+ = Notes =
64
+ * This plugin is provided "as-is"; within the scope of WordPress. We will update this plugin to remain secure, and to follow WP coding standards.
65
+ * If you prefer more "dedicated" support, with more advanced and powerful plugin features, please consider upgrading to ["WP Edit Pro"](http://wpeditpro.com).
66
+
67
+ = Resources =
68
+ * ["Complete Guide to WP Edit Buttons"](http://learn.wpeditpro.com/wp-edit-buttons-guide/)
69
+
70
+
71
+ == Installation ==
72
+
73
+ * From the WP admin panel, click "Plugins" -> "Add new".
74
+ * In the browser input box, type "WP Edit".
75
+ * Select the "WP Edit" plugin (authored by "josh401"), and click "Install".
76
+ * Activate the plugin.
77
+
78
+ OR...
79
+
80
+ * Download the plugin from this page.
81
+ * Save the .zip file to a location on your computer.
82
+ * Open the WP admin panel, and click "Plugins" -> "Add new".
83
+ * Click "upload".. then browse to the .zip file downloaded from this page.
84
+ * Click "Install".. and then "Activate plugin".
85
+
86
+ OR...
87
+
88
+ * Download the plugin from this page.
89
+ * Extract the .zip file to a location on your computer.
90
+ * Use either FTP or your hosts cPanel to gain access to your website file directories.
91
+ * Browse to the `wp-content/plugins` directory.
92
+ * Upload the extracted `wp_edit` folder to this directory location.
93
+ * Open the WP admin panel.. click the "Plugins" page.. and click "Activate" under the newly added "WP Edit" plugin.
94
+
95
+
96
+
97
+ == Frequently asked questions ==
98
+
99
+ * Nothing at the moment.
100
+
101
+ == Screenshots ==
102
+
103
+ 1. Create custom button arrangements from a friendly drag and drop interface.
104
+ 2. The custom button arrangement will be loaded in the content editor.
105
+ 3. Eight tabs packed with options.
106
+
107
+ == Changelog ==
108
+
109
+ = 4.0.3 =
110
+ * Updated readme.
111
+ * Ensured plugin not generating any errors/warnings/notices with current version of WordPress.
112
+ * WordPress 5.0 will include "Gutenberg" (please research); and I am working on a compatible WP Edit version.
113
+
114
+ = 4.0.2 =
115
+ * 11/17/2017
116
+ * Tested to ensure WP 4.9 compatibility.
117
+ * Fixed icon to insert date/time.
118
+ * Fixed advanced link nofollow checkbox.
119
+
120
+
121
+ = 4.0.1 =
122
+ * 04/20/2017
123
+ * Fixed warnings when plugin is network activated (pertaining to buttons options).
124
+ * Altered readme file to better display in new WordPress plugins repository design.
125
+
126
+ = 4.0 =
127
+ * 10/03/2016
128
+ * Added Custom Buttons API; other plugins/themes can add buttons to WP Edit.
129
+ * Added dismissable admin notice for Custom Buttons API (help spread the word!).
130
+ * Added plugin rating statistics to sidebar (Please rate and review).
131
+ * Added nonce fields for every form submission used to save database options.
132
+ * Moved plugins.php page styles to properly enqueue (used for notices).
133
+
134
+ = 3.9 =
135
+ * 09/05/2016
136
+ * Added functionality to enable visual editor on BBPress forums (Editor tab).
137
+ * Fixed strict standards error on wp_widget_rss_output() function (final fix will be done upstream when WordPress 4.7 is released).
138
+ * Adjusted plugin css file.
139
+
140
+ = 3.8.1 =
141
+ * 05/11/2016
142
+ * Removed a stray var_dump() function.
143
+
144
+ = 3.8 =
145
+ * 05/11/2016
146
+ * Added support for WP Edit toolbars in custom post types excerpt areas.
147
+ * Fixed deprecated function. (htmledit_pre changed to format_for_editor) (main.php ~line 115).
148
+ * Updated introduction video link.
149
+ * Minor changes to ensure WordPress 4.6 compatibility.
150
+ * Increased stable tag version.
151
+
152
+ = 3.7 =
153
+ * 01/11/2016
154
+
155
+ * Fixed Feedblitz image loading insecure over https.
156
+ * Fixed WP_PLUGIN_URL constant; switched to using plugins_url() function.
157
+ * Fixed profile biography editor.
158
+ * Updated compatibility version.
159
+
160
+ = 3.6 =
161
+ * 12/16/2015
162
+ * Update to be stable with WordPress 4.4.
163
+
164
+ == Upgrade Notice ==
165
+
166
  Nothing at the moment.