Insert Html Snippet - Version 1.1

Version Description

  • Support for shortcodes in html content
  • Snippet chooser TinyMCE plugin modified
  • A few bug fixes
Download this release

Release Info

Developer f1logic
Plugin Icon 128x128 Insert Html Snippet
Version 1.1
Comparing to
See all releases

Code changes from version 1.0.1 to 1.1

add_shortcode_tynimce.php CHANGED
@@ -3,7 +3,7 @@
3
  if(!class_exists('XYZ_Insert_Html_TinyMCESelector')):
4
 
5
  class XYZ_Insert_Html_TinyMCESelector{
6
- var $buttonName = 'xyz_ihs_snippet_selecter';
7
  function addSelector(){
8
  // Don't bother doing this stuff if the current user lacks permissions
9
  if ( ! current_user_can('edit_posts') && ! current_user_can('edit_pages') )
@@ -24,14 +24,7 @@ class XYZ_Insert_Html_TinyMCESelector{
24
  }
25
 
26
  function registerTmcePlugin($plugin_array){
27
-
28
-
29
- //$xyz_em_confLink = get_site_url()."/index.php?wp_nlm=confirmation&eId=".$xyz_em_emailLastId."&lId=".$listId."&both=".$combineValue."&appurl=".$xyz_em_appendUrl;
30
-
31
  $plugin_array[$this->buttonName] =get_site_url() . '/index.php?wp_ihs=editor_plugin_js';
32
-
33
- //$plugin_array[$this->buttonName] = plugins_url() . '/insert-html-snippet/editor_plugin.js.php';
34
-
35
  if ( get_user_option('rich_editing') == 'true')
36
  //var_dump($plugin_array);
37
  return $plugin_array;
@@ -45,3 +38,4 @@ if(!isset($shortcodesXYZEH)){
45
  add_action('admin_head', array($shortcodesXYZEH, 'addSelector'));
46
  }
47
 
 
3
  if(!class_exists('XYZ_Insert_Html_TinyMCESelector')):
4
 
5
  class XYZ_Insert_Html_TinyMCESelector{
6
+ var $buttonName = 'xyz_ihs_snippet_selector';
7
  function addSelector(){
8
  // Don't bother doing this stuff if the current user lacks permissions
9
  if ( ! current_user_can('edit_posts') && ! current_user_can('edit_pages') )
24
  }
25
 
26
  function registerTmcePlugin($plugin_array){
 
 
 
 
27
  $plugin_array[$this->buttonName] =get_site_url() . '/index.php?wp_ihs=editor_plugin_js';
 
 
 
28
  if ( get_user_option('rich_editing') == 'true')
29
  //var_dump($plugin_array);
30
  return $plugin_array;
38
  add_action('admin_head', array($shortcodesXYZEH, 'addSelector'));
39
  }
40
 
41
+ ?>
admin/footer.php CHANGED
@@ -121,8 +121,10 @@ type="text" value="<?php echo $current_user->user_email; ?>" /><span style="col
121
  <div style="width: 100%">
122
 
123
  <div class="xyz_our_plugins">
124
- See Also :
 
125
 
 
126
  <a target="_blank" href="http://wordpress.org/extend/plugins/lightbox-pop/">Lightbox Pop</a> ★
127
  <a target="_blank" href="http://wordpress.org/extend/plugins/full-screen-popup/">Full Screen Popup</a> ★
128
  <a target="_blank" href="http://wordpress.org/extend/plugins/popup-dialog-box/">Popup Dialog Box</a> ★
@@ -130,8 +132,11 @@ See Also :
130
  <a target="_blank" href="http://wordpress.org/extend/plugins/quick-box-popup/">Quick Box Popup</a> ★
131
  <a target="_blank" href="http://wordpress.org/extend/plugins/contact-form-manager/">Contact Form Manager</a> ★
132
  <a target="_blank" href="http://wordpress.org/extend/plugins/newsletter-manager/">Newsletter Manager</a> ★
133
- <a target="_blank" href="http://wordpress.org/extend/plugins/social-media-auto-publish/">Social Media Auto Publish</a>
134
-
 
 
 
135
  </div>
136
  </div>
137
  <div class="poweredBy">
@@ -140,4 +145,4 @@ Powered by <a href="http://xyzscripts.com" target="_blank">XYZScripts</a>
140
  <div style="clear: both;"></div>
141
 
142
  </div>
143
- <p style="clear: both;"></p>
121
  <div style="width: 100%">
122
 
123
  <div class="xyz_our_plugins">
124
+ Our Plugins :
125
+
126
 
127
+ <a target="_blank" href="http://wordpress.org/extend/plugins/insert-html-snippet/">Insert HTML Snippet</a> ★
128
  <a target="_blank" href="http://wordpress.org/extend/plugins/lightbox-pop/">Lightbox Pop</a> ★
129
  <a target="_blank" href="http://wordpress.org/extend/plugins/full-screen-popup/">Full Screen Popup</a> ★
130
  <a target="_blank" href="http://wordpress.org/extend/plugins/popup-dialog-box/">Popup Dialog Box</a> ★
132
  <a target="_blank" href="http://wordpress.org/extend/plugins/quick-box-popup/">Quick Box Popup</a> ★
133
  <a target="_blank" href="http://wordpress.org/extend/plugins/contact-form-manager/">Contact Form Manager</a> ★
134
  <a target="_blank" href="http://wordpress.org/extend/plugins/newsletter-manager/">Newsletter Manager</a> ★
135
+ <a target="_blank" href="http://wordpress.org/extend/plugins/social-media-auto-publish/">Social Media Auto Publish</a>★
136
+ <a target="_blank" href="http://wordpress.org/extend/plugins/facebook-auto-publish/">Facebook Auto Publish</a> ★
137
+ <a target="_blank" href="http://wordpress.org/extend/plugins/linkedin-auto-publish/">LinkedIn Auto Publish</a> ★
138
+ <a target="_blank" href="http://wordpress.org/extend/plugins/twitter-auto-publish/">Twitter Auto Publish</a> ★
139
+ <a target="_blank" href="http://wordpress.org/extend/plugins/insert-php-code-snippet/">Insert PHP Code Snippet</a>
140
  </div>
141
  </div>
142
  <div class="poweredBy">
145
  <div style="clear: both;"></div>
146
 
147
  </div>
148
+ <p style="clear: both;"></p>
admin/menu.php CHANGED
@@ -62,23 +62,21 @@ function xyz_ihs_about(){
62
  require( dirname( __FILE__ ) . '/footer.php' );
63
  }
64
 
65
- if(is_admin()){
66
-
 
67
  wp_enqueue_script('jquery');
68
 
69
  wp_register_script( 'xyz_notice_script', plugins_url('insert-html-snippet/js/notice.js') );
70
  wp_enqueue_script( 'xyz_notice_script' );
71
-
72
- // wp_register_style( 'xyz_ihs_style', plugins_url('insert-html-snippet/css/xyz_ihs_styles.css'));
73
- // wp_enqueue_style( 'xyz_ihs_style');
74
- function xyz_ihs_add_style(){
75
- // Register stylesheets
76
- wp_register_style('xyz_ihs_style', plugins_url('insert-html-snippet/css/xyz_ihs_styles.css'));
77
- wp_enqueue_style('xyz_ihs_style');
78
- }
79
- add_action('init', 'xyz_ihs_add_style');
80
-
81
  }
 
 
82
 
83
 
84
  ?>
62
  require( dirname( __FILE__ ) . '/footer.php' );
63
  }
64
 
65
+
66
+ function xyz_ihs_add_style_script(){
67
+
68
  wp_enqueue_script('jquery');
69
 
70
  wp_register_script( 'xyz_notice_script', plugins_url('insert-html-snippet/js/notice.js') );
71
  wp_enqueue_script( 'xyz_notice_script' );
72
+
73
+
74
+ // Register stylesheets
75
+ wp_register_style('xyz_ihs_style', plugins_url('insert-html-snippet/css/xyz_ihs_styles.css'));
76
+ wp_enqueue_style('xyz_ihs_style');
 
 
 
 
 
77
  }
78
+ add_action('admin_enqueue_scripts', 'xyz_ihs_add_style_script');
79
+
80
 
81
 
82
  ?>
admin/settings.php CHANGED
@@ -74,4 +74,5 @@ $_POST = stripslashes_deep($_POST);
74
 
75
  </div>
76
 
77
- </form>
 
74
 
75
  </div>
76
 
77
+ </form>
78
+ </div>
admin/snippet-add.php CHANGED
@@ -11,11 +11,14 @@ if(isset($_POST) && isset($_POST['addSubmit'])){
11
  // print_r($_POST);
12
  // die("JJJ");
13
 
 
 
 
14
  $xyz_ihs_title = str_replace(' ', '-', $_POST['snippetTitle']);
15
  $xyz_ihs_content = $_POST['snippetContent'];
16
 
17
  if($xyz_ihs_title != "" && $xyz_ihs_content != ""){
18
- if(ctype_alnum($xyz_ihs_title))
19
  {
20
 
21
  $snippet_count = $wpdb->query( 'SELECT * FROM '.$wpdb->prefix.'xyz_ihs_short_code WHERE title="'.$xyz_ihs_title.'"' ) ;
@@ -37,7 +40,7 @@ if(isset($_POST) && isset($_POST['addSubmit'])){
37
  {
38
  ?>
39
  <div class="system_notice_area_style0" id="system_notice_area">
40
- HTML Snippet title must be alphanumeric. &nbsp;&nbsp;&nbsp;<span id="system_notice_area_dismiss">Dismiss</span>
41
  </div>
42
  <?php
43
 
11
  // print_r($_POST);
12
  // die("JJJ");
13
 
14
+ $temp_xyz_ihs_title = str_replace(' ', '', $_POST['snippetTitle']);
15
+ $temp_xyz_ihs_title = str_replace('-', '', $temp_xyz_ihs_title);
16
+
17
  $xyz_ihs_title = str_replace(' ', '-', $_POST['snippetTitle']);
18
  $xyz_ihs_content = $_POST['snippetContent'];
19
 
20
  if($xyz_ihs_title != "" && $xyz_ihs_content != ""){
21
+ if(ctype_alnum($temp_xyz_ihs_title))
22
  {
23
 
24
  $snippet_count = $wpdb->query( 'SELECT * FROM '.$wpdb->prefix.'xyz_ihs_short_code WHERE title="'.$xyz_ihs_title.'"' ) ;
40
  {
41
  ?>
42
  <div class="system_notice_area_style0" id="system_notice_area">
43
+ HTML Snippet title can have only alphabets,numbers or hyphen. &nbsp;&nbsp;&nbsp;<span id="system_notice_area_dismiss">Dismiss</span>
44
  </div>
45
  <?php
46
 
admin/snippet-delete.php CHANGED
@@ -12,14 +12,14 @@ if($xyz_ihs_snippetId=="" || !is_numeric($xyz_ihs_snippetId)){
12
  exit();
13
 
14
  }
15
- $snippetCount = $wpdb->query( 'SELECT * FROM '.$wpdb->prefix.'xyz_ihs_short_code WHERE id="'.$xyz_ihs_snippetId.'" LIMIT 0,1' ) ;
16
 
17
  if($snippetCount==0){
18
  header("Location:".admin_url('admin.php?page=insert-html-snippet-manage&xyz_ihs_msg=2'));
19
  exit();
20
  }else{
21
 
22
- $wpdb->query( 'DELETE FROM '.$wpdb->prefix.'xyz_ihs_short_code WHERE id="'.$xyz_ihs_snippetId.'" ' ) ;
23
 
24
  header("Location:".admin_url('admin.php?page=insert-html-snippet-manage&xyz_ihs_msg=3&pagenum='.$xyz_ihs_pageno));
25
  exit();
12
  exit();
13
 
14
  }
15
+ $snippetCount = $wpdb->query($wpdb->prepare( 'SELECT * FROM '.$wpdb->prefix.'xyz_ihs_short_code WHERE id=%d LIMIT 0,1',$xyz_ihs_snippetId )) ;
16
 
17
  if($snippetCount==0){
18
  header("Location:".admin_url('admin.php?page=insert-html-snippet-manage&xyz_ihs_msg=2'));
19
  exit();
20
  }else{
21
 
22
+ $wpdb->query($wpdb->prepare( 'DELETE FROM '.$wpdb->prefix.'xyz_ihs_short_code WHERE id=%d',$xyz_ihs_snippetId)) ;
23
 
24
  header("Location:".admin_url('admin.php?page=insert-html-snippet-manage&xyz_ihs_msg=3&pagenum='.$xyz_ihs_pageno));
25
  exit();
admin/snippet-edit.php CHANGED
@@ -15,14 +15,18 @@ if(isset($_POST) && isset($_POST['updateSubmit'])){
15
  $_POST = xyz_trim_deep($_POST);
16
 
17
  $xyz_ihs_snippetId = $_GET['snippetId'];
 
 
 
 
18
  $xyz_ihs_title = str_replace(' ', '-', $_POST['snippetTitle']);
19
  $xyz_ihs_content = $_POST['snippetContent'];
20
 
21
  if($xyz_ihs_title != "" && $xyz_ihs_content != ""){
22
 
23
- if(ctype_alnum($xyz_ihs_title))
24
  {
25
- $snippet_count = $wpdb->query( 'SELECT * FROM '.$wpdb->prefix.'xyz_ihs_short_code WHERE id!="'.$xyz_ihs_snippetId.'" AND title="'.$xyz_ihs_title.'" LIMIT 0,1' ) ;
26
 
27
  if($snippet_count == 0){
28
  $xyz_shortCode = '[xyz-ihs snippet="'.$xyz_ihs_title.'"]';
@@ -44,7 +48,7 @@ if(isset($_POST) && isset($_POST['updateSubmit'])){
44
  {
45
  ?>
46
  <div class="system_notice_area_style0" id="system_notice_area">
47
- HTML Snippet title must be alphanumeric. &nbsp;&nbsp;&nbsp;<span id="system_notice_area_dismiss">Dismiss</span>
48
  </div>
49
  <?php
50
 
@@ -65,7 +69,7 @@ if(isset($_POST) && isset($_POST['updateSubmit'])){
65
  global $wpdb;
66
 
67
 
68
- $snippetDetails = $wpdb->get_results( 'SELECT * FROM '.$wpdb->prefix.'xyz_ihs_short_code WHERE id="'.$xyz_ihs_snippetId.'" LIMIT 0,1' ) ;
69
  $snippetDetails = $snippetDetails[0];
70
 
71
  ?>
15
  $_POST = xyz_trim_deep($_POST);
16
 
17
  $xyz_ihs_snippetId = $_GET['snippetId'];
18
+
19
+ $temp_xyz_ihs_title = str_replace(' ', '', $_POST['snippetTitle']);
20
+ $temp_xyz_ihs_title = str_replace('-', '', $temp_xyz_ihs_title);
21
+
22
  $xyz_ihs_title = str_replace(' ', '-', $_POST['snippetTitle']);
23
  $xyz_ihs_content = $_POST['snippetContent'];
24
 
25
  if($xyz_ihs_title != "" && $xyz_ihs_content != ""){
26
 
27
+ if(ctype_alnum($temp_xyz_ihs_title))
28
  {
29
+ $snippet_count = $wpdb->query($wpdb->prepare( 'SELECT * FROM '.$wpdb->prefix.'xyz_ihs_short_code WHERE id!=%d AND title=%s LIMIT 0,1',$xyz_ihs_snippetId,$xyz_ihs_title)) ;
30
 
31
  if($snippet_count == 0){
32
  $xyz_shortCode = '[xyz-ihs snippet="'.$xyz_ihs_title.'"]';
48
  {
49
  ?>
50
  <div class="system_notice_area_style0" id="system_notice_area">
51
+ HTML Snippet title can have only alphabets,numbers or hyphen. &nbsp;&nbsp;&nbsp;<span id="system_notice_area_dismiss">Dismiss</span>
52
  </div>
53
  <?php
54
 
69
  global $wpdb;
70
 
71
 
72
+ $snippetDetails = $wpdb->get_results($wpdb->prepare( 'SELECT * FROM '.$wpdb->prefix.'xyz_ihs_short_code WHERE id=%d LIMIT 0,1',$xyz_ihs_snippetId )) ;
73
  $snippetDetails = $snippetDetails[0];
74
 
75
  ?>
admin/snippet-status.php CHANGED
@@ -14,7 +14,7 @@ if($xyz_ihs_snippetId=="" || !is_numeric($xyz_ihs_snippetId)){
14
 
15
  }
16
 
17
- $snippetCount = $wpdb->query( 'SELECT * FROM '.$wpdb->prefix.'xyz_ihs_short_code WHERE id="'.$xyz_ihs_snippetId.'" LIMIT 0,1' ) ;
18
 
19
  if($snippetCount==0){
20
  header("Location:".admin_url('admin.php?page=insert-html-snippet-manage&xyz_ihs_msg=2'));
14
 
15
  }
16
 
17
+ $snippetCount = $wpdb->query($wpdb->prepare( 'SELECT * FROM '.$wpdb->prefix.'xyz_ihs_short_code WHERE id=%d LIMIT 0,1' ,$xyz_ihs_snippetId)) ;
18
 
19
  if($snippetCount==0){
20
  header("Location:".admin_url('admin.php?page=insert-html-snippet-manage&xyz_ihs_msg=2'));
css/xyz_ihs_styles.css CHANGED
@@ -2,19 +2,15 @@
2
  #system_notice_area_dismiss{
3
  color: #FFFFFF;
4
  cursor: pointer;
5
- z-index:100000;
6
  }
7
  .system_notice_area_style1 {
8
  background: #00C348;
9
  border: 1px solid green;
10
- z-index:100000;
11
  }
12
 
13
  .system_notice_area_style0 {
14
  background: #FA5A6A;
15
  border: 1px solid brown;
16
- z-index:100000;
17
-
18
  }
19
 
20
 
@@ -162,6 +158,51 @@ background: linear-gradient(top, #ffffff 0%,#a9e8f5 100%); /* W3C */
162
 
163
 
164
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
165
  #insert-html-snippet .plugin-version-author-uri a,
166
  #insert-html-snippet .plugin-version-author-uri a:link,
167
  #insert-html-snippet .plugin-version-author-uri a:hover,
@@ -207,13 +248,14 @@ background-position: left bottom;
207
  }
208
 
209
  .xyz_our_plugins{
210
- background: #F2F2F2; /* Old browsers */
211
  border: 1px solid #DFDFDF;
212
  border-radius:3px;
213
  width: 98%;
214
  padding-left: 10px;
215
  padding-top:10px;
216
- height:30px;
 
217
  margin-top:13px;
218
  }
219
 
2
  #system_notice_area_dismiss{
3
  color: #FFFFFF;
4
  cursor: pointer;
 
5
  }
6
  .system_notice_area_style1 {
7
  background: #00C348;
8
  border: 1px solid green;
 
9
  }
10
 
11
  .system_notice_area_style0 {
12
  background: #FA5A6A;
13
  border: 1px solid brown;
 
 
14
  }
15
 
16
 
158
 
159
 
160
  }
161
+
162
+ #insert-html-snippet .plugin-version-author-uri {
163
+
164
+ background-color: #F4F4F4;
165
+ min-height:16px;
166
+ border-radius:5px;
167
+ margin-bottom: 10px;
168
+ font-weight:bold;
169
+ padding: 5px;
170
+ color: #111111;
171
+
172
+ -webkit-box-shadow: 0 8px 6px -6px black;
173
+ -moz-box-shadow: 0 8px 6px -6px black;
174
+ box-shadow: 0 8px 6px -6px black;
175
+
176
+ }
177
+ #insert-html-snippet th,#insert-html-snippet td{
178
+ background: #a9e8f5; /* Old browsers */
179
+ background: linear-gradient( #ffffff,#a9e8f5 ); /* W3C */
180
+
181
+
182
+ }
183
+
184
+ #insert-html-snippet .plugin-title{
185
+
186
+ background: url('../images/xyz_logo.png'),linear-gradient( #ffffff,#a9e8f5 );
187
+ background-repeat: no-repeat;
188
+ background-position: left bottom;
189
+
190
+ }
191
+
192
+
193
+ #insert-html-snippet .plugin-version-author-uri a#xyz_update,
194
+ #insert-html-snippet.plugin-version-author-uri a#xyz_update:link,
195
+ #insert-html-snippet .plugin-version-author-uri a#xyz_update:hover,
196
+ #insert-html-snippet .plugin-version-author-uri a#xyz_update:active,
197
+ #insert-html-snippet .plugin-version-author-uri a#xyz_update:visited
198
+ {
199
+ color: red;
200
+ font-weight: bold;
201
+ text-decoration: blink;
202
+ }
203
+
204
+
205
+
206
  #insert-html-snippet .plugin-version-author-uri a,
207
  #insert-html-snippet .plugin-version-author-uri a:link,
208
  #insert-html-snippet .plugin-version-author-uri a:hover,
248
  }
249
 
250
  .xyz_our_plugins{
251
+ background: #F2F2F2; /* Old browsers */
252
  border: 1px solid #DFDFDF;
253
  border-radius:3px;
254
  width: 98%;
255
  padding-left: 10px;
256
  padding-top:10px;
257
+ height:auto;
258
+ min-height: 40px;
259
  margin-top:13px;
260
  }
261
 
editor_plugin.js.php CHANGED
@@ -7,12 +7,21 @@
7
  $shortcodesXYZEH = new XYZ_Insert_Html_TinyMCESelector();
8
 
9
  global $wpdb;
10
- // $ordered_sct = array_keys($shortcode_tags);
11
- // sort($ordered_sct);
12
 
13
- $ordered_sct = $wpdb->get_results( "SELECT * FROM ".$wpdb->prefix."xyz_ihs_short_code WHERE status='1' ORDER BY id DESC" );
 
 
 
 
 
 
 
 
14
  ?>
15
 
 
 
 
16
  (function() {
17
  //******* Load plugin specific language pack
18
 
@@ -26,6 +35,12 @@
26
  * @param {string} url Absolute URL to where the plugin is located.
27
  */
28
  init : function(ed, url) {
 
 
 
 
 
 
29
 
30
  },
31
 
@@ -41,27 +56,28 @@
41
  */
42
  createControl : function(n, cm) {
43
  if(n=='<?php echo $shortcodesXYZEH->buttonName; ?>'){
44
- var mlb = cm.createListBox('<?php echo $shortcodesXYZEH->buttonName; ?>List', {
45
- title : 'HTML Snippets',
46
- onselect : function(v) { //Option value as parameter
47
- if(v != ''){
48
- if(tinyMCE.activeEditor.selection.getContent() != ''){
49
- tinyMCE.activeEditor.selection.setContent('[' + v + ']' + tinyMCE.activeEditor.selection.getContent() + '[/' + v + ']');
50
- }
51
- else{
52
- tinyMCE.activeEditor.selection.setContent('[' + v + ']');
53
- }
54
- }
55
- }
56
  });
57
 
58
  // Add some values to the list box
59
- <?php foreach($ordered_sct as $sct):?>
60
- mlb.add('<?php echo $sct->title;?>', '<?php echo 'xyz-ihs snippet="'.$sct->title.'"';?>');
61
- <?php endforeach;?>
 
 
 
 
 
 
 
 
 
62
 
63
  // Return the new listbox instance
64
- return mlb;
65
  }
66
 
67
  return null;
@@ -73,3 +89,4 @@
73
  // Register plugin
74
  tinymce.PluginManager.add('<?php echo $shortcodesXYZEH->buttonName; ?>', tinymce.plugins.<?php echo $shortcodesXYZEH->buttonName; ?>);
75
  })();
 
7
  $shortcodesXYZEH = new XYZ_Insert_Html_TinyMCESelector();
8
 
9
  global $wpdb;
 
 
10
 
11
+ $xyz_snippets = array(
12
+ 'title' =>'Insert HTML Snippet',
13
+ 'url' => plugins_url('insert-html-snippet/images/logo.png'),
14
+ 'xyz_ihs_snippets' => $wpdb->get_results($wpdb->prepare( "SELECT id,title FROM ".$wpdb->prefix."xyz_ihs_short_code WHERE status=%d ORDER BY id DESC",1,ARRAY_A ))
15
+ );
16
+
17
+ if(count($xyz_snippets[ 'xyz_ihs_snippets'])==0)
18
+ die;
19
+
20
  ?>
21
 
22
+ var tinymce_<?php echo $shortcodesXYZEH->buttonName; ?> =<?php echo json_encode($xyz_snippets) ?>;
23
+
24
+
25
  (function() {
26
  //******* Load plugin specific language pack
27
 
35
  * @param {string} url Absolute URL to where the plugin is located.
36
  */
37
  init : function(ed, url) {
38
+
39
+ tinymce_<?php echo $shortcodesXYZEH->buttonName; ?>.insert = function(){
40
+ if(this.v != ''){
41
+ tinymce.execCommand('mceInsertContent', false, '[xyz-ihs snippet="'+tinymce_<?php echo $shortcodesXYZEH->buttonName; ?>.xyz_ihs_snippets[this.v]['title']+'"]');
42
+ }
43
+ };
44
 
45
  },
46
 
56
  */
57
  createControl : function(n, cm) {
58
  if(n=='<?php echo $shortcodesXYZEH->buttonName; ?>'){
59
+ var c = cm.createSplitButton('<?php echo $shortcodesXYZEH->buttonName; ?>', {
60
+ title : tinymce_<?php echo $shortcodesXYZEH->buttonName; ?>.title,
61
+ image : tinymce_<?php echo $shortcodesXYZEH->buttonName; ?>.url,
62
+ onclick : tinymce_<?php echo $shortcodesXYZEH->buttonName; ?>.insert
 
 
 
 
 
 
 
 
63
  });
64
 
65
  // Add some values to the list box
66
+
67
+
68
+ c.onRenderMenu.add(function(c, m){
69
+ for (var id in tinymce_<?php echo $shortcodesXYZEH->buttonName; ?>.xyz_ihs_snippets){
70
+ m.add({
71
+ v : id,
72
+ title : tinymce_<?php echo $shortcodesXYZEH->buttonName; ?>.xyz_ihs_snippets[id]['title'],
73
+ onclick : tinymce_<?php echo $shortcodesXYZEH->buttonName; ?>.insert
74
+ });
75
+ }
76
+ });
77
+
78
 
79
  // Return the new listbox instance
80
+ return c;
81
  }
82
 
83
  return null;
89
  // Register plugin
90
  tinymce.PluginManager.add('<?php echo $shortcodesXYZEH->buttonName; ?>', tinymce.plugins.<?php echo $shortcodesXYZEH->buttonName; ?>);
91
  })();
92
+
insert-html-snippet.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Insert HTML Snippet
4
  Plugin URI: http://xyzscripts.com/wordpress-plugins/insert-html-snippet/
5
  Description: Add HTML code to your pages and posts easily using shortcodes. This plugin lets you create a shortcode corresponding to any random HTML code such as ad codes, javascript, video embedding, etc. and use the same in your posts, pages or widgets.
6
- Version: 1.0.1
7
  Author: xyzscripts.com
8
  Author URI: http://xyzscripts.com/
9
  Text Domain: insert-html-snippet
@@ -63,7 +63,7 @@ if(get_option('xyz_credit_link')=="ihs"){
63
 
64
  }
65
  function xyz_ihs_credit() {
66
- $content = '<div style="width:100%;text-align:center; font-size:11px; clear:both"><a target="_blank" title="Insert HTML Snippet Wordpress Plugin" href="http://xyzscripts.com/wordpress-plugins/insert-html-snippet/">HTML Snippets</a> Powered By : <a target="_blank" title="PHP Scripts & Programs" href="http://www.xyzscripts.com" >XYZScripts.com</a></div>';
67
  echo $content;
68
  }
69
 
3
  Plugin Name: Insert HTML Snippet
4
  Plugin URI: http://xyzscripts.com/wordpress-plugins/insert-html-snippet/
5
  Description: Add HTML code to your pages and posts easily using shortcodes. This plugin lets you create a shortcode corresponding to any random HTML code such as ad codes, javascript, video embedding, etc. and use the same in your posts, pages or widgets.
6
+ Version: 1.1
7
  Author: xyzscripts.com
8
  Author URI: http://xyzscripts.com/
9
  Text Domain: insert-html-snippet
63
 
64
  }
65
  function xyz_ihs_credit() {
66
+ $content = '<div style="width:100%;text-align:center; font-size:11px; clear:both"><a target="_blank" title="Insert HTML Snippet Wordpress Plugin" href="http://xyzscripts.com/wordpress-plugins/insert-html-snippet/">HTML Snippets</a> Powered By : <a target="_blank" title="PHP Scripts & Wordpress Plugins" href="http://www.xyzscripts.com" >XYZScripts.com</a></div>';
67
  echo $content;
68
  }
69
 
readme.txt CHANGED
@@ -4,8 +4,8 @@ Donate link: http://xyzscripts.com/donate/
4
 
5
  Tags: insert HTML, add HTML, insert adsense, insert ads, insert addthis code, insert flash , insert javascript, add javascript, insert css, add css, HTML to shortcode, integrate ad codes, raw html, embed html, html inserter, ad inserter, css inserter
6
  Requires at least: 2.8
7
- Tested up to: 3.6
8
- Stable tag: 1.0.1
9
  License: GPLv2 or later
10
 
11
  Add HTML, CSS and javascript code to your pages and posts easily using shortcodes.
@@ -51,11 +51,15 @@ If you need any further help, you may contact our [support desk](http://xyzscrip
51
  ★ [Insert HTML Snippet User Guide](http://docs.xyzscripts.com/wordpress-plugins/insert-html-snippet/ "Insert HTML Snippet User Guide")
52
  ★ [Insert HTML Snippet FAQ](http://kb.xyzscripts.com/wordpress-plugins/insert-html-snippet/ "Insert HTML Snippet FAQ")
53
 
54
- = 1. The Insert Html Snippet is not working properly. =
55
 
56
  Please check the wordpress version you are using. Make sure it meets the minimum version recommended by us. Make sure all files of the `insert html snippet` plugin uploaded to the folder `wp-content/plugins/`
57
 
58
- = 2. I have 2 html shortcodes placed adjacently, but only one of them works. =
 
 
 
 
59
 
60
  Please use a whitespace to separate 2 shortcodes.
61
 
@@ -71,6 +75,11 @@ More questions ? [Drop a mail](http://xyzscripts.com/members/support/ "XYZScript
71
 
72
  == Changelog ==
73
 
 
 
 
 
 
74
  = 1.0.1 =
75
  * Support for network installation
76
  * Pagination bug fix
4
 
5
  Tags: insert HTML, add HTML, insert adsense, insert ads, insert addthis code, insert flash , insert javascript, add javascript, insert css, add css, HTML to shortcode, integrate ad codes, raw html, embed html, html inserter, ad inserter, css inserter
6
  Requires at least: 2.8
7
+ Tested up to: 3.8.1
8
+ Stable tag: 1.1
9
  License: GPLv2 or later
10
 
11
  Add HTML, CSS and javascript code to your pages and posts easily using shortcodes.
51
  ★ [Insert HTML Snippet User Guide](http://docs.xyzscripts.com/wordpress-plugins/insert-html-snippet/ "Insert HTML Snippet User Guide")
52
  ★ [Insert HTML Snippet FAQ](http://kb.xyzscripts.com/wordpress-plugins/insert-html-snippet/ "Insert HTML Snippet FAQ")
53
 
54
+ = The Insert Html Snippet is not working properly. =
55
 
56
  Please check the wordpress version you are using. Make sure it meets the minimum version recommended by us. Make sure all files of the `insert html snippet` plugin uploaded to the folder `wp-content/plugins/`
57
 
58
+ = Can I use shortcodes in html snippet ? =
59
+
60
+ Yes ofcourse.
61
+
62
+ = I have 2 html shortcodes placed adjacently, but only one of them works. =
63
 
64
  Please use a whitespace to separate 2 shortcodes.
65
 
75
 
76
  == Changelog ==
77
 
78
+ = 1.1 =
79
+ * Support for shortcodes in html content
80
+ * Snippet chooser TinyMCE plugin modified
81
+ * A few bug fixes
82
+
83
  = 1.0.1 =
84
  * Support for network installation
85
  * Pagination bug fix
shortcode-handler.php CHANGED
@@ -1,12 +1,7 @@
1
  <?php
2
  global $wpdb;
3
 
4
- // $totalDetails = $wpdb->get_results( "SELECT * FROM ".$wpdb->prefix."xyz_ihs_short_code WHERE status='1'" );
5
- // if(count($totalDetails)>0){
6
- // foreach ($totalDetails as $total){
7
- add_shortcode('xyz-ihs','xyz_ihs_display_content');
8
- // }
9
- // }
10
 
11
  function xyz_ihs_display_content($xyz_snippet_name){
12
  global $wpdb;
@@ -14,14 +9,14 @@ function xyz_ihs_display_content($xyz_snippet_name){
14
  if(is_array($xyz_snippet_name)){
15
  $snippet_name = $xyz_snippet_name['snippet'];
16
 
17
- $query = $wpdb->get_results( "SELECT * FROM ".$wpdb->prefix."xyz_ihs_short_code WHERE title='$snippet_name'" );
18
 
19
  if(count($query)>0){
20
 
21
  foreach ($query as $sippetdetails){
22
  // return stripslashes($sippetdetails->content);
23
  if($sippetdetails->status==1)
24
- return $sippetdetails->content;
25
  else
26
  return '';
27
  break;
@@ -29,17 +24,18 @@ function xyz_ihs_display_content($xyz_snippet_name){
29
 
30
  }else{
31
 
32
- return "<div style='padding:20px; font-size:16px; color:#FA5A6A; width:93%;text-align:center;background:lightyellow;border:1px solid #3FAFE3; margin:20px 0 20px 0'>
 
33
 
34
  Please use a valid short code to call snippet.
35
 
36
 
37
  </div>";
38
-
39
  }
40
 
41
  }
42
  }
43
 
44
 
45
- add_filter('widget_text', 'do_shortcode');
1
  <?php
2
  global $wpdb;
3
 
4
+ add_shortcode('xyz-ihs','xyz_ihs_display_content');
 
 
 
 
 
5
 
6
  function xyz_ihs_display_content($xyz_snippet_name){
7
  global $wpdb;
9
  if(is_array($xyz_snippet_name)){
10
  $snippet_name = $xyz_snippet_name['snippet'];
11
 
12
+ $query = $wpdb->get_results($wpdb->prepare( "SELECT * FROM ".$wpdb->prefix."xyz_ihs_short_code WHERE title=%s" ,$snippet_name));
13
 
14
  if(count($query)>0){
15
 
16
  foreach ($query as $sippetdetails){
17
  // return stripslashes($sippetdetails->content);
18
  if($sippetdetails->status==1)
19
+ return do_shortcode($sippetdetails->content) ;
20
  else
21
  return '';
22
  break;
24
 
25
  }else{
26
 
27
+ return '';
28
+ /* return "<div style='padding:20px; font-size:16px; color:#FA5A6A; width:93%;text-align:center;background:lightyellow;border:1px solid #3FAFE3; margin:20px 0 20px 0'>
29
 
30
  Please use a valid short code to call snippet.
31
 
32
 
33
  </div>";
34
+ */
35
  }
36
 
37
  }
38
  }
39
 
40
 
41
+ //add_filter('widget_text', 'do_shortcode');
widget.php CHANGED
@@ -21,14 +21,14 @@ class Xyz_Insert_Html_Widget extends WP_Widget {
21
  $title = apply_filters('widget_title', $instance['title']);
22
  $xyz_ihs_id = $instance['message'];
23
  //echo "SELECT content FROM ".$wpdb->prefix."xyz_ihs_short_code WHERE id='$xyz_ihs_title'";die;
24
- $entries = $wpdb->get_results( "SELECT content FROM ".$wpdb->prefix."xyz_ihs_short_code WHERE id='$xyz_ihs_id'" );
25
 
26
  $entry = $entries[0];
27
 
28
  echo $before_widget;
29
  if ( $title )
30
  echo $before_title . $title . $after_title;
31
- echo $entry->content;
32
 
33
  echo $after_widget;
34
 
@@ -45,7 +45,7 @@ class Xyz_Insert_Html_Widget extends WP_Widget {
45
  /** @see WP_Widget::form -- do not rename this */
46
  function form($instance) {
47
  global $wpdb;
48
- $entries = $wpdb->get_results( "SELECT * FROM ".$wpdb->prefix."xyz_ihs_short_code WHERE status='1' ORDER BY id DESC" );
49
 
50
 
51
  if(isset($instance['title'])){
21
  $title = apply_filters('widget_title', $instance['title']);
22
  $xyz_ihs_id = $instance['message'];
23
  //echo "SELECT content FROM ".$wpdb->prefix."xyz_ihs_short_code WHERE id='$xyz_ihs_title'";die;
24
+ $entries = $wpdb->get_results($wpdb->prepare( "SELECT content FROM ".$wpdb->prefix."xyz_ihs_short_code WHERE id=%d",$xyz_ihs_id ));
25
 
26
  $entry = $entries[0];
27
 
28
  echo $before_widget;
29
  if ( $title )
30
  echo $before_title . $title . $after_title;
31
+ echo do_shortcode($entry->content);
32
 
33
  echo $after_widget;
34
 
45
  /** @see WP_Widget::form -- do not rename this */
46
  function form($instance) {
47
  global $wpdb;
48
+ $entries = $wpdb->get_results($wpdb->prepare( "SELECT * FROM ".$wpdb->prefix."xyz_ihs_short_code WHERE status=%d ORDER BY id DESC",1 ));
49
 
50
 
51
  if(isset($instance['title'])){