Post Snippets - Version 3.0.18

Version Description

Download this release

Release Info

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

Code changes from version 3.0.17 to 3.0.18

assets/post-snippets.js CHANGED
@@ -145,7 +145,8 @@ jQuery(document).ready(function ($) {
145
 
146
  $("[data-save-snippet]").click(function (e) {
147
  e.preventDefault();
148
- var key = $(this).data("save-snippet");
 
149
  var data = {
150
  'action': 'update_post_snippet',
151
  'key': key,
@@ -154,7 +155,8 @@ jQuery(document).ready(function ($) {
154
  'vars': $("#vars-" + key).val(),
155
  'shortcode': $("#shortcode-" + key).get(0).checked ? 1 : 0,
156
  'php': $("#php-" + key).get(0).checked ? 1 : 0,
157
- 'wptexturize': $("#wptexturize-" + key).get(0).checked ? 1 : 0
 
158
  };
159
  $.post(ajaxurl, data, function (res) {
160
  if(res.success){
145
 
146
  $("[data-save-snippet]").click(function (e) {
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,
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
  };
161
  $.post(ajaxurl, data, function (res) {
162
  if(res.success){
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.17
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.17' );
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.18
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.18' );
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.17
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -107,6 +107,10 @@ your clients to be able to use PHP code in a post snippet.
107
 
108
  == Changelog ==
109
 
 
 
 
 
110
  = Version 3.0.17 - 8 Apr 2020 =
111
 
112
  * Fixed On first activation, warning usort() expects parameter 1 to be array.
4
  Requires at least: 3.3
5
  Tested up to: 5.4
6
  Requires PHP: 5.3
7
+ Stable tag: 3.0.18
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.18 - 17 Apr 2020 =
111
+
112
+ * Fixed Title not saving on save button
113
+
114
  = Version 3.0.17 - 8 Apr 2020 =
115
 
116
  * Fixed On first activation, warning usort() expects parameter 1 to be array.
src/PostSnippets/Admin.php CHANGED
@@ -1050,6 +1050,10 @@ class Admin
1050
  if ( empty($snippets) ) {
1051
  wp_send_json_error();
1052
  }
 
 
 
 
1053
 
1054
  if ( isset( $snippets[$key] ) ) {
1055
  $snippets[$key]['description'] = wp_specialchars_decode( stripslashes( $_POST['description'] ) );
@@ -1058,6 +1062,9 @@ class Admin
1058
  $snippets[$key]['shortcode'] = wp_specialchars_decode( stripslashes( $_POST['shortcode'] ) );
1059
  $snippets[$key]['php'] = wp_specialchars_decode( stripslashes( $_POST['php'] ) );
1060
  $snippets[$key]['wptexturize'] = wp_specialchars_decode( stripslashes( $_POST['wptexturize'] ) );
 
 
 
1061
  update_option( 'post_snippets_options', $snippets );
1062
  }
1063
 
1050
  if ( empty($snippets) ) {
1051
  wp_send_json_error();
1052
  }
1053
+ $title = "";
1054
+ if(isset($_POST['title'])){
1055
+ $title = sanitize_title( $_POST['title'] );
1056
+ }
1057
 
1058
  if ( isset( $snippets[$key] ) ) {
1059
  $snippets[$key]['description'] = wp_specialchars_decode( stripslashes( $_POST['description'] ) );
1062
  $snippets[$key]['shortcode'] = wp_specialchars_decode( stripslashes( $_POST['shortcode'] ) );
1063
  $snippets[$key]['php'] = wp_specialchars_decode( stripslashes( $_POST['php'] ) );
1064
  $snippets[$key]['wptexturize'] = wp_specialchars_decode( stripslashes( $_POST['wptexturize'] ) );
1065
+ if(!empty($title)){
1066
+ $snippets[ $key ]['title'] = $title;
1067
+ }
1068
  update_option( 'post_snippets_options', $snippets );
1069
  }
1070