1 <?php
2
3 /**
4 * This plugin adds capabilities for adding rows and columns from the
5 * Responsiville framework inside the TinyMCE editor in the WordPress
6 * /wp-admin area.
7 *
8 * @author Nevma, http://www.nevma.gr, info@nevma.gr
9 *
10 * @license http://www.gnu.org/licenses/gpl-3.0.en.html GPLv3
11 */
12
13
14
15 /**
16 * Sets up the actions and filters which are necessary for the Vanilla
17 * TinyMCE columns plugin.
18 *
19 * @return void
20 */
21
22 function vanilla_tinymce_columns_add_action () {
23
24 add_filter( 'mce_buttons_2', 'vanilla_tinymce_columns_add_buttons' );
25 add_filter( 'mce_external_plugins', 'vanilla_tinymce_columns_add_plugin_js' );
26
27 add_action( 'admin_head', 'vanilla_tinymce_columns_add_plugin_css' );
28
29 }
30
31 add_action( 'admin_init', 'vanilla_tinymce_columns_add_action' );
32
33
34
35 /**
36 * Adds the Javascript files for the Vanilla TinyMCE columns plugin.
37 *
38 * @param array $plugin_array The array that holds the plugins added to
39 * TinyMCE editor so far.
40 *
41 * @return array The array enhanced.
42 */
43
44 function vanilla_tinymce_columns_add_plugin_js ( $plugin_array ) {
45
46 $plugin_array['vanillacolumns'] = get_template_directory_uri() . '/inc/vanilla/tinymce/js/vanilla-tinymce-columns.js';
47
48 return $plugin_array;
49
50 }
51
52
53
54 /**
55 * Adds the CSS styles for the Vanilla TinyMCE columns plugin.
56 *
57 * @return void
58 */
59
60 function vanilla_tinymce_columns_add_plugin_css () {
61
62 wp_enqueue_style( 'vanilla-tinymce-columns', get_template_directory_uri() . '/inc/vanilla/tinymce/css/vanilla-tinymce-columns.css', false );
63
64 }
65
66
67
68 /**
69 * Adds the buttons of the Vanilla TinyMCE columns plugin.
70 *
71 * @param array $buttons The array that holds the buttons added to the
72 * TinyMCE editor so far.
73 *
74 * @return array The array enhanced .
75 */
76
77 function vanilla_tinymce_columns_add_buttons ( $buttons ) {
78
79 array_push( $buttons, 'twocolumns' );
80 array_push( $buttons, 'threecolumns' );
81 array_push( $buttons, 'fourcolumns' );
82
83 return $buttons;
84
85 }
86
87 ?>