Bootstrap Shortcodes - Version 1.4.2

Version Description

Download this release

Release Info

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

Code changes from version 1.1.0 to 1.4.2

bootstrap-shortcodes.php CHANGED
@@ -3,127 +3,165 @@
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.1.0
7
  Author: Kevin Attfield
8
  Author URI: https://github.com/Sinetheta
9
 
10
  Forked from DW Shortcodes Bootstrap http://wordpress.org/plugins/dw-shortcodes-bootstrap/
11
  */
12
 
13
- require_once('inc/dws_grid.php');
14
- require_once('inc/dws_alert.php');
15
- require_once('inc/dws_well.php');
16
- require_once('inc/dws_buttons.php');
17
- require_once('inc/dws_collapse.php');
18
- require_once('inc/dws_icons.php');
19
-
20
- class DesignwallShortcodes{
21
- function __construct() {
22
- add_action('init',array(&$this, 'init'));
23
- add_action('admin_menu', array(&$this, 'dw_add_options_page'));
24
- register_activation_hook(__FILE__, array(&$this, 'dwsc_add_defaults'));
25
- add_action('admin_init', array(&$this, 'dwsc_init'));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
  }
27
 
28
  function init() {
29
- $options = get_option('dwsc_options');
 
30
  if(!is_admin()){
31
  if( isset($options['chk_default_options_css']) && $options['chk_default_options_css'] ){
32
- wp_enqueue_style("dws_bootstrap", plugins_url('css/bootstrap.css', __FILE__ ));
33
- wp_enqueue_style("dws_shortcodes", plugins_url('css/shortcodes.css', __FILE__ ));
34
  }
35
  if( isset($options['chk_default_options_js']) && $options['chk_default_options_js'] )
36
- wp_enqueue_script('dws_bootstrap', plugins_url('js/bootstrap.js', __FILE__ ),array('jquery'));
37
  } else {
38
- wp_enqueue_style("dws_admin_style", plugins_url('css/admin.css', __FILE__ ));
39
  }
40
 
41
  if ( ! current_user_can('edit_posts') && ! current_user_can('edit_pages') ) {
42
- return;
43
  }
44
 
45
  if ( get_user_option('rich_editing') == 'true' ) {
46
- // wp_enqueue_style("dws_bootstrap", plugins_url('css/bootstrap.css', __FILE__ ));
47
  add_filter( 'mce_external_plugins', array(&$this, 'regplugins') );
48
  add_filter( 'mce_buttons_3', array(&$this, 'regbtns') );
49
  }
50
  }
51
 
52
  function regbtns($buttons) {
53
- array_push($buttons, 'dws_grid');
54
- array_push($buttons, 'dws_collapse');
55
- array_push($buttons, 'dws_buttons');
56
- array_push($buttons, 'dws_alerts');
57
- array_push($buttons, 'dws_wells');
58
- array_push($buttons, 'dws_icons');
 
 
 
59
  return $buttons;
60
  }
61
 
62
  function regplugins($plgs) {
63
-
64
- $plgs['dws_grid'] = plugins_url('js/plugins/grid.js', __FILE__ );
65
- $plgs['dws_collapse'] = plugins_url('js/plugins/collapse.js', __FILE__ );
66
- $plgs['dws_buttons'] = plugins_url('js/plugins/buttons.js', __FILE__ );
67
- $plgs['dws_alerts'] = plugins_url('js/plugins/alert.js', __FILE__ );
68
- $plgs['dws_wells'] = plugins_url('js/plugins/well.js', __FILE__ );
69
- $plgs['dws_icons'] = plugins_url('js/plugins/icons.js', __FILE__ );
70
  return $plgs;
71
  }
72
 
73
- /* Add menu page. */
74
- function dw_add_options_page() {
75
- add_options_page(__('Bootstrap Shortcodes options','dwshortcodes'), __('Bootstrap Shortcode options','dwshortcodes'), 'manage_options', __FILE__, array(&$this, 'dw_render_form'));
76
  }
77
 
78
- /* Define default option settings. */
79
- function dwsc_add_defaults() {
80
  $arr = array(
81
- "chk_default_options_css" => "1",
82
- "chk_default_options_js" => "1"
 
 
 
 
 
 
 
 
83
  );
84
- update_option( 'dwsc_options', $arr );
85
  }
86
 
87
- /* Init plugin options to white list our options. */
88
- function dwsc_init(){
89
-
90
- register_setting( 'dwsc_plugin_options', 'dwsc_options' );
91
-
92
  }
93
 
94
-
95
  function dw_render_form() {
96
  ?>
97
- <div class="wrap">
98
- <div class="icon32" id="icon-options-general"><br></div>
99
- <h2>Bootstrap Shortcodes Options</h2>
100
- <form method="post" action="options.php">
101
- <?php settings_fields('dwsc_plugin_options'); ?>
102
- <?php $options = get_option('dwsc_options'); ?>
103
- <table class="form-table">
104
-
105
- <tr><td colspan="2"><div style="margin-top:10px;"></div></td></tr>
106
-
107
- <tr valign="top" style="border-top:#dddddd 1px solid;">
108
- <th scope="row">Twitter Bootstrap CSS</th>
109
- <td>
110
- <label><input name="dwsc_options[chk_default_options_css]" type="checkbox" value="1" <?php if (isset($options['chk_default_options_css'])) { checked('1', $options['chk_default_options_css']); } ?> /> Load Twitter Bootstrap css file</label><br /><span style="color:#666666;margin-left:2px;">Uncheck this if you already include Bootstrap css on your template</span>
111
- </td>
112
- </tr>
113
- <tr valign="top">
114
- <th scope="row">Twitter Bootstrap JS</th>
115
- <td>
116
- <label><input name="dwsc_options[chk_default_options_js]" type="checkbox" value="1" <?php if (isset($options['chk_default_options_js'])) { checked('1', $options['chk_default_options_js']); } ?> /> Load Twitter Bootstrap javascript file</label><br /><span style="color:#666666;margin-left:2px;">Uncheck this if you already include Bootstrap javascript on your template</span>
117
- </td>
118
- </tr>
119
- </table>
120
- <p class="submit">
121
- <input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
122
- </p>
123
- </form>
124
-
125
- </div>
126
- <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
127
  }
128
  }
129
- $dwcodes = new DesignwallShortcodes();
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.2
7
  Author: Kevin Attfield
8
  Author URI: https://github.com/Sinetheta
9
 
10
  Forked from DW Shortcodes Bootstrap http://wordpress.org/plugins/dw-shortcodes-bootstrap/
11
  */
12
 
13
+ require_once('inc/bs_grid.php');
14
+ require_once('inc/bs_tabs.php');
15
+ 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
+
22
+ class BootstrapShortcodes{
23
+
24
+ public $shortcodes = array(
25
+ 'grid',
26
+ 'tabs',
27
+ 'collapse',
28
+ 'alerts',
29
+ 'wells',
30
+ 'buttons',
31
+ 'icons',
32
+ 'lead'
33
+ );
34
+
35
+ public function __construct() {
36
+ add_action( 'init' , array( &$this, 'init' ) );
37
+
38
+ register_activation_hook(__FILE__, array(&$this, 'add_options_defaults'));
39
+
40
+ add_action( 'admin_init', array( &$this, 'register_settings' ) );
41
+ add_action( 'admin_menu', array( &$this, 'register_settings_page' ) );
42
  }
43
 
44
  function init() {
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
  }
57
 
58
  if ( ! current_user_can('edit_posts') && ! current_user_can('edit_pages') ) {
59
+ return;
60
  }
61
 
62
  if ( get_user_option('rich_editing') == 'true' ) {
63
+ //wp_enqueue_style("dws_bootstrap", plugins_url('css/bootstrap.css', __FILE__ ));
64
  add_filter( 'mce_external_plugins', array(&$this, 'regplugins') );
65
  add_filter( 'mce_buttons_3', array(&$this, 'regbtns') );
66
  }
67
  }
68
 
