PluginProbe
Easy Bootstrap Shortcode / 3.5
Easy Bootstrap Shortcode v3.5
trunk 2.4.0 2.5 3.4 3.5 3.6 3.7 4.0.0 4.4 4.5 4.5.4 5.0.0 5.0.1 5.0.2
easy-bootstrap-shortcodes / shortcode / functions.php

functions.php in Easy Bootstrap Shortcode 3.5, at shortcode/functions.php

62 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 // Add Shortcode buttons in TinyMCE
4 $elements = array(
5 'toggles',
6 'tabs',
7 'lists',
8 'buttons',
9 'notifications',
10 'wpcolumns',
11 'tables',
12 'tooltip',
13 'iconhead',
14 'panel',
15 'popover'
16 );
17
18 foreach ($elements as $element) {
19 include( $element . '/plugin_shortcode.php');
20 }
21
22
23 // --------------------------------------------------------------------------------------------------------------
24
25 add_action('init', 'add_custom_button');
26
27 function add_custom_button() {
28 //global $elements;
29 // Don't bother doing this stuff if the current user lacks permissions
30 if (!current_user_can('edit_posts') && !current_user_can('edit_pages'))
31 return;
32
33 // Add only in Rich Editor mode
34 if (get_user_option('rich_editing') == 'true') {
35
36 add_filter("mce_external_plugins", "add_custom_plugin");
37 add_filter('mce_buttons_3', 'register_custom_button');
38 }
39 }
40
41 function register_custom_button($buttons) {
42
43 global $elements;
44 foreach ($elements as $element) {
45 $buttons[] = 'oscitas' . $element;
46 }
47 return $buttons;
48 }
49
50 // Load the TinyMCE plugin : editor_plugin.js (wp2.5)
51 function add_custom_plugin($plugin_array) {
52 //print_r($elements); exit;
53 global $elements;
54 foreach ($elements as $element) {
55 $plugin_array['oscitas' . $element] = plugins_url('', __FILE__) . '/' . $element . '/' . $element . '_plugin.js';
56 }
57 /// return $buttons;
58 return $plugin_array;
59 }
60
61 ?>
62