Post Snippets - Version 1.5.2

Version Description

Download this release

Release Info

Developer artstorm
Plugin Icon 128x128 Post Snippets
Version 1.5.2
Comparing to
See all releases

Code changes from version 1.5.1 to 1.5.2

Files changed (2) hide show
  1. post-snippets.php +9 -5
  2. readme.txt +6 -2
post-snippets.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Post Snippets
4
  Plugin URI: http://wpstorm.net/wordpress-plugins/post-snippets/
5
  Description: Stores snippets of HTML code or reoccurring text that you often use in your posts. You can use predefined variables to replace parts of the snippet on insert. All snippets are available in the post editor with a TinyMCE button or Quicktags.
6
- Version: 1.5.1
7
  Author: Johan Steen
8
  Author URI: http://wpstorm.net/
9
  Text Domain: post-snippets
@@ -120,7 +120,8 @@ class post_snippets {
120
  for ($i = 0; $i < count($snippets); $i++) {
121
  if ($snippets[$i]['quicktag']) {
122
  // Make it js safe
123
- $theSnippet = str_replace('"','\"',str_replace(Chr(13), '', str_replace(Chr(10), '', $snippets[$i]['snippet'])));
 
124
  //$theSnippet = str_replace('<', '\x3C', str_replace('>', '\x3E', $theSnippet));
125
  $var_arr = explode(",",$snippets[$i]['vars']);
126
  $theVariables = "";
@@ -168,7 +169,8 @@ class post_snippets {
168
  for ($i = 0; $i < count($snippets); $i++) {
169
  if ($snippets[$i]['quicktag']) {
170
  // Make it js safe
171
- $theSnippet = str_replace('"','\"',str_replace(Chr(13), '', str_replace(Chr(10), '', $snippets[$i]['snippet'])));
 
172
  //$theSnippet = str_replace('<', '\x3C', str_replace('>', '\x3E', $theSnippet));
173
  $var_arr = explode(",",$snippets[$i]['vars']);
174
  $theVariables = "";
@@ -184,7 +186,9 @@ class post_snippets {
184
  echo "var insertString" . $i ." = createShortcode('".$snippets[$i]['title']."', variables".$i.");";
185
  }else{
186
  //echo "var insertString" . $i ." = '" . addslashes(stripslashes($theSnippet)). "';";
187
- echo "var insertString" . $i ." = '" . str_replace('<', '\x3C', str_replace('>', '\x3E', addslashes(stripslashes($theSnippet)) )). "';";
 
 
188
  }
189
  ?>
190
  var postSnippetsButton = document.getElementById('ed_psnip<?php echo $i; ?>');
@@ -239,7 +243,7 @@ JAVASCRIPT;
239
  */
240
  function wp_admin() {
241
  if (function_exists('add_options_page')) {
242
- add_options_page( 'Post Snippets Options', 'Post Snippets', 10, __FILE__, array(&$this, 'options_page') );
243
  }
244
  }
245
 
3
  Plugin Name: Post Snippets
4
  Plugin URI: http://wpstorm.net/wordpress-plugins/post-snippets/
5
  Description: Stores snippets of HTML code or reoccurring text that you often use in your posts. You can use predefined variables to replace parts of the snippet on insert. All snippets are available in the post editor with a TinyMCE button or Quicktags.
6
+ Version: 1.5.2
7
  Author: Johan Steen
8
  Author URI: http://wpstorm.net/
9
  Text Domain: post-snippets
120
  for ($i = 0; $i < count($snippets); $i++) {
121
  if ($snippets[$i]['quicktag']) {
122
  // Make it js safe
123
+ $theSnippet = $snippets[$i]['snippet'];
124
+ $theSnippet = str_replace('"','\"',str_replace(Chr(13), '', str_replace(Chr(10), '', $theSnippet)));
125
  //$theSnippet = str_replace('<', '\x3C', str_replace('>', '\x3E', $theSnippet));
126
  $var_arr = explode(",",$snippets[$i]['vars']);
127
  $theVariables = "";
169
  for ($i = 0; $i < count($snippets); $i++) {
170
  if ($snippets[$i]['quicktag']) {
171
  // Make it js safe
172
+ $theSnippet = $snippets[$i]['snippet'];
173
+ $theSnippet = str_replace('"','\"',str_replace(chr(13), '', str_replace(chr(10), '%%LF%%', $theSnippet)));
174
  //$theSnippet = str_replace('<', '\x3C', str_replace('>', '\x3E', $theSnippet));
175
  $var_arr = explode(",",$snippets[$i]['vars']);
176
  $theVariables = "";
186
  echo "var insertString" . $i ." = createShortcode('".$snippets[$i]['title']."', variables".$i.");";
187
  }else{
188
  //echo "var insertString" . $i ." = '" . addslashes(stripslashes($theSnippet)). "';";
189
+ $theSnippet = str_replace('<', '\x3C', str_replace('>', '\x3E', addslashes(stripslashes($theSnippet)) ));
190
+ $theSnippet = str_replace('%%LF%%', '\n', $theSnippet);
191
+ echo "var insertString" . $i ." = '" . $theSnippet . "';";
192
  }
193
  ?>
194
  var postSnippetsButton = document.getElementById('ed_psnip<?php echo $i; ?>');
243
  */
244
  function wp_admin() {
245
  if (function_exists('add_options_page')) {
246
+ add_options_page( 'Post Snippets Options', 'Post Snippets', 'administrator', __FILE__, array(&$this, 'options_page') );
247
  }
248
  }
249
 
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: artstorm
3
  Donate link: http://wpstorm.net/wordpress-plugins/post-snippets/#pintware
4
  Tags: post, admin, snippet, html, custom, page, dynamic, editor, quicktag
5
  Requires at least: 2.7
6
- Tested up to: 2.9.2
7
- Stable tag: 1.5.1
8
 
9
  Store snippets of HTML code or reoccurring text that you often use in your posts. Custom variables can be used.
10
 
@@ -52,6 +52,10 @@ Please visit [Post Snippets' Comments](http://wpstorm.net/wordpress-plugins/post
52
 
53
  == Changelog ==
54
 
 
 
 
 
55
  = Version 1.5.1 - 12 Mar 2010 =
56
  * Fixed ampersands when used in a shortcode, so they are XHTML valid.
57
 
3
  Donate link: http://wpstorm.net/wordpress-plugins/post-snippets/#pintware
4
  Tags: post, admin, snippet, html, custom, page, dynamic, editor, quicktag
5
  Requires at least: 2.7
6
+ Tested up to: 3.0.1
7
+ Stable tag: 1.5.2
8
 
9
  Store snippets of HTML code or reoccurring text that you often use in your posts. Custom variables can be used.
10
 
52
 
53
  == Changelog ==
54
 
55
+ = Version 1.5.2 - 17 Sep 2010 =
56
+ * The plugin now keeps linefeed formatting when inserting a snippet directly with a quicktag in the HTML editor.
57
+ * Updated the code to not generate warnings when running WordPress in debug mode.
58
+
59
  = Version 1.5.1 - 12 Mar 2010 =
60
  * Fixed ampersands when used in a shortcode, so they are XHTML valid.
61