Bootstrap Shortcodes - Version 1.5.0

Version Description

Download this release

Release Info

Developer sinetheta
Plugin Icon Bootstrap Shortcodes
Version 1.5.0
Comparing to
See all releases

Code changes from version 1.4.3 to 1.5.0

bootstrap-shortcodes.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Bootstrap Shortcodes
4
  Plugin URI: https://github.com/TheWebShop/bootstrap-shortcodes
5
  Description: A simple shortcode generator. Add buttons, columns, toggles and alerts to your theme.
6
- Version: 1.4.3
7
  Author: Kevin Attfield
8
  Author URI: https://github.com/Sinetheta
9
 
@@ -18,6 +18,7 @@ require_once('inc/bs_well.php');
18
  require_once('inc/bs_buttons.php');
19
  require_once('inc/bs_icons.php');
20
  require_once('inc/bs_lead.php');
 
21
 
22
  class BootstrapShortcodes{
23
 
@@ -29,7 +30,8 @@ class BootstrapShortcodes{
29
  'wells',
30
  'buttons',
31
  'icons',
32
- 'lead'
 
33
  );
34
 
35
  public function __construct() {
@@ -45,12 +47,14 @@ class BootstrapShortcodes{
45
  $options = get_option('bs_options');
46
 
47
  if(!is_admin()){
48
- if( isset($options['chk_default_options_css']) && $options['chk_default_options_css'] ){
49
  wp_enqueue_style("bs_bootstrap", plugins_url('css/bootstrap.css', __FILE__ ) );
50
  wp_enqueue_style("bs_shortcodes", plugins_url('css/shortcodes.css', __FILE__ ) );
51
  }
52
- if( isset($options['chk_default_options_js']) && $options['chk_default_options_js'] )
53
- wp_enqueue_script('bs_bootstrap', plugins_url('js/bootstrap.js', __FILE__ ) ,array('jquery'));
 
 
54
  } else {
55
  wp_enqueue_style("bs_admin_style", plugins_url('css/admin.css', __FILE__ ) );
56
  }
@@ -103,7 +107,8 @@ class BootstrapShortcodes{
103
  "chk_default_options_wells" => "1",
104
  "chk_default_options_buttons" => "1",
105
  "chk_default_options_icons" => "1",
106
- "chk_default_options_lead" => "1"
 
107
  );
108
  update_option( 'bs_options', $arr );
109
  }
3
  Plugin Name: Bootstrap Shortcodes
4
  Plugin URI: https://github.com/TheWebShop/bootstrap-shortcodes
5
  Description: A simple shortcode generator. Add buttons, columns, toggles and alerts to your theme.
6
+ Version: 1.5.0
7
  Author: Kevin Attfield
8
  Author URI: https://github.com/Sinetheta
9
 
18
  require_once('inc/bs_buttons.php');
19
  require_once('inc/bs_icons.php');
20
  require_once('inc/bs_lead.php');
21
+ require_once('inc/bs_tooltip.php');
22
 
23
  class BootstrapShortcodes{
24
 
30
  'wells',
31
  'buttons',
32
  'icons',
33
+ 'lead',
34
+ 'tooltip'
35
  );
36
 
37
  public function __construct() {
47
  $options = get_option('bs_options');
48
 
49
  if(!is_admin()){
50
+ if( isset($options['chk_default_options_css']) && $options['chk_default_options_css'] ) {
51
  wp_enqueue_style("bs_bootstrap", plugins_url('css/bootstrap.css', __FILE__ ) );
52
  wp_enqueue_style("bs_shortcodes", plugins_url('css/shortcodes.css', __FILE__ ) );
53
  }
54
+ if( isset($options['chk_default_options_js']) && $options['chk_default_options_js'] ) {
55
+ wp_enqueue_script('bs_bootstrap', plugins_url('js/bootstrap.js', __FILE__ ) , array('jquery'));
56
+ }
57
+ wp_enqueue_script('bs_init', plugins_url('js/init.js', __FILE__ ) , array('bs_bootstrap'));
58
  } else {
59
  wp_enqueue_style("bs_admin_style", plugins_url('css/admin.css', __FILE__ ) );
60
  }
107
  "chk_default_options_wells" => "1",
108
  "chk_default_options_buttons" => "1",
109
  "chk_default_options_icons" => "1",
110
+ "chk_default_options_lead" => "1",
111
+ "chk_default_options_tooltip" => "1"
112
  );
113
  update_option( 'bs_options', $arr );
114
  }
css/admin.css CHANGED
@@ -6,6 +6,7 @@
6
  .wp_themeSkin .mceSplitButton span.mce_bs_alerts,
7
  .wp_themeSkin .mceSplitButton span.mce_bs_wells,
8
  .wp_themeSkin .mceSplitButton span.mce_bs_buttons,
 
9
  .wp_themeSkin span.mce_bs_icons,
10
  .wp_themeSkin span.mce_bs_lead {
11
  background: url(../images/dwicons.png) no-repeat !important;
@@ -58,6 +59,14 @@
58
  background-position: -107px 0px !important;
59
  }
60
 
 
 
 
 
 
 
 
 
61
  .wp_themeSkin span.mce_bs_icons {
62
  background-position: -128px -19px !important;
63
  }
6
  .wp_themeSkin .mceSplitButton span.mce_bs_alerts,
7
  .wp_themeSkin .mceSplitButton span.mce_bs_wells,
8
  .wp_themeSkin .mceSplitButton span.mce_bs_buttons,
9
+ .wp_themeSkin .mceSplitButton span.mce_bs_tooltip,
10
  .wp_themeSkin span.mce_bs_icons,
11
  .wp_themeSkin span.mce_bs_lead {
12
  background: url(../images/dwicons.png) no-repeat !important;
59
  background-position: -107px 0px !important;
60
  }
61
 
62
+ .wp_themeSkin .mceSplitButton span.mce_bs_tooltip {
63
+ background-position: -170px -19px !important;
64
+ }
65
+ .wp_themeSkin .mceSplitButton:hover span.mce_bs_tooltip,
66
+ .wp_themeSkin .mceSplitButtonSelected .mceSplitButton span.mce_bs_tooltip {
67
+ background-position: -170px 0px !important;
68
+ }
69
+
70
  .wp_themeSkin span.mce_bs_icons {
71
  background-position: -128px -19px !important;
72
  }
images/dwicons.png CHANGED
Binary file
inc/bs_tooltip.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ function bs_tooltip($params, $content = null){
4
+ extract(shortcode_atts(array(
5
+ 'placement' => 'top',
6
+ 'trigger' => 'hover',
7
+ 'href' => "#"
8
+ ), $params));
9
+
10
+ $placement = (in_array($placement, array('top', 'right', 'bottom', 'left'))) ? $placement : "top";
11
+ $content = preg_replace('/<br class="nc".\/>/', '', $content);
12
+ $title = explode("\n", wordwrap($content, 20, "\n"));
13
+ $result .= '<a href="#" data-toggle="tooltip" title="'.$title[0].'" data-placement="'.esc_attr($placement).'" data-trigger="'.esc_attr($trigger).'">'.esc_attr($content).'</a>';
14
+ return force_balance_tags( $result );
15
+ }
16
+ add_shortcode('tooltip', 'bs_tooltip');
js/init.js ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ (function($){
2
+ $(document).ready(function() {
3
+ $('[data-toggle="tooltip"]').tooltip()
4
+ // Stop "click triggered" tootips from acting as bookmarks to top of page
5
+ .filter('[data-trigger*="click"]')
6
+ .on('click', function(e) {
7
+ e.preventDefault();
8
+ });
9
+ });
10
+ }(jQuery));
js/plugins/tooltip.js ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Shortcode markup
3
+ * -----------------------
4
+ * [tooltip placement="" trigger="" ]content
5
+ * [/tooltip]
6
+ * -----------------------
7
+ */
8
+ (function($) {
9
+ // Creates a new plugin class and a custom listbox
10
+ tinymce.create('tinymce.plugins.bs_tooltip', {
11
+ createControl: function(n, cm) {
12
+ switch (n) {
13
+ case 'bs_tooltip':
14
+ var c = cm.createSplitButton('bs_tooltip', {
15
+ title : 'Tooltip'
16
+ });
17
+
18
+ c.onRenderMenu.add(function(c, m) {
19
+ m.onShowMenu.add(function(c,m){
20
+ $('#menu_'+c.id).height('auto').width('auto');
21
+ $('#menu_'+c.id+'_co').height('auto').addClass('mceListBoxMenu');
22
+ var $menu = $('#menu_'+c.id+'_co').find('tbody:first');
23
+ if($menu.data('added')) return;
24
+ $menu.append('<div style="padding:0 10px 10px">\
25
+ <label>Content</label>\
26
+ <input type="text" name="content" value="The Tooltip" onclick="this.select()" />\
27
+ <label>Placement</label>\
28
+ <select name="placement">\
29
+ <option value="top" selected>Top</option>\
30
+ <option value="right">Right</option>\
31
+ <option value="bottom">Bottom</option>\
32
+ <option value="left">Left</option>\
33
+ </select>\
34
+ <label>Trigger</label>\
35
+ <select name="trigger">\
36
+ <option value="click">Click</option>\
37
+ <option value="hover" selected>Hover</option>\
38
+ <option value="focus">Focus</option>\
39
+ </select>\
40
+ </div>');
41
+
42
+ $('<input type="button" class="button" value="Insert" />')
43
+ .wrap('<div style="padding: 0 10px 10px"></div>')
44
+ .appendTo($menu)
45
+ .on('click', function() {
46
+ var content = $menu.find('input[name=content]').val();
47
+ var placement = $menu.find('select[name=placement]').val();
48
+ var trigger = $menu.find('select[name=trigger]').val();
49
+ var shortcode = '[tooltip placement="' + placement + '" trigger="' + trigger + '"]';
50
+ shortcode+= content;
51
+ shortcode+= '[/tooltip]';
52
+
53
+ tinymce.activeEditor.execCommand('mceInsertContent', false, shortcode);
54
+ c.hideMenu();
55
+ });
56
+
57
+ $menu.data('added', true);
58
+ });
59
+
60
+ // XSmall
61
+ m.add({title : 'Tooltip', 'class' : 'mceMenuItemTitle'}).setDisabled(1);
62
+ });
63
+ // Return the new splitbutton instance
64
+ return c;
65
+ }
66
+ return null;
67
+ }
68
+ });
69
+ tinymce.PluginManager.add('bs_tooltip', tinymce.plugins.bs_tooltip);
70
+ })(jQuery);
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: sinetheta, beaurixon, Designwall Team
3
  Tags: shortcode, shortcodes, bootstrap, buttons, grid, well, responsive, widget
4
  Requires at least: 3.0
5
  Tested up to: 3.6
6
- Stable tag: 1.4.3
7
  License: GNU General Public License v2.0
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -26,6 +26,9 @@ Please report issues [here](https://github.com/TheWebShop/bootstrap-shortcodes/i
26
 
27
  == Changelog ==
28
 
 
 
 
29
  = 1.4 =
30
  * Added support for tabs
31
 
3
  Tags: shortcode, shortcodes, bootstrap, buttons, grid, well, responsive, widget
4
  Requires at least: 3.0
5
  Tested up to: 3.6
6
+ Stable tag: 1.5.0
7
  License: GNU General Public License v2.0
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
26
 
27
  == Changelog ==
28
 
29
+ = 1.5 =
30
+ * Added support for tooltips
31
+
32
  = 1.4 =
33
  * Added support for tabs
34