Insert Html Snippet - Version 1.1.1

Version Description

  • Compatibility with wordpress 3.9
Download this release

Release Info

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

Code changes from version 1.1 to 1.1.1

admin/menu.php CHANGED
@@ -1,9 +1,7 @@
1
  <?php
2
 
3
- if ( is_admin() ){
4
-
5
  add_action('admin_menu', 'xyz_ihs_menu');
6
- }
7
 
8
  function xyz_ihs_menu(){
9
 
1
  <?php
2
 
 
 
3
  add_action('admin_menu', 'xyz_ihs_menu');
4
+
5
 
6
  function xyz_ihs_menu(){
7
 
css/xyz_ihs_styles.css CHANGED
@@ -82,7 +82,7 @@ z-index:100000;
82
  }
83
 
84
 
85
- .xyz_suggest,.xyz_star,.xyz_donate,.xyz_fbook,.xyz_support,.xyz_twitt,.xyz_gplus{
86
  height:16px;
87
  background-repeat: no-repeat;
88
  background-position: left center;
@@ -125,11 +125,12 @@ z-index:100000;
125
 
126
  background-image: url('../images/gplus.png');
127
  }
 
 
 
 
128
 
129
 
130
- #insert-html-snippet .xyz_gplus{
131
- margin-left: 3px;
132
- }
133
 
134
  #insert-html-snippet .plugin-version-author-uri {
135
 
@@ -302,3 +303,6 @@ background-position: left bottom;
302
  padding:0;
303
  }
304
 
 
 
 
82
  }
83
 
84
 
85
+ .xyz_suggest,.xyz_star,.xyz_donate,.xyz_fbook,.xyz_support,.xyz_twitt,.xyz_gplus,.xyz_linkedin{
86
  height:16px;
87
  background-repeat: no-repeat;
88
  background-position: left center;
125
 
126
  background-image: url('../images/gplus.png');
127
  }
128
+ .xyz_linkedin{
129
+
130
+ background-image: url('../images/linkedin.png');
131
+ }
132
 
133
 
 
 
 
134
 
135
  #insert-html-snippet .plugin-version-author-uri {
136
 
303
  padding:0;
304
  }
305
 
306
+ i.xyz-ihs-own-icon {
307
+ background-image: url('../images/logo.png');
308
+ }
editor_plugin.js.php CHANGED
@@ -8,16 +8,45 @@
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
 
@@ -37,7 +66,7 @@ var tinymce_<?php echo $shortcodesXYZEH->buttonName; ?> =<?php echo json_encode(
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
  };
@@ -90,3 +119,4 @@ var tinymce_<?php echo $shortcodesXYZEH->buttonName; ?> =<?php echo json_encode(
90
  tinymce.PluginManager.add('<?php echo $shortcodesXYZEH->buttonName; ?>', tinymce.plugins.<?php echo $shortcodesXYZEH->buttonName; ?>);
91
  })();
92
 
 
8
 
9
  global $wpdb;
10
 
 
 
 
 
 
11
 
12
+ $xyz_snippets_arr=$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 );
13
+ // print_r($xyz_snippets_arr);
14
+ if(count($xyz_snippets_arr)==0)
15
  die;
16
 
