| @@ -1,61 +1,59 @@ | ||
| 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 | -?> | |
| 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 | +} | |