Bootstrap Shortcodes - Version 2.1

Version Description

  • Added support for labels
Download this release

Release Info

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

Code changes from version 2.0 to 2.1

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: 2.0
7
  Author: Kevin Attfield
8
  Author URI: https://github.com/Sinetheta
9
 
@@ -16,6 +16,7 @@ require_once('inc/bs_collapse.php');
16
  require_once('inc/bs_alert.php');
17
  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
  require_once('inc/bs_tooltip.php');
@@ -29,6 +30,7 @@ class BootstrapShortcodes{
29
  'alerts',
30
  'wells',
31
  'buttons',
 
32
  'icons',
33
  'lead',
34
  'tooltip'
@@ -106,6 +108,7 @@ class BootstrapShortcodes{
106
  "chk_default_options_alerts" => "1",
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"
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: 2.1
7
  Author: Kevin Attfield
8
  Author URI: https://github.com/Sinetheta
9
 
16
  require_once('inc/bs_alert.php');
17
  require_once('inc/bs_well.php');
18
  require_once('inc/bs_buttons.php');
19
+ require_once('inc/bs_labels.php');
20
  require_once('inc/bs_icons.php');
21
  require_once('inc/bs_lead.php');
22
  require_once('inc/bs_tooltip.php');
30
  'alerts',
31
  'wells',
32
  'buttons',
33
+ 'labels',
34
  'icons',
35
  'lead',
36
  'tooltip'
108
  "chk_default_options_alerts" => "1",
109
  "chk_default_options_wells" => "1",
110
  "chk_default_options_buttons" => "1",
111
+ "chk_default_options_labels" => "1",
112
  "chk_default_options_icons" => "1",
113
  "chk_default_options_lead" => "1",
114
  "chk_default_options_tooltip" => "1"
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 .mceSplitButton span.mce_bs_tooltip,
10
  .wp_themeSkin span.mce_bs_icons,
11
  .wp_themeSkin span.mce_bs_lead {
@@ -59,6 +60,14 @@
59
  background-position: -107px 0px !important;
60
  }
61
 
 
 
 
 
 
 
 
 
62
  .wp_themeSkin .mceSplitButton span.mce_bs_tooltip {
63
  background-position: -170px -19px !important;
64
  }
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_labels,
10
  .wp_themeSkin .mceSplitButton span.mce_bs_tooltip,
11
  .wp_themeSkin span.mce_bs_icons,
12
  .wp_themeSkin span.mce_bs_lead {
60
  background-position: -107px 0px !important;
61
  }
62
 
63
+ .wp_themeSkin .mceSplitButton span.mce_bs_labels {
64
+ background-position: -191px -19px !important;
65
+ }
66
+ .wp_themeSkin .mceSplitButton:hover span.mce_bs_labels,
67
+ .wp_themeSkin .mceSplitButtonSelected .mceSplitButton span.mce_bs_labels {
68
+ background-position: -191px 0px !important;
69
+ }
70
+
71
  .wp_themeSkin .mceSplitButton span.mce_bs_tooltip {
72
  background-position: -170px -19px !important;
73
  }
images/dwicons.png CHANGED
Binary file
inc/bs_labels.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ function bs_labels($params, $content = null){
4
+ extract(shortcode_atts(array(
5
+ 'type' => 'default',
6
+ 'text' => 'my label'
7
+ ), $params));
8
+
9
+ $content = preg_replace('/<br class="nc".\/>/', '', $content);
10
+ $result = '<span class="label label-'.$type.'">'.$text.'</span>';
11
+ return force_balance_tags( $result );
12
+ }
13
+ add_shortcode('bs_label', 'bs_labels');
js/plugins/grid.html CHANGED
@@ -71,7 +71,7 @@ $(function(){
71
  var shortcodes = '[bs_row class="row"]';
72
  $('#demo_grid > div').each(function(){
73
  var clss = $(this).attr('class').replace(' demo_col','');
74
- shortcodes+= '<br class="nc"/>[bs_col class="'+clss+'"]Text[/col]';
75
 
76
  });
77
 
@@ -122,4 +122,4 @@ function append_grid(cols){
122
  </div>
123
  </div>
124
  </body>
125
- </html>
71
  var shortcodes = '[bs_row class="row"]';
72
  $('#demo_grid > div').each(function(){
73
  var clss = $(this).attr('class').replace(' demo_col','');
74
+ shortcodes+= '<br class="nc"/>[bs_col class="'+clss+'"]Text[/bs_col]';
75
 
76
  });
77
 
122
  </div>
123
  </div>
124
  </body>
125
+ </html>
js/plugins/labels.js CHANGED
@@ -6,22 +6,52 @@
6
  switch (n) {
7
  case 'bs_labels':
8
  var c = cm.createSplitButton('bs_labels', {
9
- title : 'Boxes & frames shortcodes',
10
  onclick : function() {
 
11
  }
 
12
  });
 
13
 
14
  c.onRenderMenu.add(function(c, m) {
15
- // Boxes & frames
16
- m.add({title : 'Labels & Badges', 'class' : 'mceMenuItemTitle'}).setDisabled(1);
17
- m.add({title : 'Default', onclick : function() {
18
- tinyMCE.activeEditor.execCommand( 'mceInsertContent', false, '[bs_label]Default[/bs_label]' );
19
- }});
20
- m.add({title : 'Success', onclick : function() {
21
- tinyMCE.activeEditor.execCommand( 'mceInsertContent', false, '[bs_label class="success"]Default[/bs_label]' );
22
- }});
23
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
 
 
25
  // Return the new splitbutton instance
26
  return c;
27
 
@@ -30,4 +60,4 @@
30
  }
31
  });
32
  tinymce.PluginManager.add('bs_labels', tinymce.plugins.bs_labels);
33
- })();
6
  switch (n) {
7
  case 'bs_labels':
8
  var c = cm.createSplitButton('bs_labels', {
9
+ title : 'Labels',
10
  onclick : function() {
11
+
12
  }
13
+ //'class':'mceListBoxMenu'
14
  });
15
+
16
 
17
  c.onRenderMenu.add(function(c, m) {
18
+ m.onShowMenu.add(function(c,m){
19
+ jQuery('#menu_'+c.id).height('auto').width('auto');
20
+ jQuery('#menu_'+c.id+'_co').height('auto').addClass('mceListBoxMenu');
21
+ var $menu = jQuery('#menu_'+c.id+'_co').find('tbody:first');
22
+ if($menu.data('added')) return;
23
+ $menu.append('');
24
+ $menu.append('<div style="padding: 0 10px 10px">\
25
+ <label>Types<br/>\
26
+ <select name="type">\
27
+ <option value="Default"> Default</option>\
28
+ <option value="Primary"> Primary</option>\
29
+ <option value="Success"> Success</option>\
30
+ <option value="Info" selected> Info</option>\
31
+ <option value="Warning"> Warning</option>\
32
+ <option value="Danger"> Danger</option>\
33
+ <option value="Link"> Link</option>\
34
+ </select>\
35
+ <label>Text<br />\
36
+ <input type="text" name="text" value="my text" onclick="this.select()" /></label>\
37
+ </div>');
38
+
39
+ jQuery('<input type="button" class="button" value="Insert" />').appendTo($menu)
40
+ .click(function(){
41
+ var type = $menu.find('select[name=type]').val();
42
+ var text = $menu.find('input[name=text]').val();
43
+ tinymce.activeEditor.execCommand('mceInsertContent',false,'[bs_label type="'+type.toLowerCase()+'"]'+text+'[/bs_label]');
44
+ c.hideMenu();
45
+ }).wrap('<div style="padding: 0 10px 10px"></div>')
46
+
47
+ $menu.data('added',true);
48
+
49
+ });
50
+
51
+ // XSmall
52
+ m.add({title : 'Labels', 'class' : 'mceMenuItemTitle'}).setDisabled(1);
53
 
54
+ });
55
  // Return the new splitbutton instance
56
  return c;
57
 
60
  }
61
  });
62
  tinymce.PluginManager.add('bs_labels', tinymce.plugins.bs_labels);
63
+ })();
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: sinetheta, beaurixon, no3x, 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: 2.0
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
  = 2.0 =
30
  * Namespaced shortcodes to prevent conflicts with other plugins and themes
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: 2.1
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
+ = 2.1 =
30
+ * Added support for labels
31
+
32
  = 2.0 =
33
  * Namespaced shortcodes to prevent conflicts with other plugins and themes
34