| 1 |
<?php |
| 2 |
|
| 3 |
// Add Shortcode buttons in TinyMCE |
| 4 |
$elements = array( |
| 5 |
'toggles', |
| 6 |
'tabs', |
| 7 |
'lists', |
| 8 |
'deslist', |
| 9 |
'buttons', |
| 10 |
'btngrptool', |
| 11 |
'btngrp', |
| 12 |
'notifications', |
| 13 |
'wpcolumns', |
| 14 |
'tables', |
| 15 |
'tooltip', |
| 16 |
'iconhead', |
| 17 |
'panel', |
| 18 |
'oscpopover', |
| 19 |
'dropdown', |
| 20 |
'labels', |
| 21 |
'well', |
| 22 |
'thumbnail', |
| 23 |
'icon', |
| 24 |
'image', |
| 25 |
'progressbar', |
| 26 |
|
| 27 |
); |
| 28 |
|
| 29 |
foreach ($elements as $element) { |
| 30 |
include( $element . '/plugin_shortcode.php'); |
| 31 |
} |
| 32 |
|
| 33 |
add_action('init', 'osc_add_ebs_buttons_to_tinymce'); |
| 34 |
|
| 35 |
function osc_add_ebs_buttons_to_tinymce() { |
| 36 |
if (!current_user_can('edit_posts') && !current_user_can('edit_pages')) |
| 37 |
return; |
| 38 |
|
| 39 |
if (get_user_option('rich_editing') == 'true') { |
| 40 |
add_filter("mce_external_plugins", "osc_add_ebs_plugin"); |
| 41 |
add_filter('mce_buttons_3', 'osc_register_ebs_button'); |
| 42 |
} |
| 43 |
} |
| 44 |
|
| 45 |
function osc_register_ebs_button($buttons) { |
| 46 |
global $elements; |
| 47 |
foreach ($elements as $element) { |
| 48 |
$buttons[] = 'oscitas' . $element; |
| 49 |
} |
| 50 |
return $buttons; |
| 51 |
} |
| 52 |
|
| 53 |
function osc_add_ebs_plugin($plugin_array) { |
| 54 |
global $elements; |
| 55 |
foreach ($elements as $element) { |
| 56 |
$plugin_array['oscitas' . $element] = plugins_url('', __FILE__) . '/' . $element . '/' . $element . '_plugin.js'; |
| 57 |
} |
| 58 |
return $plugin_array; |
| 59 |
} |
| 60 |
|