17
+ if(floatval(get_bloginfo('version'))>=3.9)
18
+ {
19
  ?>
20
+ (function() {
21
+
22
+ tinymce.PluginManager.add('<?php echo $shortcodesXYZEH->buttonName; ?>', function( editor, url ) {
23
+ editor.addButton( '<?php echo $shortcodesXYZEH->buttonName; ?>', {
24
+ title: 'Insert HTML Snippet',
25
+ type: 'menubutton',
26
+ icon: 'icon xyz-ihs-own-icon',
27
+ menu: [
28
+ <?php foreach ($xyz_snippets_arr as $key=>$val) { ?>
29
+ {
30
+ text: '<?php echo addslashes($val['title']); ?>',
31
+ value: '[xyz-ihs snippet="<?php echo addslashes($val['title']); ?>"]',
32
+ onclick: function() {
33
+ editor.insertContent(this.value());
34
+ }
35
+ },
36
+ <?php } ?>
37
+ ]
38
+ });
39
+ });
40
+
41
+ })();
42
+ <?php } else {
43
+
44
+ $xyz_snippets = array(
45
+ 'title' =>'Insert HTML Snippet',
46
+ 'url' => plugins_url('insert-html-snippet/images/logo.png'),
47
+ 'xyz_ihs_snippets' => $xyz_snippets_arr
48
+ );
49
+ ?>
50
 
51
  var tinymce_<?php echo $shortcodesXYZEH->buttonName; ?> =<?php echo json_encode($xyz_snippets) ?>;
52
 
66
  init : function(ed, url) {
67
 
68
  tinymce_<?php echo $shortcodesXYZEH->buttonName; ?>.insert = function(){
69
+ if(this.v && this.v != ''){
70
  tinymce.execCommand('mceInsertContent', false, '[xyz-ihs snippet="'+tinymce_<?php echo $shortcodesXYZEH->buttonName; ?>.xyz_ihs_snippets[this.v]['title']+'"]');
71
  }
72
  };
119
  tinymce.PluginManager.add('<?php echo $shortcodesXYZEH->buttonName; ?>', tinymce.plugins.<?php echo $shortcodesXYZEH->buttonName; ?>);
120
  })();
121
 
122
+ <?php } ?>
images/linkedin.png ADDED
Binary file
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.1
7
  Author: xyzscripts.com
8
  Author URI: http://xyzscripts.com/
9
  Text Domain: insert-html-snippet
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.1
7
  Author: xyzscripts.com
8
  Author URI: http://xyzscripts.com/
9
  Text Domain: insert-html-snippet
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.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.
@@ -75,6 +75,9 @@ More questions ? [Drop a mail](http://xyzscripts.com/members/support/ "XYZScript
75
 
76
  == Changelog ==
77
 
 
 
 
78
  = 1.1 =
79
  * Support for shortcodes in html content
80
  * Snippet chooser TinyMCE plugin modified
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: 4.0
8
+ Stable tag: 1.1.1
9
  License: GPLv2 or later
10
 
11
  Add HTML, CSS and javascript code to your pages and posts easily using shortcodes.
75
 
76
  == Changelog ==
77
 
78
+ = 1.1.1 =
79
+ * Compatibility with wordpress 3.9
80
+
81
  = 1.1 =
82
  * Support for shortcodes in html content
83
  * Snippet chooser TinyMCE plugin modified
shortcode-handler.php CHANGED
@@ -38,4 +38,4 @@ function xyz_ihs_display_content($xyz_snippet_name){
38
  }
39
 
40
 
41
- //add_filter('widget_text', 'do_shortcode');
38
  }
39
 
40
 
41
+ add_filter('widget_text', 'do_shortcode'); // to run shortcodes in text widgets
xyz-functions.php CHANGED
@@ -39,9 +39,10 @@ function xyz_ihs_links($links, $file) {
39
  if ($file == $base) {
40
 
41
  $links[] = '<a href="http://xyzscripts.com/support/" class="xyz_support" title="Support"></a>';
42
- $links[] = '<a href="http://twitter.com/xyzscripts" class="xyz_twitt" title="Follow us on twitter"></a>';
43
- $links[] = '<a href="https://www.facebook.com/xyzscripts" class="xyz_fbook" title="Facebook"></a>';
44
  $links[] = '<a href="https://plus.google.com/101215320403235276710/" class="xyz_gplus" title="+1"></a>';
 
45
  }
46
  return $links;
47
  }
39
  if ($file == $base) {
40
 
41
  $links[] = '<a href="http://xyzscripts.com/support/" class="xyz_support" title="Support"></a>';
42
+ $links[] = '<a href="http://twitter.com/xyzscripts" class="xyz_twitt" title="Follow us on Twitter"></a>';
43
+ $links[] = '<a href="https://www.facebook.com/xyzscripts" class="xyz_fbook" title="Like us on Facebook"></a>';
44
  $links[] = '<a href="https://plus.google.com/101215320403235276710/" class="xyz_gplus" title="+1"></a>';
45
+ $links[] = '<a href="http://www.linkedin.com/company/xyzscripts" class="xyz_linkedin" title="Follow us on LinkedIn"></a>';
46
  }
47
  return $links;
48
  }