Insert Html Snippet - Version 1.2

Version Description

  • Compatibility with wordpress 4.3
  • Added options to sort snippets in admin area by id and title
  • Removed redirection after snippet edit
Download this release

Release Info

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

Code changes from version 1.1.1 to 1.2

admin/footer.php CHANGED
@@ -9,9 +9,10 @@
9
 
10
 
11
  <a target="_blank" href="http://xyzscripts.com/support/" class="xyz_suggest">Suggestions</a> -
12
- <a target="_blank" href="http://facebook.com/xyzscripts" class="xyz_fbook">Like us on facebook</a> -
13
- <a target="_blank" href="http://twitter.com/xyzscripts" class="xyz_twitt">Follow us on twitter</a> -
14
- <a target="_blank" href="https://plus.google.com/101215320403235276710/" class="xyz_gplus">+1 us on Google+</a>
 
15
 
16
 
17
  </div>
@@ -23,7 +24,7 @@
23
  <script language="javascript">
24
  function check_email(emailString)
25
  {
26
- var mailPattern = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
27
  var matchArray = emailString.match(mailPattern);
28
  if (emailString.length == 0)
29
  return false;
9
 
10
 
11
  <a target="_blank" href="http://xyzscripts.com/support/" class="xyz_suggest">Suggestions</a> -
12
+ <a target="_blank" href="http://facebook.com/xyzscripts" class="xyz_fbook">Like us on Facebook</a> -
13
+ <a target="_blank" href="http://twitter.com/xyzscripts" class="xyz_twitt">Follow us on Twitter</a> -
14
+ <a target="_blank" href="https://plus.google.com/+Xyzscripts/" class="xyz_gplus">+1 us on Google+</a> -
15
+ <a target="_blank" href="http://www.linkedin.com/company/xyzscripts" class="xyz_linkedin">Follow us on LinkedIn</a>
16
 
17
 
18
  </div>
24
  <script language="javascript">
25
  function check_email(emailString)
26
  {
27
+ var mailPattern = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,})$/;
28
  var matchArray = emailString.match(mailPattern);
29
  if (emailString.length == 0)
30
  return false;