69
  function regbtns($buttons) {
70
+
71
+ $options = get_option('bs_options');
72
+
73
+ foreach ($this->shortcodes as &$shortcode) {
74
+ if( isset($options['chk_default_options_' . $shortcode]) ) {
75
+ array_push($buttons, 'bs_' . $shortcode);
76
+ }
77
+ }
78
+
79
  return $buttons;
80
  }
81
 
82
  function regplugins($plgs) {
83
+
84
+ foreach ($this->shortcodes as &$shortcode) {
85
+ $plgs['bs_' . $shortcode] = plugins_url('js/plugins/' . $shortcode . '.js', __FILE__ );
86
+ }
87
+
 
 
88
  return $plgs;
89
  }
90
 
91
+ function register_settings_page() {
92
+ add_options_page(__('BS Shortcodes','bsshortcodes'), __('BS Shortcodes','bsshortcodes'), 'manage_options', __FILE__, array(&$this, 'dw_render_form'));
 
93
  }
94
 
95
+ function add_options_defaults() {
 
96
  $arr = array(
97
+ "chk_default_options_css" => "1",
98
+ "chk_default_options_js" => "1",
99
+ "chk_default_options_grid" => "1",
100
+ "chk_default_options_tabs" => "1",
101
+ "chk_default_options_collapse" => "1",
102
+ "chk_default_options_alerts" => "1",
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
  }
110
 
111
+ function register_settings(){
112
+ register_setting( 'bs_plugin_options', 'bs_options' );
 
 
 
113
  }
114
 
 
115
  function dw_render_form() {
116
  ?>
117
+ <div class="wrap">
118
+ <div class="icon32" id="icon-options-general"><br></div>
119
+ <h2>Bootstrap Shortcodes Options</h2>
120
+ <form method="post" action="options.php">
121
+ <?php settings_fields('bs_plugin_options'); ?>
122
+ <?php $options = get_option('bs_options'); ?>
123
+ <table class="form-table">
124
+
125
+ <tr><td colspan="2"><div style="margin-top:10px;"></div></td></tr>
126
+
127
+ <tr valign="top" style="border-top:#dddddd 1px solid;">
128
+ <th scope="row">Twitter Bootstrap CSS</th>
129
+ <td>
130
+ <label><input name="bs_options[chk_default_options_css]" type="checkbox" value="1" <?php if (isset($options['chk_default_options_css'])) { checked('1', $options['chk_default_options_css']); } ?> /> Load Twitter Bootstrap css file</label><br /><span style="color:#666666;margin-left:2px;">Uncheck this if you already include Bootstrap css on your template</span>
131
+ </td>
132
+ </tr>
133
+ <tr valign="top">
134
+ <th scope="row">Twitter Bootstrap JS</th>
135
+ <td>
136
+ <label><input name="bs_options[chk_default_options_js]" type="checkbox" value="1" <?php if (isset($options['chk_default_options_js'])) { checked('1', $options['chk_default_options_js']); } ?> /> Load Twitter Bootstrap javascript file</label><br /><span style="color:#666666;margin-left:2px;">Uncheck this if you already include Bootstrap javascript on your template</span>
137
+ </td>
138
+ </tr>
139
+ <tr valign="top">
140
+ <th scope="row">Twitter Bootstrap Shortcodes</th>
141
+ <td>
142
+
143
+ <? foreach ($this->shortcodes as &$shortcode): ?>
144
+ <label>
145
+ <input
146
+ name="bs_options[chk_default_options_<?php echo $shortcode; ?>]"
147
+ type="checkbox"
148
+ value="1"
149
+ <?php if (isset($options['chk_default_options_'.$shortcode])) { checked('1', $options['chk_default_options_'.$shortcode]); } ?>
150
+ /> <?php echo $shortcode; ?>
151
+ </label>
152
+ <br />
153
+ <?php endforeach; ?>
154
+
155
+ <span style="color:#666666;margin-left:2px;">Uncheck to remove button from TinyMCE editor</span>
156
+ </td>
157
+ </tr>
158
+ </table>
159
+ <p class="submit">
160
+ <input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
161
+ </p>
162
+ </form>
163
+
164
+ </div><?php
165
  }
166
  }
167
+ $bscodes = new BootstrapShortcodes();
css/admin.css CHANGED
@@ -1,74 +1,75 @@
1
  /* Editor
2
  -------------------------------------------------------------- */
3
- .wp_themeSkin .mceSplitButton span.mce_dws_grid,
4
- .wp_themeSkin .mceSplitButton span.mce_dws_alerts,
5
- .wp_themeSkin .mceSplitButton span.mce_dws_wells,
6
- .wp_themeSkin .mceSplitButton span.mce_dws_buttons,
7
- .wp_themeSkin span.mce_dws_icons,
8
- .wp_themeSkin span.mce_dws_tabs,
9
- .wp_themeSkin .mceSplitButton span.mce_dws_collapse {
 
10
  background: url(../images/dwicons.png) no-repeat !important;
11
  }
12
 
13
- .wp_themeSkin .mceSplitButton span.mce_dws_grid {
14
- background-position: -5px -19px !important;
15
  }
16
-
17
- .wp_themeSkin .mceSplitButton:hover span.mce_dws_grid,
18
- .wp_themeSkin .mceSplitButtonSelected .mceSplitButton span.mce_dws_grid {
19
- background-position: -5px 0 !important;
20
  }
21
 
22
- .wp_themeSkin .mceSplitButton span.mce_dws_alerts {
23
- background-position: -25px -19px !important;
24
  }
25
-
26
- .wp_themeSkin .mceSplitButton:hover span.mce_dws_alerts,
27
- .wp_themeSkin .mceSplitButtonSelected .mceSplitButton span.mce_dws_alerts {
28
- background-position: -25px 0 !important;
29
  }
30
 
31
- .wp_themeSkin .mceSplitButton span.mce_dws_wells {
32
- background-position: -129px -19px !important;
33
  }
34
-
35
- .wp_themeSkin .mceSplitButton:hover span.mce_dws_wells,
36
- .wp_themeSkin .mceSplitButtonSelected .mceSplitButton span.mce_dws_wells {
37
- background-position: -129px 0 !important;
38
  }
39
 
40
- .wp_themeSkin .mceSplitButton span.mce_dws_buttons {
41
- background-position: -46px -19px !important;
42
  }
43
-
44
- .wp_themeSkin .mceSplitButton:hover span.mce_dws_buttons,
45
- .wp_themeSkin .mceSplitButtonSelected .mceSplitButton span.mce_dws_buttons {
46
- background-position: -46px 0 !important;
47
  }
48
 
49
- .wp_themeSkin span.mce_dws_icons {
50
- background-position: -67px -20px !important;
51
  }
52
-
53
- .wp_themeSkin span.mce_dws_icons:hover {
54
- background-position: -67px -1px !important;
55
  }
56
 
57
- .wp_themeSkin span.mce_dws_tabs {
58
- background-position: -88px -20px !important;
59
  }
60
-
61
- .wp_themeSkin span.mce_dws_tabs:hover {
62
- background-position: -88px -1px !important;
63
  }
64
 
65
- .wp_themeSkin .mceSplitButton span.mce_dws_collapse {
66
- background-position: -109px -20px !important;
 
 
 
67
  }
68
 
69
- .wp_themeSkin .mceSplitButton:hover span.mce_dws_collapse,
70
- .wp_themeSkin .mceSplitButtonSelected .mceSplitButton span.mce_dws_collapse {
71
- background-position: -109px -1px !important;
 
 
72
  }
73
 
74
  .mceMenu label {
@@ -92,24 +93,24 @@
92
 
93
  /* Iframe
94
  -------------------------------------------------------------- */
95
- #dws-wrapper {
96
  padding: 20px;
97
  }
98
 
99
- #dws-wrapper .nav-tabs > .active > a > [class^="icon-"],
100
- #dws-wrapper .nav-tabs > .active > a > [class*=" icon-"] {
101
  background-image: url("../images/glyphicons-halflings.png");
102
  }
103
 
104
- #dws-wrapper .nav-tabs .add-new {
105
  float: right;
106
  }
107
 
108
- #dws-wrapper .nav-tabs li a {
109
  outline: none;
110
  }
111
 
112
- #dws-wrapper .nav-tabs .delete-tab {
113
  margin: 0 0 0 5px;
