Post Snippets - Version 3.0.20

Version Description

Download this release

Release Info

Developer wpexpertsio
Plugin Icon 128x128 Post Snippets
Version 3.0.20
Comparing to
See all releases

Code changes from version 3.0.19 to 3.0.20

assets/post-snippets.js CHANGED
@@ -138,6 +138,7 @@ jQuery(document).ready(function ($) {
138
  wrap.toggleClass('edit');
139
  }else{
140
  alert(res.data);
 
141
  }
142
  });
143
  return false;
@@ -147,6 +148,11 @@ jQuery(document).ready(function ($) {
147
  e.preventDefault();
148
  var key = $(this).data("save-snippet");
149
  var title = $("#snippet-" + key + "-title").html();
 
 
 
 
 
150
  var data = {
151
  'action': 'update_post_snippet',
152
  'key': key,
@@ -154,7 +160,7 @@ jQuery(document).ready(function ($) {
154
  'description': $("#description-" + key).val(),
155
  'vars': $("#vars-" + key).val(),
156
  'shortcode': $("#shortcode-" + key).get(0).checked ? 1 : 0,
157
- 'php': $("#php-" + key).get(0).checked ? 1 : 0,
158
  'wptexturize': $("#wptexturize-" + key).get(0).checked ? 1 : 0,
159
  'title' : title
160
  };
138
  wrap.toggleClass('edit');
139
  }else{
140
  alert(res.data);
141
+ wrap.toggleClass('edit');
142
  }
143
  });
144
  return false;
148
  e.preventDefault();
149
  var key = $(this).data("save-snippet");
150
  var title = $("#snippet-" + key + "-title").html();
151
+ var snippet_php = 0;
152
+ if ( $("#php-" + key).length ) {
153
+ var snippet_php = $("#php-" + key).get(0).checked ? 1 : 0;
154
+ }
155
+
156
  var data = {
157
  'action': 'update_post_snippet',
158
  'key': key,
160
  'description': $("#description-" + key).val(),
161
  'vars': $("#vars-" + key).val(),
162
  'shortcode': $("#shortcode-" + key).get(0).checked ? 1 : 0,
163
+ 'php': snippet_php,
164
  'wptexturize': $("#wptexturize-" + key).get(0).checked ? 1 : 0,
165
  'title' : title
166
  };
post-snippets.php CHANGED
@@ -12,7 +12,7 @@
12
  * Plugin Name: Post Snippets
13
  * Plugin URI: https://www.postsnippets.com
14
  * Description: Create a library of reusable content and insert it into your posts and pages. Navigate to "Settings > Post Snippets" to get started.
15
- * Version: 3.0.19
16
  * Author: Postsnippets
17
  * Author URI: https://www.postsnippets.com
18
  * License: GPL-2.0+
@@ -94,7 +94,7 @@ if ( !function_exists( 'postsnippets_fs' ) ) {
94
  define( 'PS_MAIN_FILE', basename( __FILE__ ) );
95
  }
96
  if ( !defined( 'PS_VERSION' ) ) {
97
- define( 'PS_VERSION', '3.0.19' );
98
  }
99
  if ( !defined( 'PS_MAIN_FILE_PATH' ) ) {
100
  define( 'PS_MAIN_FILE_PATH', __FILE__ );
12
  * Plugin Name: Post Snippets
13
  * Plugin URI: https://www.postsnippets.com
14
  * Description: Create a library of reusable content and insert it into your posts and pages. Navigate to "Settings > Post Snippets" to get started.
15
+ * Version: 3.0.20
16
  * Author: Postsnippets
17
  * Author URI: https://www.postsnippets.com
18
  * License: GPL-2.0+
94
  define( 'PS_MAIN_FILE', basename( __FILE__ ) );
95
  }
96
  if ( !defined( 'PS_VERSION' ) ) {
97
+ define( 'PS_VERSION', '3.0.20' );
98
  }
99
  if ( !defined( 'PS_MAIN_FILE_PATH' ) ) {
100
  define( 'PS_MAIN_FILE_PATH', __FILE__ );
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: custom snippet, custom shortcode, snippet, snippets, shortcode, shortcodes
4
  Requires at least: 3.3
5
  Tested up to: 5.4
6
  Requires PHP: 5.3
7
- Stable tag: 3.0.19
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -107,6 +107,11 @@ your clients to be able to use PHP code in a post snippet.
107
 
108
  == Changelog ==
109
 
 
 
 
 
 
110
  = Version 3.0.19 - 29 Apr 2020 =
111
 
112
  * Fixed Title always saving in lowercase letters
4
  Requires at least: 3.3
5
  Tested up to: 5.4
6
  Requires PHP: 5.3
7
+ Stable tag: 3.0.20
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
107
 
108
  == Changelog ==
109
 
110
+ = Version 3.0.20 - 30 Apr 2020 =
111
+
112
+ * Fixed - Saving breaks when PHP snippets are disabled
113
+ * Fixed - Wrong message being displayed when we save title without making any changes
114
+
115
  = Version 3.0.19 - 29 Apr 2020 =
116
 
117
  * Fixed Title always saving in lowercase letters
src/PostSnippets/Admin.php CHANGED
@@ -1023,6 +1023,12 @@ class Admin
1023
  if ( empty($snippets) ) {
1024
  wp_send_json_error();
1025
  }
 
 
 
 
 
 
1026
  foreach ( $snippets as $key => $snippet ) {
1027
  if ( $snippet['title'] == $title ) {
1028
  wp_send_json_error( __( 'Duplicate title is not allowed. Please use different title for each snippets.', 'post-snippets' ) );
1023
  if ( empty($snippets) ) {
1024
  wp_send_json_error();
1025
  }
1026
+
1027
+ if ( isset( $snippets[$pkey] ) && $snippets[$pkey]['title'] == $title ) {
1028
+
1029
+ wp_send_json_error( __( 'You have not made any changes to the snippet title.', 'post-snippets' ) );
1030
+ }
1031
+
1032
  foreach ( $snippets as $key => $snippet ) {
1033
  if ( $snippet['title'] == $title ) {
1034
  wp_send_json_error( __( 'Duplicate title is not allowed. Please use different title for each snippets.', 'post-snippets' ) );