admin/install.php CHANGED
@@ -25,6 +25,14 @@ function xyz_ihs_install(){
25
 
26
  global $wpdb;
27
  //global $current_user; get_currentuserinfo();
 
 
 
 
 
 
 
 
28
 
29
 
30
  if(get_option('xyz_credit_link') == "")
25
 
26
  global $wpdb;
27
  //global $current_user; get_currentuserinfo();
28
+ if(get_option('xyz_ihs_sort_order')=='')
29
+ {
30
+ add_option('xyz_ihs_sort_order','desc');
31
+ }
32
+ if(get_option('xyz_ihs_sort_field_name')=='')
33
+ {
34
+ add_option('xyz_ihs_sort_field_name','id');
35
+ }
36
 
37
 
38
  if(get_option('xyz_credit_link') == "")
admin/settings.php CHANGED
@@ -16,9 +16,13 @@ $_POST = stripslashes_deep($_POST);
16
 
17
  $xyz_ihs_credit = $_POST['xyz_ihs_credit'];
18
 
19
-
 
20
  update_option('xyz_ihs_limit',$xyz_ihs_limit);
21
  update_option('xyz_credit_link',$xyz_ihs_credit);
 
 
 
22
 
23
  ?>
24
 
@@ -42,7 +46,25 @@ $_POST = stripslashes_deep($_POST);
42
  <fieldset style=" width:100%; border:1px solid #F7F7F7; padding:10px 0px 15px 10px;">
43
  <legend ><h3>Settings</h3></legend>
44
  <table class="widefat" style="width:99%;">
45
- <tr valign="top">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
  <td scope="row" ><label for="xyz_ihs_credit">Credit link to author</label>
47
  </td>
48
  <td><select name="xyz_ihs_credit" id="xyz_ihs_credit">
@@ -53,9 +75,9 @@ $_POST = stripslashes_deep($_POST);
53
 
54
  </select>
55
  </td>
56
- </tr>
57
 
58
- <tr valign="top">
59
  <td scope="row" class=" settingInput" id=""><label for="xyz_ihs_limit">Pagination limit</label></td>
60
  <td id=""><input name="xyz_ihs_limit" type="text"
61
  id="xyz_ihs_limit" value="<?php if(isset($_POST['xyz_ihs_limit']) ){echo abs(intval($_POST['xyz_ihs_limit']));}else{print(get_option('xyz_ihs_limit'));} ?>" />
@@ -75,4 +97,4 @@ $_POST = stripslashes_deep($_POST);
75
  </div>
76
 
77
  </form>
78
- </div>
16
 
17
  $xyz_ihs_credit = $_POST['xyz_ihs_credit'];
18
 
19
+ $xyz_ihs_sortfield=$_POST['xyz_ihs_sort_by_field'];
20
+ $xyz_ihs_sortorder=$_POST['xyz_ihs_sort_by_order'];
21
  update_option('xyz_ihs_limit',$xyz_ihs_limit);
22
  update_option('xyz_credit_link',$xyz_ihs_credit);
23
+
24
+ update_option('xyz_ihs_sort_field_name',$xyz_ihs_sortfield);
25
+ update_option('xyz_ihs_sort_order',$xyz_ihs_sortorder);
26
 
27
  ?>
28
 
46
  <fieldset style=" width:100%; border:1px solid #F7F7F7; padding:10px 0px 15px 10px;">
47
  <legend ><h3>Settings</h3></legend>
48
  <table class="widefat" style="width:99%;">
49
+
50
+ <tr valign="top">
51
+ <td scope="row" ><label for="xyz_ihs_sort">Sorting of snippets</label>
52
+ </td>
53
+ <td>
54
+ <select id="xyz_ihs_sort_by_field" name="xyz_ihs_sort_by_field">
55
+ <option value="id" <?php if(isset($_POST['xyz_ihs_sort_by_field']) && $_POST['xyz_ihs_sort_by_field']=='id'){echo 'selected';} else if(get_option('xyz_ihs_sort_field_name')=="id"){echo 'selected';} ?>>Based on create time</option>
56
+ <option value="title" <?php if(isset($_POST['xyz_ihs_sort_by_field']) && $_POST['xyz_ihs_sort_by_field']=='title'){ echo 'selected';}elseif(get_option('xyz_ihs_sort_field_name')=="title"){echo 'selected';} ?>>Based on name</option>
57
+
58
+
59
+ </select>&nbsp;
60
+ <select id="xyz_ihs_sort_by_order" name="xyz_ihs_sort_by_order" >
61
+ <option value="asc" <?php if(isset($_POST['xyz_ihs_sort_by_order']) && $_POST['xyz_ihs_sort_by_order']=='asc'){ echo 'selected';}elseif(get_option('xyz_ihs_sort_order')=="asc"){echo 'selected';} ?>>Ascending</option>
62
+ <option value="desc" <?php if(isset($_POST['xyz_ihs_sort_by_order']) && $_POST['xyz_ihs_sort_by_order']=='desc'){echo 'selected';} elseif(get_option('xyz_ihs_sort_order')=="desc"){echo 'selected';} ?>>Descending</option>
63
+
64
+ </select>
65
+ </td>
66
+ </tr>
67
+ <tr valign="top">
68
  <td scope="row" ><label for="xyz_ihs_credit">Credit link to author</label>
69
  </td>
70
  <td><select name="xyz_ihs_credit" id="xyz_ihs_credit">
75
 
76
  </select>
77
  </td>
78
+ </tr>
79
 
80
+ <tr valign="top">
81
  <td scope="row" class=" settingInput" id=""><label for="xyz_ihs_limit">Pagination limit</label></td>
82
  <td id=""><input name="xyz_ihs_limit" type="text"
83
  id="xyz_ihs_limit" value="<?php if(isset($_POST['xyz_ihs_limit']) ){echo abs(intval($_POST['xyz_ihs_limit']));}else{print(get_option('xyz_ihs_limit'));} ?>" />
97
  </div>
98
 
99
  </form>
100
+ </div>
admin/snippet-add.php CHANGED
@@ -21,7 +21,7 @@ if(isset($_POST) && isset($_POST['addSubmit'])){
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.'"' ) ;
25
  if($snippet_count == 0){
26
  $xyz_shortCode = '[xyz-ihs snippet="'.$xyz_ihs_title.'"]';
27
  $wpdb->insert($wpdb->prefix.'xyz_ihs_short_code', array('title' =>$xyz_ihs_title,'content'=>$xyz_ihs_content,'short_code'=>$xyz_shortCode,'status'=>'1'),array('%s','%s','%s','%d'));
21
  if(ctype_alnum($temp_xyz_ihs_title))
22
  {
23
 
24
+ $snippet_count = $wpdb->query($wpdb->prepare( 'SELECT * FROM '.$wpdb->prefix.'xyz_ihs_short_code WHERE title=%s' ,$xyz_ihs_title)) ;
25
  if($snippet_count == 0){
26
  $xyz_shortCode = '[xyz-ihs snippet="'.$xyz_ihs_title.'"]';
27
  $wpdb->insert($wpdb->prefix.'xyz_ihs_short_code', array('title' =>$xyz_ihs_title,'content'=>$xyz_ihs_content,'short_code'=>$xyz_shortCode,'status'=>'1'),array('%s','%s','%s','%d'));
admin/snippet-edit.php CHANGED
@@ -6,6 +6,23 @@ get_currentuserinfo();
6
 
7
  $xyz_ihs_snippetId = $_GET['snippetId'];
8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  if(isset($_POST) && isset($_POST['updateSubmit'])){
10
 
11
  // echo '<pre>';
@@ -33,9 +50,10 @@ if(isset($_POST) && isset($_POST['updateSubmit'])){
33
 
34
  $wpdb->update($wpdb->prefix.'xyz_ihs_short_code', array('title'=>$xyz_ihs_title,'content'=>$xyz_ihs_content,'short_code'=>$xyz_shortCode,), array('id'=>$xyz_ihs_snippetId));
35
 
36
- header("Location:".admin_url('admin.php?page=insert-html-snippet-manage&msg=5'));
37
 
38
- }else{
 
39
  ?>
40
  <div class="system_notice_area_style0" id="system_notice_area">
41
  HTML Snippet already exists. &nbsp;&nbsp;&nbsp;<span id="system_notice_area_dismiss">Dismiss</span>
6
 
7
  $xyz_ihs_snippetId = $_GET['snippetId'];
8
 
9
+ $xyz_ihs_message = '';
10
+ if(isset($_GET['xyz_ihs_msg'])){
11
+ $xyz_ihs_message = $_GET['xyz_ihs_msg'];
12
+ }
13
+ if($xyz_ihs_message == 1){
14
+
15
+ ?>
16
+ <div class="system_notice_area_style1" id="system_notice_area">
17
+ HTML Snippet successfully updated.&nbsp;&nbsp;&nbsp;<span
18
+ id="system_notice_area_dismiss">Dismiss</span>
19
+ </div>
20
+ <?php
21
+ }
22
+
23
+
24
+
25
+
26
  if(isset($_POST) && isset($_POST['updateSubmit'])){
27
 
28
  // echo '<pre>';
50
 
51
  $wpdb->update($wpdb->prefix.'xyz_ihs_short_code', array('title'=>$xyz_ihs_title,'content'=>$xyz_ihs_content,'short_code'=>$xyz_shortCode,), array('id'=>$xyz_ihs_snippetId));
52
 
53
+ header("Location:".admin_url('admin.php?page=insert-html-snippet-manage&action=snippet-edit&snippetId='.$xyz_ihs_snippetId.'&xyz_ihs_msg=1'));
54
 
55
+ }
56
+ else{
57
  ?>
58
  <div class="system_notice_area_style0" id="system_notice_area">
59
  HTML Snippet already exists. &nbsp;&nbsp;&nbsp;<span id="system_notice_area_dismiss">Dismiss</span>
admin/snippets.php CHANGED
@@ -70,9 +70,10 @@ id="system_notice_area_dismiss">Dismiss</span>
70
  $pagenum = isset( $_GET['pagenum'] ) ? absint( $_GET['pagenum'] ) : 1;
71
  $limit = get_option('xyz_ihs_limit');
72
  $offset = ( $pagenum - 1 ) * $limit;
 
 
73
 
74
-
75
- $entries = $wpdb->get_results( "SELECT * FROM ".$wpdb->prefix."xyz_ihs_short_code ORDER BY id DESC LIMIT $offset,$limit" );
76
 
77
  ?>
78
  <input id="submit_ihs"
70
  $pagenum = isset( $_GET['pagenum'] ) ? absint( $_GET['pagenum'] ) : 1;
71
  $limit = get_option('xyz_ihs_limit');
72
  $offset = ( $pagenum - 1 ) * $limit;
73
+ $field=get_option('xyz_ihs_sort_field_name');
74
+ $order=get_option('xyz_ihs_sort_order');
75
 
76
+ $entries = $wpdb->get_results( "SELECT * FROM ".$wpdb->prefix."xyz_ihs_short_code ORDER BY $field $order LIMIT $offset,$limit" );
 
77
 
78
  ?>
79
  <input id="submit_ihs"
admin/uninstall.php CHANGED
@@ -23,7 +23,8 @@ function xyz_ihs_network_uninstall($networkwide) {
23
  function xyz_ihs_uninstall(){
24
 
25
  global $wpdb;
26
-
 
27
  delete_option("xyz_ihs_limit");
28
 
29
  /* table delete*/
@@ -33,4 +34,4 @@ $wpdb->query("DROP TABLE ".$wpdb->prefix."xyz_ihs_short_code");
33
  }
34
 
35
  register_uninstall_hook( XYZ_INSERT_HTML_PLUGIN_FILE, 'xyz_ihs_network_uninstall' );
36
- ?>
23
  function xyz_ihs_uninstall(){
24
 
25
  global $wpdb;
26
+ delete_option("xyz_ihs_sort_order");
27
+ delete_option("xyz_ihs_sort_field_name");
28
  delete_option("xyz_ihs_limit");
29
 
30
  /* table delete*/
34
  }
35
 
36
  register_uninstall_hook( XYZ_INSERT_HTML_PLUGIN_FILE, 'xyz_ihs_network_uninstall' );
37
+ ?>
editor_plugin.js.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
-
3
  if ( ! is_user_logged_in() )
4
  die('You must be logged in to access this script.');
5
 
@@ -119,4 +119,4 @@ var tinymce_<?php echo $shortcodesXYZEH->buttonName; ?> =<?php echo json_encode(
119
  tinymce.PluginManager.add('<?php echo $shortcodesXYZEH->buttonName; ?>', tinymce.plugins.<?php echo $shortcodesXYZEH->buttonName; ?>);
120
  })();
121
 
122
- <?php } ?>
1
  <?php
2
+ header( 'Content-Type: text/javascript' );
3
  if ( ! is_user_logged_in() )
4
  die('You must be logged in to access this script.');
5
 
119
  tinymce.PluginManager.add('<?php echo $shortcodesXYZEH->buttonName; ?>', tinymce.plugins.<?php echo $shortcodesXYZEH->buttonName; ?>);
120
  })();
121
 
122
+ <?php } ?>
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.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.2
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: 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,6 +75,11 @@ More questions ? [Drop a mail](http://xyzscripts.com/members/support/ "XYZScript
75
 
76
  == Changelog ==
77
 
 
 
 
 
 
78
  = 1.1.1 =
79
  * Compatibility with wordpress 3.9
80
 
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.3
8
+ Stable tag: 1.2
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.2 =
79
+ * Compatibility with wordpress 4.3
80
+ * Added options to sort snippets in admin area by id and title
81
+ * Removed redirection after snippet edit
82
+
83
  = 1.1.1 =
84
  * Compatibility with wordpress 3.9
85
 
widget.php CHANGED
@@ -11,7 +11,7 @@ class Xyz_Insert_Html_Widget extends WP_Widget {
11
 
12
  /** constructor -- name this the same as the class above */
13
  function Xyz_Insert_Html_Widget() {
14
- parent::WP_Widget(false, $name = 'Insert Html Snippet');
15
  }
16
 
17
  /** @see WP_Widget::widget -- do not rename this */
11
 
12
  /** constructor -- name this the same as the class above */
13
  function Xyz_Insert_Html_Widget() {
14
+ parent::__construct(false, $name = 'Insert Html Snippet');
15
  }
16
 
17
  /** @see WP_Widget::widget -- do not rename this */
xyz-functions.php CHANGED
@@ -41,7 +41,7 @@ function xyz_ihs_links($links, $file) {
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;
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/+Xyzscripts/" class="xyz_gplus" title="+1 us on Google+"></a>';
45
  $links[] = '<a href="http://www.linkedin.com/company/xyzscripts" class="xyz_linkedin" title="Follow us on LinkedIn"></a>';
46
  }
47
  return $links;