114
  display: none;
115
  height: 16px;
@@ -118,17 +119,17 @@
118
  width: 16px;
119
  }
120
 
121
- #dws-wrapper .nav-tabs .active .delete-tab {
122
  display: inline-block;
123
  }
124
 
125
- #dws-wrapper .nav-tabs .active .delete-tab:hover {
126
  background: #bbb;
127
  border-radius: 20px;
128
  color: #fff;
129
  }
130
 
131
- #dws-wrapper .tab-content textarea {
132
  -webkit-box-sizing: border-box;
133
  -moz-box-sizing: border-box;
134
  -ms-box-sizing: border-box;
@@ -138,9 +139,9 @@
138
  min-height: 120px;
139
  }
140
 
141
- #dws-wrapper .tab-content input[type=text],
142
- #dws-wrapper .tab-content select,
143
- #dws-wrapper #dws-grid input[type=number] {
144
  -webkit-box-sizing: border-box;
145
  -moz-box-sizing: border-box;
146
  -ms-box-sizing: border-box;
@@ -149,7 +150,7 @@
149
  height: 30px;
150
  }
151
 
152
- #dws-wrapper #dws-grid form {
153
  margin: 0;
154
  }
155
 
1
  /* Editor
2
  -------------------------------------------------------------- */
3
+ .wp_themeSkin .mceSplitButton span.mce_bs_grid,
4
+ .wp_themeSkin span.mce_bs_tabs,
5
+ .wp_themeSkin .mceSplitButton span.mce_bs_collapse,
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;
12
  }
13
 
14
+ .wp_themeSkin .mceSplitButton span.mce_bs_grid {
15
+ background-position: -2px -19px !important;
16
  }
17
+ .wp_themeSkin .mceSplitButton:hover span.mce_bs_grid,
18
+ .wp_themeSkin .mceSplitButtonSelected .mceSplitButton span.mce_bs_grid {
19
+ background-position: -2px 0px !important;
 
20
  }
21
 
22
+ .wp_themeSkin span.mce_bs_tabs {
23
+ background-position: -23px -19px !important;
24
  }
25
+ .wp_themeSkin span.mce_bs_tabs:hover {
26
+ background-position: -23px 0px !important
 
 
27
  }
28
 
29
+ .wp_themeSkin .mceSplitButton span.mce_bs_collapse {
30
+ background-position: -44px -19px !important;
31
  }
32
+ .wp_themeSkin .mceSplitButton:hover span.mce_bs_collapse,
33
+ .wp_themeSkin .mceSplitButtonSelected .mceSplitButton span.mce_bs_collapse {
34
+ background-position: -44px 0px !important;
 
35
  }
36
 
37
+ .wp_themeSkin .mceSplitButton span.mce_bs_alerts {
38
+ background-position: -65px -19px !important;
39
  }
40
+ .wp_themeSkin .mceSplitButton:hover span.mce_bs_alerts,
41
+ .wp_themeSkin .mceSplitButtonSelected .mceSplitButton span.mce_bs_alerts {
42
+ background-position: -65px 0px !important;
 
43
  }
44
 
45
+ .wp_themeSkin .mceSplitButton span.mce_bs_wells {
46
+ background-position: -86px -19px !important;
47
  }
48
+ .wp_themeSkin .mceSplitButton:hover span.mce_bs_wells,
49
+ .wp_themeSkin .mceSplitButtonSelected .mceSplitButton span.mce_bs_wells {
50
+ background-position: -86px 0 !important;
51
  }
52
 
53
+ .wp_themeSkin .mceSplitButton span.mce_bs_buttons {
54
+ background-position: -107px -19px !important;
55
  }
56
+ .wp_themeSkin .mceSplitButton:hover span.mce_bs_buttons,
57
+ .wp_themeSkin .mceSplitButtonSelected .mceSplitButton span.mce_bs_buttons {
58
+ background-position: -107px 0px !important;
59
  }
60
 
61
+ .wp_themeSkin span.mce_bs_icons {
62
+ background-position: -128px -19px !important;
63
+ }
64
+ .wp_themeSkin span.mce_bs_icons:hover {
65
+ background-position: -128px 0 !important;
66
  }
67
 
68
+ .wp_themeSkin span.mce_bs_lead {
69
+ background-position: -149px -19px !important;
70
+ }
71
+ .wp_themeSkin span.mce_bs_lead:hover {
72
+ background-position: -149px 0 !important;
73
  }
74
 
75
  .mceMenu label {
93
 
94
  /* Iframe
95
  -------------------------------------------------------------- */
96
+ #bs-wrapper {
97
  padding: 20px;
98
  }
99
 
100
+ #bs-wrapper .nav-tabs > .active > a > [class^="icon-"],
101
+ #bs-wrapper .nav-tabs > .active > a > [class*=" icon-"] {
102
  background-image: url("../images/glyphicons-halflings.png");
103
  }
104
 
105
+ #bs-wrapper .nav-tabs .add-new {
106
  float: right;
107
  }
108
 
109
+ #bs-wrapper .nav-tabs li a {
110
  outline: none;
111
  }
112
 
113
+ #bs-wrapper .nav-tabs .delete-tab {
114
  margin: 0 0 0 5px;
115
  display: none;
116
  height: 16px;
119
  width: 16px;
120
  }
121
 
122
+ #bs-wrapper .nav-tabs .active .delete-tab {
123
  display: inline-block;
124
  }
125
 
126
+ #bs-wrapper .nav-tabs .active .delete-tab:hover {
127
  background: #bbb;
128
  border-radius: 20px;
129
  color: #fff;
130
  }
131
 
132
+ #bs-wrapper .tab-content textarea {
133
  -webkit-box-sizing: border-box;
134
  -moz-box-sizing: border-box;
135
  -ms-box-sizing: border-box;
139
  min-height: 120px;
140
  }
141
 
142
+ #bs-wrapper .tab-content input[type=text],
143
+ #bs-wrapper .tab-content select,
144
+ #bs-wrapper #bs-grid input[type=number] {
145
  -webkit-box-sizing: border-box;
146
  -moz-box-sizing: border-box;
147
  -ms-box-sizing: border-box;
150
  height: 30px;
151
  }
152
 
153
+ #bs-wrapper #bs-grid form {
154
  margin: 0;
155
  }
156
 
images/dwicons.png CHANGED
Binary file
inc/{dws_alert.php → bs_alert.php} RENAMED
@@ -1,6 +1,6 @@
1
  <?php
2
 
