| @@ -1,8 +1,36 @@ | ||
| 1 | 1 | <?php |
| 2 | +if ( ! defined( 'ABSPATH' ) ) | |
| 3 | + exit; | |
| 4 | + | |
| 5 | +add_action( 'admin_init', 'xyz_ips_tinymce_button' ); | |
| 2 | 6 | |
| 3 | -if(!class_exists('XYZ_Insert_Php_TinyMCESelector')): | |
| 7 | +function xyz_ips_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_ips_register_tinymce_button' ); | |
| 13 | + add_filter( 'mce_external_plugins', 'xyz_ips_add_tinymce_button' ); | |
| 14 | + } | |
| 15 | + } | |
| 16 | +} | |
| 4 | 17 | |
| 18 | +function xyz_ips_register_tinymce_button( $buttons ) { | |
| 19 | + | |
| 20 | + $buttonName = 'xyz_ips_snippet_selecter'; | |
| 21 | + | |
| 22 | + array_push( $buttons, $buttonName); | |
| 23 | + return $buttons; | |
| 24 | +} | |
| 25 | + | |
| 26 | +function xyz_ips_add_tinymce_button( $plugin_array ) { | |
| 27 | + $plugin_array['xyz_ips_buttons'] = get_site_url() . '/index.php?wp_ips=editor_plugin_js'; | |
| 28 | + return $plugin_array; | |
| 29 | +} | |
| 30 | + | |
| 31 | +/*if(!class_exists('XYZ_Insert_Php_TinyMCESelector')): | |
| 32 | + | |
| 5 | 33 | class XYZ_Insert_Php_TinyMCESelector{ |
| 6 | 34 | var $buttonName = 'xyz_ips_snippet_selecter'; |
| 7 | 35 | function addSelector(){ |
| 8 | 36 | // Don't bother doing this stuff if the current user lacks permissions |
| @@ -35,7 +63,7 @@ | ||
| 35 | 63 | |
| 36 | 64 | if(!isset($shortcodesXYZEP)){ |
| 37 | 65 | $shortcodesXYZEP = new XYZ_Insert_Php_TinyMCESelector(); |
| 38 | 66 | add_action('admin_head', array($shortcodesXYZEP, 'addSelector')); |
| 39 | -} | |
| 67 | +}*/ | |
| 40 | 68 | |
| 41 | 69 | ?> |