| @@ -1,23 +1,7 @@ | ||
| 1 | 1 | <?php |
| 2 | -/* | |
| 3 | - * Add Bootstrap container class if no bootstrap option chosen in css inclusion | |
| 4 | - */ | |
| 2 | + | |
| 5 | 3 | // 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 | 4 | $elements = array( |
| 21 | 5 | 'toggles', |
| 22 | 6 | 'tabs', |
| 23 | 7 | 'lists', |
| @@ -38,183 +22,27 @@ | ||
| 38 | 22 | 'thumbnail', |
| 39 | 23 | 'icon', |
| 40 | 24 | 'image', |
| 41 | 25 | 'progressbar', |
| 42 | - 'servicebox', | |
| 43 | - 'slider', | |
| 44 | - 'badge', | |
| 45 | - | |
| 26 | + | |
| 46 | 27 | ); |
| 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 | 28 | |
| 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 | 29 | foreach ($elements as $element) { |
| 185 | 30 | include( $element . '/plugin_shortcode.php'); |
| 186 | 31 | } |
| 187 | 32 | |
| 188 | 33 | add_action('init', 'osc_add_ebs_buttons_to_tinymce'); |
| 189 | -/* | |
| 190 | - * Add each shortcode js to tinymce editor and create button for it | |
| 191 | - */ | |
| 34 | + | |
| 192 | 35 | function osc_add_ebs_buttons_to_tinymce() { |
| 193 | - $ebsp_editor_opt=get_option('EBS_EDITOR_OPT','icon'); | |
| 194 | 36 | if (!current_user_can('edit_posts') && !current_user_can('edit_pages')) |
| 195 | 37 | return; |
| 196 | 38 | |
| 197 | 39 | if (get_user_option('rich_editing') == 'true') { |
| 198 | 40 | 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 | - } | |
| 41 | + add_filter('mce_buttons_3', 'osc_register_ebs_button'); | |
| 204 | 42 | } |
| 205 | 43 | } |
| 206 | 44 | |
| 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 | 45 | function osc_register_ebs_button($buttons) { |
| 218 | 46 | global $elements; |
| 219 | 47 | foreach ($elements as $element) { |
| 220 | 48 | $buttons[] = 'oscitas' . $element; |
| @@ -221,31 +49,11 @@ | ||
| 221 | 49 | } |
| 222 | 50 | return $buttons; |
| 223 | 51 | } |
| 224 | 52 | |
| 225 | -/* | |
| 226 | - * Include shortcode js | |
| 227 | - */ | |
| 228 | 53 | function osc_add_ebs_plugin($plugin_array) { |
| 229 | 54 | global $elements; |
| 230 | 55 | foreach ($elements as $element) { |
| 231 | 56 | $plugin_array['oscitas' . $element] = plugins_url('', __FILE__) . '/' . $element . '/' . $element . '_plugin.js'; |
| 232 | 57 | } |
| 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 | 58 | return $plugin_array; |
| 240 | - | |
| 241 | 59 | } |
| 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 | -} | |