| @@ -1,10 +1,39 @@ | ||
| 1 | 1 | <?php |
| 2 | +if ( ! defined( 'ABSPATH' ) ) | |
| 3 | + exit; | |
| 4 | + | |
| 5 | +add_action( 'admin_init', 'xyz_ihs_tinymce_button' ); | |
| 2 | 6 | |
| 3 | -if(!class_exists('XYZ_Insert_Html_TinyMCESelector')): | |
| 7 | +function xyz_ihs_tinymce_button() { | |
| 8 | + if ( current_user_can( 'edit_posts' ) && current_user_can( 'edit_pages' ) ) { | |
| 9 | + | |
| 10 | + if ( get_user_option('rich_editing') == 'true') { | |
| 11 | + | |
| 12 | + add_filter( 'mce_buttons', 'xyz_ihs_register_tinymce_button' ); | |
| 13 | + add_filter( 'mce_external_plugins', 'xyz_ihs_add_tinymce_button' ); | |
| 14 | + } | |
| 15 | + } | |
| 16 | +} | |
| 4 | 17 | |
| 18 | +function xyz_ihs_register_tinymce_button( $buttons ) { | |
| 19 | + | |
| 20 | + $buttonName = 'xyz_ihs_snippet_selector'; | |
| 21 | + | |
| 22 | + array_push( $buttons, $buttonName); | |
| 23 | + return $buttons; | |
| 24 | +} | |
| 25 | + | |
| 26 | +function xyz_ihs_add_tinymce_button( $plugin_array ) { | |
| 27 | + $plugin_array['xyz_ihs_buttons'] = get_site_url() . '/index.php?wp_ihs=editor_plugin_js'; | |
| 28 | + return $plugin_array; | |
| 29 | +} | |
| 30 | + | |
| 31 | + | |
| 32 | +/*if(!class_exists('XYZ_Insert_Html_TinyMCESelector')): | |
| 33 | + | |
| 5 | 34 | class XYZ_Insert_Html_TinyMCESelector{ |
| 6 | - var $buttonName = 'xyz_ihs_snippet_selecter'; | |
| 35 | + var $buttonName = 'xyz_ihs_snippet_selector'; | |
| 7 | 36 | function addSelector(){ |
| 8 | 37 | // Don't bother doing this stuff if the current user lacks permissions |
| 9 | 38 | if ( ! current_user_can('edit_posts') && ! current_user_can('edit_pages') ) |
| 10 | 39 | return; |
| @@ -23,16 +52,9 @@ | ||
| 23 | 52 | return $buttons; |
| 24 | 53 | } |
| 25 | 54 | |
| 26 | 55 | function registerTmcePlugin($plugin_array){ |
| 27 | - | |
| 28 | - | |
| 29 | - //$xyz_em_confLink = get_site_url()."/index.php?wp_nlm=confirmation&eId=".$xyz_em_emailLastId."&lId=".$listId."&both=".$combineValue."&appurl=".$xyz_em_appendUrl; | |
| 30 | - | |
| 31 | 56 | $plugin_array[$this->buttonName] =get_site_url() . '/index.php?wp_ihs=editor_plugin_js'; |
| 32 | - | |
| 33 | - //$plugin_array[$this->buttonName] = plugins_url() . '/insert-html-snippet/editor_plugin.js.php'; | |
| 34 | - | |
| 35 | 57 | if ( get_user_option('rich_editing') == 'true') |
| 36 | 58 | //var_dump($plugin_array); |
| 37 | 59 | return $plugin_array; |
| 38 | 60 | } |
| @@ -42,6 +64,6 @@ | ||
| 42 | 64 | |
| 43 | 65 | if(!isset($shortcodesXYZEH)){ |
| 44 | 66 | $shortcodesXYZEH = new XYZ_Insert_Html_TinyMCESelector(); |
| 45 | 67 | add_action('admin_head', array($shortcodesXYZEH, 'addSelector')); |
| 46 | -} | |
| 47 | - | |
| 68 | +}*/ | |
| 69 | +?> | |