3
- function dws_notice($params, $content = null){
4
  extract(shortcode_atts(array(
5
  'type' => 'unknown'
6
  ), $params));
@@ -11,4 +11,4 @@ function dws_notice($params, $content = null){
11
  $result .= '</div>';
12
  return force_balance_tags( $result );
13
  }
14
- add_shortcode('notification', 'dws_notice');
1
  <?php
2
 
3
+ function bs_notice($params, $content = null){
4
  extract(shortcode_atts(array(
5
  'type' => 'unknown'
6
  ), $params));
11
  $result .= '</div>';
12
  return force_balance_tags( $result );
13
  }
14
+ add_shortcode('notification', 'bs_notice');
inc/{dws_buttons.php → bs_buttons.php} RENAMED
@@ -1,6 +1,6 @@
1
  <?php
2
 
3
- function dws_buttons($params, $content = null){
4
  extract(shortcode_atts(array(
5
  'size' => 'default',
6
  'type' => 'default',
@@ -12,4 +12,4 @@ function dws_buttons($params, $content = null){
12
  $result = '<a class="btn btn-'.$size.' btn-'.$type.'" href="'.$href.'">'.$value.'</a>';
13
  return force_balance_tags( $result );
14
  }
15
- add_shortcode('button', 'dws_buttons');
1
  <?php
2
 
3
+ function bs_buttons($params, $content = null){
4
  extract(shortcode_atts(array(
5
  'size' => 'default',
6
  'type' => 'default',
12
  $result = '<a class="btn btn-'.$size.' btn-'.$type.'" href="'.$href.'">'.$value.'</a>';
13
  return force_balance_tags( $result );
14
  }
15
+ add_shortcode('button', 'bs_buttons');
inc/{dws_collapse.php → bs_collapse.php} RENAMED
@@ -1,6 +1,6 @@
1
  <?php
2
 
3
- function dws_collapse($params, $content = null){
4
  extract(shortcode_atts(array(
5
  'id'=>''
6
  ), $params));
@@ -10,10 +10,10 @@ function dws_collapse($params, $content = null){
10
  $result .= '</div>';
11
  return force_balance_tags( $result );
12
  }
13
- add_shortcode('collapse', 'dws_collapse');
14
 
15
 
16
- function dws_citem($params, $content = null){
17
  extract(shortcode_atts(array(
18
  'id'=>'',
19
  'title'=>'Collapse title',
@@ -36,6 +36,4 @@ function dws_citem($params, $content = null){
36
  $result .= '</div>';
37
  return force_balance_tags( $result );
38
  }
39
- add_shortcode('citem', 'dws_citem');
40
-
41
-
1
  <?php
2
 
3
+ function bs_collapse($params, $content = null){
4
  extract(shortcode_atts(array(
5
  'id'=>''
6
  ), $params));
10
  $result .= '</div>';
11
  return force_balance_tags( $result );
12
  }
13
+ add_shortcode('collapse', 'bs_collapse');
14
 
15
 
16
+ function bs_citem($params, $content = null){
17
  extract(shortcode_atts(array(
18
  'id'=>'',
19
  'title'=>'Collapse title',
36
  $result .= '</div>';
37
  return force_balance_tags( $result );
38
  }
39
+ add_shortcode('citem', 'bs_citem');
 
 
inc/{dws_grid.php → bs_grid.php} RENAMED
@@ -1,6 +1,6 @@
1
  <?php
2
 
3
- function dws_row($params, $content = null){
4
  extract(shortcode_atts(array(
5
  'class' => 'row'
6
  ), $params));
@@ -10,9 +10,9 @@ function dws_row($params, $content = null){
10
  $result .= '</div>';
11
  return force_balance_tags( $result );
12
  }
13
- add_shortcode('row', 'dws_row');
14
 
15
- function dws_span($params,$content=null){
16
  extract(shortcode_atts(array(
17
  'class' => 'col-xs-1'
18
  ), $params));
@@ -22,4 +22,4 @@ function dws_span($params,$content=null){
22
  $result .= '</div>';
23
  return force_balance_tags( $result );
24
  }
25
- add_shortcode('col', 'dws_span');
1
  <?php
2
 
3
+ function bs_row($params, $content = null){
4
  extract(shortcode_atts(array(
5
  'class' => 'row'
6
  ), $params));
10
  $result .= '</div>';
11
  return force_balance_tags( $result );
12
  }
13
+ add_shortcode('row', 'bs_row');
14
 
15
+ function bs_span($params,$content=null){
16
  extract(shortcode_atts(array(
17
  'class' => 'col-xs-1'
18
  ), $params));
22
  $result .= '</div>';
23
  return force_balance_tags( $result );
24
  }
25
+ add_shortcode('col', 'bs_span');
inc/{dws_icons.php → bs_icons.php} RENAMED
@@ -1,6 +1,6 @@
1
  <?php
2
 
3
- function dws_icons($params, $content = null){
4
  extract(shortcode_atts(array(
5
  'name' => 'default'
6
  ), $params));
@@ -9,4 +9,4 @@ function dws_icons($params, $content = null){
9
  $result = '<i class="'.$name.'"></i>';
10
  return force_balance_tags( $result );
11
  }
12
- add_shortcode('icon', 'dws_icons');
1
  <?php
2
 
3
+ function bs_icons($params, $content = null){
4
  extract(shortcode_atts(array(
5
  'name' => 'default'
6
  ), $params));
9
  $result = '<i class="'.$name.'"></i>';
10
  return force_balance_tags( $result );
11
  }
12
+ add_shortcode('icon', 'bs_icons');
inc/bs_lead.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ function bs_lead($params, $content = null){
4
+
5
+ $content = preg_replace('/<br class="nc".\/>/', '', $content);
6
+ $result = '<div class="lead">';
7
+ $result .= do_shortcode($content );
8
+ $result .= '</div>';
9
+
10
+ return force_balance_tags( $result );
11
+ }
12
+ add_shortcode('lead', 'bs_lead');
inc/bs_tabs.php ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ //--------------
3
+ // [tabs]
4
+ // [thead]
5
+ // [tab href="#link" title="title"]
6
+ // [dropdown title="title"]
7
+ // [tab href="#link" title="title"]
8
+ // [/dropdown]
9
+ // [/thead]
10
+ // [tcontents]
11
+ // [tcontent id="link"]
12
+ // [/tcontent]
13
+ // [/tcontents]
14
+ // [/tabs]
15
+ // ---------------
16
+
17
+ function bs_tabs($params, $content = null){
18
+ $content = preg_replace('/<br class="nc".\/>/', '', $content);
19
+ $result = '<div class="tab_wrap">';
20
+ $result .= do_shortcode($content );
21
+ $result .= '</div>';
22
+ return force_balance_tags( $result );
23
+ }
24
+ add_shortcode('tabs', 'bs_tabs');
25
+
26
+ function bs_thead($params, $content = null){
27
+ $content = preg_replace('/<br class="nc".\/>/', '', $content);
28
+ $result = '<ul class="nav nav-tabs">';
29
+ $result .= do_shortcode($content );
30
+ $result .= '</ul>';
31
+ return force_balance_tags( $result );
32
+ }
33
+ add_shortcode('thead', 'bs_thead');
34
+
35
+ function bs_tab($params, $content = null){
36
+ extract(shortcode_atts(array(
37
+ 'href' => '#',
38
+ 'title' => '',
39
+ 'class' => ''
40
+ ), $params));
41
+ $content = preg_replace('/<br class="nc".\/>/', '', $content);
42
+
43
+ $result = '<li class="'.$class.'">';
44
+ $result .= '<a data-toggle="tab" href="'.$href.'">'.$title.'</a>';
45
+ $result .= '</li>';
46
+ return force_balance_tags( $result );
47
+ }
48
+ add_shortcode('tab', 'bs_tab');
49
+
50
+ function bs_dropdown($params, $content = null){
51
+ global $bs_timestamp;
52
+ extract(shortcode_atts(array(
53
+ 'title' => '',
54
+ 'id' => '',
55
+ 'class' => '',
56
+ ), $params));
57
+ $content = preg_replace('/<br class="nc".\/>/', '', $content);
58
+ $result = '<li class="dropdown">';
59
+ $result .= '<a class="'.$class.'" id="'.$id.'" class="dropdown-toggle" data-toggle="dropdown">'.$title.'<b class="caret"></b></a>';
60
+ $result .='<ul class="dropdown-menu">';
61
+ $result .= do_shortcode($content);
62
+ $result .= '</ul></li>';
63
+ return force_balance_tags( $result );
64
+ }
65
+ add_shortcode('dropdown', 'bs_dropdown');
66
+
67
+ function bs_tcontents($params, $content = null){
68
+ $content = preg_replace('/<br class="nc".\/>/', '', $content);
69
+ $result = '<div class="tab-content">';
70
+ $result .= do_shortcode($content );
71
+ $result .= '</div>';
72
+ return force_balance_tags( $result );
73
+ }
74
+ add_shortcode('tcontents', 'bs_tcontents');
75
+
76
+ function bs_tcontent($params, $content = null){
77
+ extract(shortcode_atts(array(
78
+ 'id' => '',
79
+ 'class'=>'',
80
+ ), $params));
81
+ $content = preg_replace('/<br class="nc".\/>/', '', $content);
82
+ $class= ($class=='active')?'active in':'';
83
+ $result = '<div class="tab-pane fade '.$class.'" id='.$id.'>';
84
+ $result .= do_shortcode($content );
85
+ $result .= '</div>';
86
+ return force_balance_tags( $result );
87
+ }
88
+ add_shortcode('tcontent', 'bs_tcontent');
inc/{dws_well.php → bs_well.php} RENAMED
@@ -1,6 +1,6 @@
1
  <?php
2
 
3
- function dws_well($params, $content = null){
4
  extract(shortcode_atts(array(
5
  'size' => 'unknown'
6
  ), $params));
@@ -11,4 +11,4 @@ function dws_well($params, $content = null){
11
  $result .= '</div>';
12
  return force_balance_tags( $result );
13
  }
14
- add_shortcode('well', 'dws_well');
1
  <?php
2
 
3
+ function bs_well($params, $content = null){
4
  extract(shortcode_atts(array(
5
  'size' => 'unknown'
6
  ), $params));
11
  $result .= '</div>';
12
  return force_balance_tags( $result );
13
  }
14
+ add_shortcode('well', 'bs_well');
js/plugins/{alert.js → alerts.js} RENAMED
@@ -1,11 +1,11 @@
1
  // JavaScript Document
2
  (function() {
3
  // Creates a new plugin class and a custom listbox
4
- tinymce.create('tinymce.plugins.dws_alerts', {
5
  createControl: function(n, cm) {
6
  switch (n) {
7
- case 'dws_alerts':
8
- var c = cm.createSplitButton('dws_alerts', {
9
  title : 'Notification',
10
  onclick : function() {
11
  }
@@ -13,7 +13,7 @@
13
 
14
  c.onRenderMenu.add(function(c, m) {
15
  // Boxes & frames
16
- m.add({title : 'Notification', 'class' : 'mceMenuItemTitle'}).setDisabled(1);
17
  m.add({title : 'Success notification', onclick : function() {
18
  tinyMCE.activeEditor.execCommand( 'mceInsertContent', false, '[notification type="success"]<strong>Well done!</strong> You successfully read <a href="#" class="alert-link">this important alert message</a>. [/notification]' );
19
  }});
@@ -36,5 +36,5 @@
36
  return null;
37
  }
38
  });
39
- tinymce.PluginManager.add('dws_alerts', tinymce.plugins.dws_alerts);
40
  })();
1
  // JavaScript Document
2
  (function() {
3
  // Creates a new plugin class and a custom listbox
4
+ tinymce.create('tinymce.plugins.bs_alerts', {
5
  createControl: function(n, cm) {
6
  switch (n) {
7
+ case 'bs_alerts':
8
+ var c = cm.createSplitButton('bs_alerts', {
9
  title : 'Notification',
10
  onclick : function() {
11
  }
13
 
14
  c.onRenderMenu.add(function(c, m) {
15
  // Boxes & frames
16
+ m.add({title : 'Alerts', 'class' : 'mceMenuItemTitle'}).setDisabled(1);
17
  m.add({title : 'Success notification', onclick : function() {
18
  tinyMCE.activeEditor.execCommand( 'mceInsertContent', false, '[notification type="success"]<strong>Well done!</strong> You successfully read <a href="#" class="alert-link">this important alert message</a>. [/notification]' );
19
  }});
36
  return null;
37
  }
38
  });
39
+ tinymce.PluginManager.add('bs_alerts', tinymce.plugins.bs_alerts);
40
  })();
js/plugins/buttons.js CHANGED
@@ -1,11 +1,11 @@
1
  // JavaScript Document
2
  (function() {
3
  // Creates a new plugin class and a custom listbox
4
- tinymce.create('tinymce.plugins.dws_buttons', {
5
  createControl: function(n, cm) {
6
  switch (n) {
7
- case 'dws_buttons':
8
- var c = cm.createSplitButton('dws_buttons', {
9
  title : 'Buttons',
10
  onclick : function() {
11
 
@@ -66,5 +66,5 @@
66
  return null;
67
  }
68
  });
69
- tinymce.PluginManager.add('dws_buttons', tinymce.plugins.dws_buttons);
70
  })();
1
  // JavaScript Document
2
  (function() {
3
  // Creates a new plugin class and a custom listbox
4
+ tinymce.create('tinymce.plugins.bs_buttons', {
5
  createControl: function(n, cm) {
6
  switch (n) {
7
+ case 'bs_buttons':
8
+ var c = cm.createSplitButton('bs_buttons', {
9
  title : 'Buttons',
10
  onclick : function() {
11
 
66
  return null;
67
  }
68
  });
69
+ tinymce.PluginManager.add('bs_buttons', tinymce.plugins.bs_buttons);
70
  })();
js/plugins/collapse.js CHANGED
@@ -1,11 +1,11 @@
1
  // JavaScript Document
2
  (function() {
3
  // Creates a new plugin class and a custom listbox
4
- tinymce.create('tinymce.plugins.dws_collapse', {
5
  createControl: function(n, cm) {
6
  switch (n) {
7
- case 'dws_collapse':
8
- var c = cm.createSplitButton('dws_collapse', {
9
  title : 'Collapse',
10
  onclick : function() {
11
 
@@ -68,5 +68,5 @@
68
  return null;
69
  }
70
  });
71
- tinymce.PluginManager.add('dws_collapse', tinymce.plugins.dws_collapse);
72
  })();
1
  // JavaScript Document
2
  (function() {
3
  // Creates a new plugin class and a custom listbox
4
+ tinymce.create('tinymce.plugins.bs_collapse', {
5
  createControl: function(n, cm) {
6
  switch (n) {
7
+ case 'bs_collapse':
8
+ var c = cm.createSplitButton('bs_collapse', {
9
  title : 'Collapse',
10
  onclick : function() {
11
 
68
  return null;
69
  }
70
  });
71
+ tinymce.PluginManager.add('bs_collapse', tinymce.plugins.bs_collapse);
72
  })();
js/plugins/grid.html CHANGED
@@ -104,8 +104,8 @@ function append_grid(cols){
104
 
105
  </head>
106
  <body>
107
- <div id="dws-wrapper">
108
- <div id="dws-grid">
109
  <form id="frm_create">
110
  <label>Number of columns</label>
111
  <input placeholder='Input number from 1 - 12' required pattern="\b([1-9]|1[0-2])\b" id="quantity" type="number" name="quantity" min="1" max="12">
104
 
105
  </head>
106
  <body>
107
+ <div id="bs-wrapper">
108
+ <div id="bs-grid">
109
  <form id="frm_create">
110
  <label>Number of columns</label>
111
  <input placeholder='Input number from 1 - 12' required pattern="\b([1-9]|1[0-2])\b" id="quantity" type="number" name="quantity" min="1" max="12">
js/plugins/grid.js CHANGED
@@ -1,12 +1,12 @@
1
  // JavaScript Document
2
  (function() {
3
  // Creates a new plugin class and a custom listbox
4
- tinymce.create('tinymce.plugins.dws_grid', {
5
  createControl: function(n, cm) {
6
  switch (n) {
7
- case 'dws_grid':
8
- var c = cm.createSplitButton('dws_grid', {
9
- title : 'Fluid grid system',
10
  onclick : function() {
11
  }
12
  });
@@ -45,5 +45,5 @@
45
  return null;
46
  }
47
  });
48
- tinymce.PluginManager.add('dws_grid', tinymce.plugins.dws_grid);
49
  })();
1
  // JavaScript Document
2
  (function() {
3
  // Creates a new plugin class and a custom listbox
4
+ tinymce.create('tinymce.plugins.bs_grid', {
5
  createControl: function(n, cm) {
6
  switch (n) {
7
+ case 'bs_grid':
8
+ var c = cm.createSplitButton('bs_grid', {
9
+ title : 'Grid',
10
  onclick : function() {
11
  }
12
  });
45
  return null;
46
  }
47
  });
48
+ tinymce.PluginManager.add('bs_grid', tinymce.plugins.bs_grid);
49
  })();
js/plugins/icons.html CHANGED
@@ -45,7 +45,7 @@
45
  </head>
46
 
47
  <body>
48
- <div id="dws-wrapper">
49
  <ul class="glyphicons">
50
  <li>
51
  <span class="glyphicon glyphicon-adjust"></span>adjust</li>
45
  </head>
46
 
47
  <body>
48
+ <div id="bs-wrapper">
49
  <ul class="glyphicons">
50
  <li>
51
  <span class="glyphicon glyphicon-adjust"></span>adjust</li>
js/plugins/icons.js CHANGED
@@ -1,11 +1,11 @@
1
  // JavaScript Document
2
  (function() {
3
  // Creates a new plugin class and a custom listbox
4
- tinymce.create('tinymce.plugins.dws_icons', {
5
  createControl: function(n, cm) {
6
  switch (n) {
7
- case 'dws_icons':
8
- var c = cm.createButton('dws_icons', {
9
  title : 'Icons',
10
  onclick : function() {
11
  tb_show('Select icons', '../wp-content/plugins/bootstrap-shortcodes/js/plugins/icons.html?TB_iframe=1');
@@ -18,6 +18,6 @@
18
  return null;
19
  }
20
  });
21
- tinymce.PluginManager.add('dws_icons', tinymce.plugins.dws_icons);
22
  })();
23
 
1
  // JavaScript Document
2
  (function() {
3
  // Creates a new plugin class and a custom listbox
4
+ tinymce.create('tinymce.plugins.bs_icons', {
5
  createControl: function(n, cm) {
6
  switch (n) {
7
+ case 'bs_icons':
8
+ var c = cm.createButton('bs_icons', {
9
  title : 'Icons',
10
  onclick : function() {
11
  tb_show('Select icons', '../wp-content/plugins/bootstrap-shortcodes/js/plugins/icons.html?TB_iframe=1');
18
  return null;
19
  }
20
  });
21
+ tinymce.PluginManager.add('bs_icons', tinymce.plugins.bs_icons);
22
  })();
23
 
js/plugins/labels.js CHANGED
@@ -1,11 +1,11 @@
1
  // JavaScript Document
2
  (function() {
3
  // Creates a new plugin class and a custom listbox
4
- tinymce.create('tinymce.plugins.dws_labels', {
5
  createControl: function(n, cm) {
6
  switch (n) {
7
- case 'dws_labels':
8
- var c = cm.createSplitButton('dws_labels', {
9
  title : 'Boxes & frames shortcodes',
10
  onclick : function() {
11
  }
@@ -29,5 +29,5 @@
29
  return null;
30
  }
31
  });
32
- tinymce.PluginManager.add('dws_labels', tinymce.plugins.dws_labels);
33
  })();
1
  // JavaScript Document
2
  (function() {
3
  // Creates a new plugin class and a custom listbox
4
+ tinymce.create('tinymce.plugins.bs_labels', {
5
  createControl: function(n, cm) {
6
  switch (n) {
7
+ case 'bs_labels':
8
+ var c = cm.createSplitButton('bs_labels', {
9
  title : 'Boxes & frames shortcodes',
10
  onclick : function() {
11
  }
29
  return null;
30
  }
31
  });
32
+ tinymce.PluginManager.add('bs_labels', tinymce.plugins.bs_labels);
33
  })();
js/plugins/lead.js ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function() {
2
+ // Creates a new plugin class and a custom listbox
3
+ tinymce.create('tinymce.plugins.bs_lead', {
4
+ createControl: function(n, cm) {
5
+ switch (n) {
6
+ case 'bs_lead':
7
+ var c = cm.createButton('bs_lead', {
8
+ title : 'Lead',
9
+ onclick : function() {
10
+ tinyMCE.activeEditor.execCommand('mceInsertContent', false, '[lead]This is a lead text and needs your attention.[/lead]');
11
+ }
12
+ });
13
+ // Return the new splitbutton instance
14
+ return c;
15
+
16
+ }
17
+ return null;
18
+ }
19
+ });
20
+ tinymce.PluginManager.add('bs_lead', tinymce.plugins.bs_lead);
21
+ })();
js/plugins/tabs.html ADDED
@@ -0,0 +1,378 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2
+ <html xmlns="http://www.w3.org/1999/xhtml">
3
+
4
+ <head>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
6
+ <link rel="stylesheet" href="../../css/bootstrap.css" />
7
+ <link rel="stylesheet" href="../../css/admin.css" />
8
+ <script type="text/javascript" src="../jquery.js"></script>
9
+ <script type="text/javascript" src="../bootstrap.js"></script>
10
+
11
+ <script type="text/javascript">
12
+ jQuery(function($) {
13
+ $('[data-editable]').live('click', function() {
14
+ if ($(this).find('input').length > 0) return;
15
+ var val = $.trim($(this).html());
16
+ $(this).html('<input type="text" />').find('input')[0].focus();
17
+ $(this).find('input').val(val);
18
+ $(this).find('input')[0].select();
19
+ var attr = $(this).attr('data-removable');
20
+
21
+ if (typeof attr !== 'undefined' && attr !== false) {
22
+ $('<i class="icon-remove" style="position:absolute; cursor:pointer; margin:6px 0 0 7px;"></i>').appendTo(this).click(function() {
23
+ $(this).parent().remove();
24
+ })
25
+ .hover(function() {
26
+ $(this).parent()[0].removeAttribute('data-editable');
27
+ }, function() {
28
+ $(this).parent()[0].setAttribute('data-editable', 'true');
29
+ $(this).parent().find('input')[0].focus();
30
+ })
31
+ }
32
+ })
33
+
34
+ $('[data-editable] input').live('blur', function() {
35
+
36
+ $(this).parent().html($(this).val())
37
+ swich_column()
38
+ })
39
+
40
+
41
+
42
+
43
+ $('input[name=type]').on('change', function() {
44
+ if (this.id == 'sl_container') {
45
+ $('#c_parent').hide();
46
+ } else {
47
+ $('#c_parent').show();
48
+ }
49
+ })
50
+
51
+ /**
52
+ * Save tab
53
+ */
54
+ $('#savetab').click(function() {
55
+ var id = $('#txt_id').val();
56
+ var title = $('#txt_tabtitle').val();
57
+ var content = $('#txt_content').val();
58
+ var mparent = $('#sl_parent').val();
59
+ if (id.indexOf('#') > -1) {
60
+ $(id).html('<p>' + content + '</p>');
61
+ $('#myTab a[href=' + id + ']').text(title);
62
+ if (mparent != '') $('#myTab a[href=' + id + ']').parent().removeClass('active').appendTo($('#' + mparent).next());
63
+ } else {
64
+ $('#' + id).html(title + '<b class="caret"></b>')
65
+ }
66
+ $('#fields').hide();
67
+ $(this).hide();
68
+ $('#deletetab').hide();
69
+ $('.alert-info').fadeIn().delay(500).fadeOut();
70
+ $('#newtab').show();
71
+ });
72
+
73
+
74
+
75
+ /**
76
+ * Create new tab
77
+ */
78
+ $('#newtab').click(function(e) {
79
+ $('input[name=type]').each(function() {
80
+ this.removeAttribute('disabled')
81
+ });
82
+ if ($('#fields').is(':hidden')) {
83
+ $('#fields').fadeIn();
84
+ $('#txt_tabtitle').val('New tab');
85
+ $('#sl_tab')[0].checked = true;
86
+ $('#sl_parent').val('');
87
+ $('#txt_content').val('');
88
+ $('#c_parent').show();
89
+ $(this).val('Save');
90
+ return;
91
+ }
92
+ var title = $('#txt_tabtitle').val();
93
+ var type = $('input[name=type]:checked').val();
94
+ var mparent = $('#sl_parent').val();
95
+ var content = $('#txt_content').val();
96
+ var id = 'bs_tab' + e.timeStamp;
97
+
98
+ if (type == 'tab') {
99
+ if (mparent == '') {
100
+
101
+ $('#myTab').append('<li><a data-toggle="tab" href="#' + id + '">' + title + '</a></li>');
102
+ $('#myTabContent').append('<div id="' + id + '" class="tab-pane fade"><p>' + content + '</p></div>');
103
+ } else {
104
+ $('#' + mparent).next().append('<li><a data-toggle="tab" href="#' + id + '">' + title + '</a></li>');
105
+ $('#myTabContent').append('<div id="' + id + '" class="tab-pane fade"><p>' + content + '</p></div>');
106
+ }
107
+ } else {
108
+ $('#myTab').append('<li class="dropdown"><a id="' + id + '" data-toggle="dropdown" class="dropdown-toggle" href="#">' + title + '<b class="caret"></b></a><ul class="dropdown-menu"></ul></li>');
109
+ $('#sl_parent').append('<option value="' + id + '">' + title + '</option>');
110
+ }
111
+ $('#fields').hide();
112
+ $(this).val('Insert new tab');
113
+ $('.alert-success').fadeIn().delay(500).fadeOut();
114
+ })
115
+
116
+ /**
117
+ * Insert button
118
+ */
119
+ $('#btn_insert').click(function(e) {
120
+ //Generate shortcode
121
+ //--------------
122
+ // [tabs]
123
+ // [thead]
124
+ // [tab type="tab" href="#link" title="title"]
125
+ // [dropdown title="title"]
126
+ // [tab type="tab" href="#link" title="title"]
127
+ // [/dropdown]
128
+ // [/thead]
129
+ // [tcontents]
130
+ // [tcontent id="link"]
131
+ // [/tcontent]
132
+ // [/tcontents]
133
+ // [/tabs]
134
+ // ---------------
135
+
136
+ //Clean tab
137
+ $('#myTab li.add-new').remove();
138
+ $('#myTabContent').find('#bs_container,#bs_new_tab').remove();
139
+ var shortcode = '[tabs]<br class="nc"/>[thead]<br class="nc"/>';
140
+ var tid = Math.floor((Math.random() * 100) + 1);
141
+ //Generate header
142
+ $('#myTab>li').each(function(i, e) {
143
+ var $this = $(this);
144
+ var title = $this.find('a:first').text();
145
+ var href = $this.find('a:first').attr('href') + tid;
146
+ var sclass = (i == 0) ? 'active' : '';
147
+ if ($this.hasClass('dropdown')) {
148
+ var id = $this.find('a:first').attr('id') + tid;
149
+ shortcode += '[dropdown id="' + id + '" title="' + title + '"]<br class="nc"/>';
150
+ var subcode = '';
151
+ $(this).find('li').each(function() {
152
+ var shref = $(this).find('a').attr('href') + tid;
153
+ var stitle = $(this).find('a').text();
154
+
155
+ subcode += '[tab type="tab" href="' + shref + '" title="' + stitle + '"]<br class="nc"/>';
156
+ });
157
+ shortcode += subcode;
158
+ shortcode += '[/dropdown]<br class="nc"/>';
159
+ } else {
160
+
161
+ shortcode += '[tab class="' + sclass + '" type="tab" href="' + href + '" title="' + title + '"]<br class="nc"/>';
162
+ }
163
+
164
+ })
165
+ shortcode += '[/thead][tcontents]<br class="nc"/>';
166
+
167
+ //Generate content
168
+ $('#myTabContent > div').each(function(j, e) {
169
+ var content = $(this).find('.tab_content').val();
170
+ var id = this.id + tid;
171
+ sclass = (j == 0) ? 'active' : '';
172
+ shortcode += '[tcontent class="' + sclass + '" id="' + id + '"]' + content + '[/tcontent]<br class="nc"/>';
173
+ });
174
+ shortcode += '[/tcontents]<br class="nc"/>[/tabs]';
175
+
176
+ parent.tinymce.activeEditor.execCommand('mceInsertContent', false, shortcode);
177
+
178
+ parent.tb_remove();
179
+ })
180
+
181
+
182
+ $('.tab_title').live('keyup', function() {
183
+ var tid = $(this).closest('.tab-pane').attr('id');
184
+ if (tid != 'bs_container') {
185
+ $('a[href="#' + tid + '"]').html($(this).val());
186
+ } else {
187
+ $('#myTab > li.active > a ').html($(this).val() + ' <b class="caret"></b>');
188
+ $('.tab_parent option[value=' + $('#myTab > li.active > a ').attr('id') + ']').text($(this).val());
189
+ }
190
+ })
191
+
192
+ /**
193
+ * Tab delete
194
+ */
195
+ $('.tab-delete').live('click', function() {
196
+ var id = $(this).closest('.tab-pane').attr('id');
197
+ $(this).closest('.tab-pane').remove();
198
+ $('#myTab a[href=#' + id + ']').closest('li').remove();
199
+
200
+ });
201
+
202
+ $('.cnt-delte').click(function() {
203
+ $('.tab_parent option[value=' + $('#myTab > li.active > a ').attr('id') + ']').remove();
204
+ $('#myTab > li.active .dropdown-menu li a').each(function() {
205
+ var id = $(this).attr('href')
206
+ $(id).remove();
207
+ })
208
+
209
+ $('#myTab > li.active').remove();
210
+ $(this).closest('.tab-pane').removeClass('active in');
211
+
212
+ })
213
+
214
+ /**
215
+ * Tab focus
216
+ */
217
+ $('#myTab').on('click', 'a', function(e) {
218
+ e.preventDefault();
219
+ var title = $(this).text();
220
+ var type = $(this).hasClass('dropdown-toggle') ? 'container' : 'tab';
221
+ var mparent = '';
222
+ if (type == 'tab' && ($(this).closest('li.dropdown').length > 0)) {
223
+ mparent = $.trim($(this).closest('li.dropdown').find('a:first').attr('id'));
224
+ $($(this).attr('href')).find('.tab_parent').val(mparent);
225
+ }
226
+
227
+ if (type == 'container') {
228
+ $('#myTab > .active').removeClass('active')
229
+ $(this).closest('.dropdown').addClass('active');
230
+ $('#myTabContent > .active').removeClass('active').removeClass('in').end()
231
+ .find('#bs_container').addClass('active').addClass('in');
232
+
233
+ $('#myTabContent > .active').find('.tab_title').val($(this).html().replace(' <b class="caret"></b>', ''));
234
+
235
+ }
236
+
237
+ });
238
+
239
+ /*
240
+ * Tab parent change
241
+ */
242
+ $('.tab_parent').live('change', function() {
243
+
244
+ if ($(this).attr('id')) return;
245
+ var id = '#' + $(this).closest('.tab-pane').attr('id'),
246
+ pid = $(this).val();
247
+ $('#myTab >li').removeClass('active');
248
+ if (pid != '') {
249
+ $('#myTab a[href=' + id + ']').parent().removeClass('active').appendTo($('#' + pid).next());
250
+ } else {
251
+ if ($('#myTab a[href=' + id + ']').closest('.dropdown').length == 0) return
252
+ $('#myTab a[href=' + id + ']').parent().addClass('active').prependTo($('#myTab'));
253
+ }
254
+ })
255
+
256
+ $('#new_type').on('change', function() {
257
+ if ($(this).val() == 1) {
258
+ $('#new_parent,#new_content').hide();
259
+ } else {
260
+ $('#new_parent,#new_content').show();
261
+ }
262
+ });
263
+
264
+ $('.add-new').on('click', function() {
265
+ $('#new_title').val($('#new_title').attr('placeholder'));
266
+ $('#new_type').val('');
267
+ $('#new_parent').val('').show();
268
+ $('#new_content').val('').show();
269
+ })
270
+
271
+ $('#new_tab').click(function(e) {
272
+ var title = $('#new_title').val();
273
+ var type = $('#new_type').val();
274
+ var mparent = $('#new_parent').val();
275
+ var content = '<input type="text" class="tab_title" value="' + title + '" />\
276
+ <select class="tab_parent"> ' + $('.tab_parent:first').html() + '\
277
+ </select>\
278
+ <textarea class="tab_content">' + $('#new_content').val() + '</textarea>\
279
+ <button class="tab-delete btn"><i class="icon-trash"></i> Remove</button>';
280
+
281
+
282
+ var id = 'bs_tab' + e.timeStamp;
283
+
284
+ if (type != 1) {
285
+ if (mparent == '') {
286
+ $('#myTab').append('<li><a data-toggle="tab" href="#' + id + '">' + title + '</a></li>');
287
+ $('#myTabContent').append('<div id="' + id + '" class="tab-pane fade"><p>' + content + '</p></div>');
288
+ } else {
289
+ $('#' + mparent).next().append('<li><a data-toggle="tab" href="#' + id + '">' + title + '</a></li>');
290
+ $('#myTabContent').append('<div id="' + id + '" class="tab-pane fade"><p>' + content + '</p></div>');
291
+ }
292
+ $('a[href=#' + id + ']').trigger('click')
293
+ } else {
294
+ $('#myTab').append('<li class="dropdown"><a id="' + id + '" data-toggle="dropdown" class="dropdown-toggle" href="#">' + title + ' <b class="caret"></b></a><ul class="dropdown-menu"></ul></li>');
295
+ $('.tab_parent').append('<option value="' + id + '">' + title + '</option>');
296
+ $('#' + id).trigger('click')
297
+ }
298
+ });
299
+ });
300
+ </script>
301
+ </head>
302
+
303
+ <body>
304
+ <div id="bs-wrapper">
305
+ <ul id="myTab" class="nav nav-tabs">
306
+ <li class="active"><a href="#bs_first_tab" data-toggle="tab">Tab title</a>
307
+ </li>
308
+ <li class="dropdown">
309
+ <a id="bs_dropdown" href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown <b class="caret"></b></a>
310
+ <ul class="dropdown-menu">
311
+ <li><a href="#bs_dropdown1" data-toggle="tab">@fat</a>
312
+ </li>
313
+ <li><a href="#bs_dropdown2" data-toggle="tab">@mdo</a>
314
+ </li>
315
+ </ul>
316
+ </li>
317
+ <li class="add-new"><a href="#bs_new_tab" data-toggle="tab"><i class="glyphicon glyphicon-plus-sign" title="Add new tab"></i></a>
318
+ </li>
319
+ </ul>
320
+ <div id="myTabContent" class="tab-content">
321
+ <div class="tab-pane fade active in" id="bs_first_tab">
322
+ <input type="text" class="tab_title" value="Tab title" />
323
+ <select class="tab_parent">
324
+ <option value="">- Select tab parent -</option>
325
+ <option value="bs_dropdown">Dropdown</option>
326
+ </select>
327
+ <textarea class="tab_content">Raw denim you probably haven't heard of them jean shorts Austin. Nesciunt tofu stumptown aliqua, retro synth master cleanse. Mustache cliche tempor, williamsburg carles vegan helvetica. Reprehenderit butcher retro keffiyeh dreamcatcher synth. Cosby sweater eu banh mi, qui irure terry richardson ex squid. Aliquip placeat salvia cillum iphone. Seitan aliquip quis cardigan american apparel, butcher voluptate nisi qui.</textarea>
328
+ <button class="tab-delete btn"><i class="icon-trash"></i> Remove</button>
329
+ </div>
330
+
331
+ <div class="tab-pane fade" id="bs_container">
332
+ <input type="text" class="tab_title" value="Tab title" />
333
+ <button class="cnt-delte btn" style="display:block"><i class="icon-trash"></i> Remove</button>
334
+ </div>
335
+ <div class="tab-pane fade" id="bs_dropdown1">
336
+ <input type="text" class="tab_title" value="@fat" />
337
+ <select class="tab_parent">
338
+ <option value="">- Select tab parent -</option>
339
+ <option value="bs_dropdown">Dropdown</option>
340
+ </select>
341
+ <textarea class="tab_content">Nesciunt tofu stumptown aliqua, retro synth master cleanse. Mustache cliche tempor, williamsburg carles vegan helvetica. Reprehenderit butcher retro keffiyeh dreamcatcher synth. Cosby sweater eu banh mi, qui irure terry richardson ex squid. Aliquip placeat salvia cillum iphone.</textarea>
342
+ <button class="tab-delete btn"><i class="icon-trash"></i> Remove</button>
343
+ </div>
344
+ <div class="tab-pane fade" id="bs_dropdown2">
345
+ <input type="text" class="tab_title" value="@mdo" />
346
+ <select class="tab_parent">
347
+ <option value="">- Select tab parent -</option>
348
+ <option value="bs_dropdown">Dropdown</option>
349
+ </select>
350
+ <textarea class="tab_content">Raw denim you probably haven't heard of them jean shorts Austin. Nesciunt tofu stumptown aliqua, retro synth master cleanse. Mustache cliche tempor, williamsburg carles vegan helvetica.</textarea>
351
+ <button class="tab-delete btn"><i class="icon-trash"></i> Remove</button>
352
+ </div>
353
+ <div class="tab-pane fade" id="bs_new_tab">
354
+ <input id="new_title" type="text" onfocus="this.select()" placeholder="Tab title" value="Tab Title" />
355
+ <select id="new_type">
356
+ <option value="">- Select tab type -</option>
357
+ <option value="0">Tab</option>
358
+ <option value="1">Container</option>
359
+ </select>
360
+ <select id="new_parent" class="tab_parent">
361
+ <option value="">- Select tab parent -</option>
362
+ <option value="bs_dropdown">Default tab</option>
363
+ </select>
364
+ <textarea id="new_content" placeholder="Tab content"></textarea>
365
+ <br/>
366
+ <input id="new_tab" type="button" value="Create new tab" class="btn btn-success" />
367
+ </div>
368
+ </div>
369
+ <hr />
370
+ <p>
371
+ <button id="btn_insert" class="btn btn-primary">Insert shortcode</button>
372
+ </p>
373
+ </div>
374
+
375
+ </div>
376
+ </body>
377
+
378
+ </html>
js/plugins/tabs.js ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function() {
2
+ // Creates a new plugin class and a custom listbox
3
+ tinymce.create('tinymce.plugins.bs_tabs', {
4
+ createControl: function(n, cm) {
5
+ switch (n) {
6
+ case 'bs_tabs':
7
+ var c = cm.createButton('bs_tabs', {
8
+ title : 'Tabs',
9
+ onclick : function() {
10
+ tb_show('Tab builder', '../wp-content/plugins/bootstrap-shortcodes/js/plugins/tabs.html?TB_iframe=1');
11
+ }
12
+ });
13
+
14
+ // Return the new splitbutton instance
15
+ return c;
16
+
17
+ }
18
+ return null;
19
+ }
20
+ });
21
+ tinymce.PluginManager.add('bs_tabs', tinymce.plugins.bs_tabs);
22
+ })();
js/plugins/{well.js → wells.js} RENAMED
@@ -1,11 +1,11 @@
1
  // JavaScript Document
2
  (function() {
3
  // Creates a new plugin class and a custom listbox
4
- tinymce.create('tinymce.plugins.dws_wells', {
5
  createControl: function(n, cm) {
6
  switch (n) {
7
- case 'dws_wells':
8
- var c = cm.createSplitButton('dws_wells', {
9
  title : 'Well',
10
  onclick : function() {
11
  }
@@ -32,5 +32,5 @@
32
  return null;
33
  }
34
  });
35
- tinymce.PluginManager.add('dws_wells', tinymce.plugins.dws_wells);
36
  })();
1
  // JavaScript Document
2
  (function() {
3
  // Creates a new plugin class and a custom listbox
4
+ tinymce.create('tinymce.plugins.bs_wells', {
5
  createControl: function(n, cm) {
6
  switch (n) {
7
+ case 'bs_wells':
8
+ var c = cm.createSplitButton('bs_wells', {
9
  title : 'Well',
10
  onclick : function() {
11
  }
32
  return null;
33
  }
34
  });
35
+ tinymce.PluginManager.add('bs_wells', tinymce.plugins.bs_wells);
36
  })();
readme.txt CHANGED
@@ -1,9 +1,9 @@
1
  === Bootstrap Shortcodes ===
2
- Contributors: sinetheta, 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.1
7
  License: GNU General Public License v2.0
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -26,6 +26,15 @@ Please report issues [here](https://github.com/TheWebShop/bootstrap-shortcodes/i
26
 
27
  == Changelog ==
28
 
 
 
 
 
 
 
 
 
 
29
  = 1.1 =
30
  * Added support for wells
31
 
1
  === Bootstrap Shortcodes ===
2
+ 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.2
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.4 =
30
+ * Added support for tabs
31
+
32
+ = 1.3 =
33
+ * Added support for leads
34
+
35
+ = 1.2 =
36
+ * Added options to disable Shortcodes in TinyMCE editor
37
+
38
  = 1.1 =
39
  * Added support for wells
40