PluginProbe
Easy Bootstrap Shortcode / 4.4
Easy Bootstrap Shortcode v4.4
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 4.4, at shortcode/functions.php

251 lines 6.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /*
3 * Add Bootstrap container class if no bootstrap option chosen in css inclusion
4 */
5 // Add Shortcode buttons in TinyMCE
6 $css = get_option( 'EBS_BOOTSTRAP_CSS_LOCATION', 1 );
7 if($css==3){
8 define('EBS_CONTAINER_CLASS',' oscitas-bootstrap-container');
9 define('EBS_POPOVER_TEMPLATE','<div class="popover'.EBS_CONTAINER_CLASS.'"><div class="arrow'.EBS_CONTAINER_CLASS.'"></div><h3 class="popover-title'.EBS_CONTAINER_CLASS.'"></h3><div class="popover-content'.EBS_CONTAINER_CLASS.' "></div></div>');
10 define('EBS_TOOLTIP_TEMPLATE','<div class="tooltip'.EBS_CONTAINER_CLASS.'"><div class="tooltip-arrow'.EBS_CONTAINER_CLASS.'"></div><div class="tooltip-inner'.EBS_CONTAINER_CLASS.'"></div></div>');
11 } else{
12 define('EBS_CONTAINER_CLASS','');
13 define('EBS_POPOVER_TEMPLATE','');
14 define('EBS_TOOLTIP_TEMPLATE','');
15 }
16
17 /*
18 * EBS shortcode list
19 */
20 $elements = array(
21 'toggles',
22 'tabs',
23 'lists',
24 'deslist',
25 'buttons',
26 'btngrptool',
27 'btngrp',
28 'notifications',
29 'wpcolumns',
30 'tables',
31 'tooltip',
32 'iconhead',
33 'panel',
34 'oscpopover',
35 'dropdown',
36 'labels',
37 'well',
38 'thumbnail',
39 'icon',
40 'image',
41 'progressbar',
42 'servicebox',
43 'slider',
44 'badge',
45
46 );
47 function ebs_groups($grps=array()){
48 $grps=array('basic'=>array(
49 'name'=>'Basic Elements',
50 'icon'=>'elements.png'
51 ),'interactive'=>array('name'=>'Interactive', 'icon'=>'interaction.png'),'content'=>array('name'=>'Content', 'icon'=>'content.png'),
52 'miscellaneous'=>array('name'=>'Miscellaneous', 'icon'=>'misc.png'),'columns'=>array('name'=>'Columns', 'icon'=>'column.png')
53 );
54 return $grps;
55 }
56 function ebs_shortcodes($shortcodes=array()){
57 $shortcodes=array(
58 'buttons'=>array('group'=>'basic',
59 'name'=>'Button',
60 'width'=>800,
61 'height'=>''
62 ),
63 'btngrp'=>array('group'=>'basic',
64 'name'=>'Button Group',
65 'width'=>1200,
66 'height'=>''
67 ),
68 'btngrptool'=>array('group'=>'basic',
69 'name'=>'Button Group Toolbar',
70 'width'=>'',
71 'height'=>''
72 ),
73 'notifications'=>array('group'=>'basic',
74 'name'=>'Notifications',
75 'width'=>'',
76 'height'=>''
77 ),
78 'tooltip'=>array('group'=>'basic',
79 'name'=>'Tooltip',
80 'width'=>'',
81 'height'=>''
82 ),
83 'oscpopover'=>array('group'=>'basic',
84 'name'=>'Popover',
85 'width'=>'',
86 'height'=>''
87 ),
88 'dropdown'=>array('group'=>'basic',
89 'name'=>'Button Dropdown',
90 'width'=>'',
91 'height'=>''
92 ),
93 'progressbar'=>array('group'=>'basic',
94 'name'=>'Progress Bar',
95 'width'=>800,
96 'height'=>''
97 ),
98 'toggles'=>array('group'=>'interactive',
99 'name'=>'Accordion',
100 'width'=>980,
101 'height'=>''
102 ),
103
104 'tabs'=>array('group'=>'interactive',
105 'name'=>'Tabs',
106 'width'=>1170,
107 'height'=>''
108 ),
109 'tables'=>array('group'=>'interactive',
110 'name'=>'Tables',
111 'width'=>'',
112 'height'=>''
113 ),
114 'panel'=>array('group'=>'interactive',
115 'name'=>'Panel',
116 'width'=>'',
117 'height'=>''
118 ),
119 'slider'=>array('group'=>'interactive',
120 'name'=>'Slider',
121 'width'=>1100,
122 'height'=>''
123 ),
124 'lists'=>array('group'=>'content',
125 'name'=>'List',
126 'width'=>800,
127 'height'=>''
128 ),
129 'iconhead'=>array('group'=>'content',
130 'name'=>'Icon Heading',
131 'width'=>800,
132 'height'=>''
133 ),
134 'labels'=>array('group'=>'content',
135 'name'=>'Label',
136 'width'=>'',
137 'height'=>''
138 ),
139 'well'=>array('group'=>'content',
140 'name'=>'Well',
141 'width'=>'',
142 'height'=>''
143 ),
144 'deslist'=>array('group'=>'content',
145 'name'=>'Description List',
146 'width'=>'',
147 'height'=>''
148 ),
149 'servicebox'=>array('group'=>'content',
150 'name'=>'Servicebox',
151 'width'=>800,
152 'height'=>''
153 ),
154 'thumbnail'=>array('group'=>'miscellaneous',
155 'name'=>'Responsive Image',
156 'width'=>800,
157 'height'=>''
158 ),
159 'icon'=>array('group'=>'miscellaneous',
160 'name'=>'Icon',
161 'width'=>800,
162 'height'=>''
163 ),
164 'image'=>array('group'=>'miscellaneous',
165 'name'=>'Image Effects',
166 'width'=>800,
167 'height'=>''
168 ),
169 'wpcolumns'=>array('group'=>'columns',
170 'name'=>'Columns',
171 'width'=>1094,
172 'height'=>''
173 )
174
175 );
176
177
178 return $shortcodes;
179 }
180
181 /*
182 * include each shortcode php file
183 */
184 foreach ($elements as $element) {
185 include( $element . '/plugin_shortcode.php');
186 }
187
188 add_action('init', 'osc_add_ebs_buttons_to_tinymce');
189 /*
190 * Add each shortcode js to tinymce editor and create button for it
191 */
192 function osc_add_ebs_buttons_to_tinymce() {
193 $ebsp_editor_opt=get_option('EBS_EDITOR_OPT','icon');
194 if (!current_user_can('edit_posts') && !current_user_can('edit_pages'))
195 return;
196
197 if (get_user_option('rich_editing') == 'true') {
198 add_filter("mce_external_plugins", "osc_add_ebs_plugin");
199 if($ebsp_editor_opt=='icon'){
200 add_filter('mce_buttons_3', 'osc_register_ebs_button',1375.261);
201 } else{
202 add_filter('mce_buttons', 'osc_register_ebs_dropdown',1375.261);
203 }
204 }
205 }
206
207 /*
208 * Create EBS dropdown button
209 */
210 function osc_register_ebs_dropdown($buttons){
211 $buttons[] = 'oscitas_main_dropdown_button';
212 return $buttons;
213 }
214 /*
215 * Create EBS button for each shortcode
216 */
217 function osc_register_ebs_button($buttons) {
218 global $elements;
219 foreach ($elements as $element) {
220 $buttons[] = 'oscitas' . $element;
221 }
222 return $buttons;
223 }
224
225 /*
226 * Include shortcode js
227 */
228 function osc_add_ebs_plugin($plugin_array) {
229 global $elements;
230 foreach ($elements as $element) {
231 $plugin_array['oscitas' . $element] = plugins_url('', __FILE__) . '/' . $element . '/' . $element . '_plugin.js';
232 }
233 $version=floatval(get_bloginfo('version'));
234 if($version<3.9){
235 $plugin_array['oscitas_main_dropdown']=EBS_PLUGIN_URL.'js/oscitas_main_dropdown.js';
236 } else{
237 $plugin_array['oscitas_main_dropdown']=EBS_PLUGIN_URL.'js/oscitas_dropdown_3_9.js';
238 }
239 return $plugin_array;
240
241 }
242
243 /*
244 * Provide shortcode prefix support
245 */
246 function ebs_backward_compatibility_callback($shortcode,$callback){
247
248 $val=get_option('EBS_SHORTCODE_PREFIX','');
249 add_shortcode($val.$shortcode, $callback);
250
251 }