PluginProbe
Post Snippets – Custom WordPress Code Snippets Customizer / 1.8
Post Snippets – Custom WordPress Code Snippets Customizer v1.8
4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.1 1.7.2 1.7.3 1.8 1.8.1 1.8.2 1.8.3 1.8.5 1.8.6 1.8.7 1.8.8 1.8.9 1.8.9.1 1.8.9.2 1.9 1.9.1 1.9.2 1.9.3 1.9.4 1.9.5 All 115 releases
post-snippets / tinymce / tinymce.php

tinymce.php in Post Snippets – Custom WordPress Code Snippets Customizer 1.8, at tinymce/tinymce.php

50 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Class that adds a TinyMCE button to the Post editor
4 *
5 */
6 class add_post_snippets_button {
7 var $pluginname = "post_snippets";
8
9 /**
10 * Constructor
11 */
12 function add_post_snippets_button() {
13 // Modify the version when tinyMCE plugins are changed.
14 add_filter('tiny_mce_version', array (&$this, 'change_tinymce_version') );
15
16 // init process for button control
17 add_action('init', array (&$this, 'add_buttons') );
18 }
19
20 function add_buttons() {
21 // Don't bother doing this stuff if the current user lacks permissions
22 if ( !current_user_can('edit_posts') && !current_user_can('edit_pages') ) return;
23
24 // Add only in Rich Editor mode
25 if ( get_user_option('rich_editing') == 'true') {
26 // add the button for wp2.5 in a new way
27 add_filter("mce_external_plugins", array (&$this, "add_tinymce_plugin" ), 5);
28 add_filter('mce_buttons', array (&$this, 'register_button' ), 5);
29 }
30 }
31
32 // used to insert button in wordpress 2.5x editor
33 function register_button($buttons) {
34 array_push($buttons, "separator", $this->pluginname );
35 return $buttons;
36 }
37
38 // Load the TinyMCE plugin : editor_plugin.js (wp2.5)
39 function add_tinymce_plugin($plugin_array) {
40 $plugin_array[$this->pluginname] = post_snippets_URLPATH.'tinymce/editor_plugin.js';
41 return $plugin_array;
42 }
43
44 function change_tinymce_version($version) {
45 return ++$version;
46 }
47 }
48
49 $tinymce_button = new add_post_snippets_button();
50 ?>