Post Snippets - Version 1.8.6

Version Description

Download this release

Release Info

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

Code changes from version 1.8.5 to 1.8.6

Files changed (2) hide show
  1. post-snippets.php +40 -7
  2. readme.txt +34 -20
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.8.5
7
  Author: Johan Steen
8
  Author URI: http://wpstorm.net/
9
  Text Domain: post-snippets
@@ -69,8 +69,18 @@ class post_snippets {
69
  add_action( 'admin_footer', array(&$this,'insert_ui_dialog') );
70
 
71
  # Add Editor QuickTag button
72
- add_action( 'edit_form_advanced', array(&$this,'add_quicktag_button') );
73
- add_action( 'edit_page_form', array(&$this,'add_quicktag_button') );
 
 
 
 
 
 
 
 
 
 
74
  }
75
 
76
 
@@ -220,15 +230,12 @@ function edOpenPostSnippets(myField) {
220
  muppCanv = myField;
221
  jQuery( "#post-snippets-dialog" ).dialog( "open" );
222
  };
223
-
224
-
225
  <?php
226
  echo "</script>\n";
227
  echo "\n<!-- END: Post Snippets jQuery UI and related functions -->\n";
228
  }
229
 
230
 
231
-
232
  /**
233
  * Insert Snippet jQuery UI dialog HTML for the post editor
234
  *
@@ -287,15 +294,41 @@ function edOpenPostSnippets(myField) {
287
  echo "\n<!-- END: Post Snippets UI Dialog -->\n";
288
  }
289
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
290
  /**
291
  * Adds a QuickTag button to the HTML editor
292
  *
293
  * @see wp-includes/js/quicktags.dev.js
294
  * @since Post Snippets 1.7
 
295
  *
296
  * @returns Nothing
297
  */
298
- function add_quicktag_button() {
299
  echo "\n<!-- START: Post Snippets QuickTag button -->\n";
300
  ?>
301
  <script type="text/javascript" charset="utf-8">
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.8.6
7
  Author: Johan Steen
8
  Author URI: http://wpstorm.net/
9
  Text Domain: post-snippets
69
  add_action( 'admin_footer', array(&$this,'insert_ui_dialog') );
70
 
71
  # Add Editor QuickTag button
72
+ // IF WordPress is 3.3 or higher, use the new refactored method to add
73
+ // the quicktag button.
74
+ // Start showing a deprecated message from version 1.9 of the plugin for
75
+ // the old method. And remove it completely when the plugin hits 2.0.
76
+ global $wp_version;
77
+ if ( version_compare($wp_version, '3.3', '>=') ) {
78
+ add_action( 'admin_print_footer_scripts',
79
+ array(&$this,'add_quicktag_button'), 100 );
80
+ } else {
81
+ add_action( 'edit_form_advanced', array(&$this,'add_quicktag_button_pre33') );
82
+ add_action( 'edit_page_form', array(&$this,'add_quicktag_button_pre33') );
83
+ }
84
  }
85
 
86
 
230
  muppCanv = myField;
231
  jQuery( "#post-snippets-dialog" ).dialog( "open" );
232
  };
 
 
233
  <?php
234
  echo "</script>\n";
235
  echo "\n<!-- END: Post Snippets jQuery UI and related functions -->\n";
236
  }
237
 
238
 
 
239
  /**
240
  * Insert Snippet jQuery UI dialog HTML for the post editor
241
  *
294
  echo "\n<!-- END: Post Snippets UI Dialog -->\n";
295
  }
296
 
297
+
298
+ /**
299
+ * Adds a QuickTag button to the HTML editor.
300
+ *
301
+ * Compatible with WordPress 3.3 and newer.
302
+ *
303
+ * @see wp-includes/js/quicktags.dev.js -> qt.addButton()
304
+ * @since Post Snippets 1.8.6
305
+ *
306
+ * @returns Nothing
307
+ */
308
+ public function add_quicktag_button() {
309
+ echo "\n<!-- START: Add QuickTag button for Post Snippets -->\n";
310
+ ?>
311
+ <script type="text/javascript" charset="utf-8">
312
+ QTags.addButton( 'post_snippets_id', 'Post Snippets', qt_post_snippets );
313
+ function qt_post_snippets() {
314
+ jQuery( "#post-snippets-dialog" ).dialog( "open" );
315
+ }
316
+ </script>
317
+ <?php
318
+ echo "\n<!-- END: Add QuickTag button for Post Snippets -->\n";
319
+ }
320
+
321
+
322
  /**
323
  * Adds a QuickTag button to the HTML editor
324
  *
325
  * @see wp-includes/js/quicktags.dev.js
326
  * @since Post Snippets 1.7
327
+ * @deprecated Since 1.8.6
328
  *
329
  * @returns Nothing
330
  */
331
+ function add_quicktag_button_pre33() {
332
  echo "\n<!-- START: Post Snippets QuickTag button -->\n";
333
  ?>
334
  <script type="text/javascript" charset="utf-8">
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: artstorm
3
  Donate link: http://wpstorm.net/wordpress-plugins/post-snippets/#donation
4
  Tags: post, admin, snippet, html, custom, page, dynamic, editor, quicktag
5
  Requires at least: 3.0
6
- Tested up to: 3.2.1
7
- Stable tag: 1.8.5
8
 
9
  Store snippets of HTML code or reoccurring text that you often use in your posts. Custom variables can be used.
10
 
@@ -66,23 +66,30 @@ Please visit the [Support Forum](http://wordpress.org/tags/post-snippets?forum_i
66
 
67
  == Changelog ==
68
 
 
 
 
 
69
  = Version 1.8.5 - 22 Nov 2011 =
70
- * Included German translation by Brian Flores at [InMotion Hosting](http://www.inmotionhosting.com/).
71
- * For all translators: Updated the .pot file to include all the latest strings and changes.
 
72
 
73
  = Version 1.8.4 - 10 Nov 2011 =
74
- * Included Belarusian translation by [Alexander Ovsov](http://webhostinggeeks.com/science/).
75
 
76
  = Version 1.8.3 - 13 Oct 2011 =
77
- * Included Hebrew translation by [Sagive](http://www.sagive.co.il/).
78
 
79
  = Version 1.8.2 - 3 Sep 2011 =
80
- * Added support for using enclosed shortcodes with the snippets. Use the variable {content} in your snippets to retrieve the enclosed content.
 
81
  * Updated the dropdown help text.
82
- * Included Lithuanian translation by [Nata Strazda](http://www.webhostinghub.com/).
83
 
84
  = Version 1.8.1 - 11 Jul 2011 =
85
- * Fixed that a PHP warning is thrown when other scripts called the get_post_snippet() function without supplying a second argument.
 
86
 
87
  = Version 1.8 - 30 May 2011 =
88
  * Fixed an escaping problem with the snippet description.
@@ -90,15 +97,18 @@ Please visit the [Support Forum](http://wordpress.org/tags/post-snippets?forum_i
90
  * Snippets used as shortcodes can now nest other shortcodes in them.
91
 
92
  = Version 1.7.3 - 3 Mar 2011 =
93
- * Added a text area field in the settings panel to enter an optional description for each snippet. This decription is displayed for the editor writing a post in the jQuery Post Snippet dialog.
94
- * Fixed the styling of the quicktag jQuery window when the user have disabled the visual editor completely.
 
 
 
95
  * Fixed problem with line formatting in the new quicktag snippets.
96
  * Fixed a problem with JavaScript snippets breaking the admin page.
97
  * Various small bugfixes.
98
 
99
  = Version 1.7.2 - 28 Feb 2011 =
100
  * Specified text/javascript for the UI dialog script.
101
- * Updated the Spanish translation by [Melvis E. Leon Lopez](http://www.soludata.net/site/).
102
 
103
  = Version 1.7.1 - 26 Feb 2011 =
104
  * Added styling to the Tabs in the Quicktag jQuery dialog window to make them more "tab-like".
@@ -114,29 +124,33 @@ Please visit the [Support Forum](http://wordpress.org/tags/post-snippets?forum_i
114
  * Added get_post_snippet() function to retrieve snippets directly from PHP.
115
 
116
  = Version 1.5.4 - 26 Jan 2011 =
117
- * Included Turkish translation by [Ersan Özdil](http://www.tml.web.tr/).
118
 
119
  = Version 1.5.3 - 19 Sep 2010 =
120
- * Included Spanish translation by [Melvis E. Leon Lopez](http://www.soludata.net/site/).
121
 
122
  = Version 1.5.2 - 17 Sep 2010 =
123
- * The plugin now keeps linefeed formatting when inserting a snippet directly with a quicktag in the HTML editor.
124
- * Updated the code to not generate warnings when running WordPress in debug mode.
 
 
125
 
126
  = Version 1.5.1 - 12 Mar 2010 =
127
  * Fixed ampersands when used in a shortcode, so they are XHTML valid.
128
 
129
  = Version 1.5 - 12 Jan 2010 =
130
- * Updated the plugin so it works with WordPress 2.9.x (the quicktags didn't work in 2.9, now fixed.).
 
131
 
132
  = Version 1.4.9.1 - 5 Sep 2009 =
133
- * Included French translation by [Thomas Cailhe (Oyabi)](http://www.oyabi.fr/).
134
 
135
  = Version 1.4.9 - 10 Aug 2009 =
136
- * Included Russian translation by [FatCow](http://www.fatcow.com/).
137
 
138
  = Version 1.4.8 - 9 May 2009 =
139
- * Changed the handling of the TinyMCE button as some server configurations had problems finding the correct path.
 
140
  * Fixed a problem that didn't let a snippet contain a </script> tag.
141
 
142
  = Version 1.4.7 - 27 Apr 2009 =
3
  Donate link: http://wpstorm.net/wordpress-plugins/post-snippets/#donation
4
  Tags: post, admin, snippet, html, custom, page, dynamic, editor, quicktag
5
  Requires at least: 3.0
6
+ Tested up to: 3.3
7
+ Stable tag: 1.8.6
8
 
9
  Store snippets of HTML code or reoccurring text that you often use in your posts. Custom variables can be used.
10
 
66
 
67
  == Changelog ==
68
 
69
+ = Version 1.8.6 - 15 Dec 2011 =
70
+ * The Post Snippets HTML editor button is updated to be compatible with
71
+ WordPress 3.3 refactored QuickTags.
72
+
73
  = Version 1.8.5 - 22 Nov 2011 =
74
+ * Included German translation by Brian Flores.
75
+ * For all translators: Updated the .pot file to include all the latest strings
76
+ and changes.
77
 
78
  = Version 1.8.4 - 10 Nov 2011 =
79
+ * Included Belarusian translation by Alexander Ovsov.
80
 
81
  = Version 1.8.3 - 13 Oct 2011 =
82
+ * Included Hebrew translation by Sagive.
83
 
84
  = Version 1.8.2 - 3 Sep 2011 =
85
+ * Added support for using enclosed shortcodes with the snippets. Use the
86
+ variable {content} in your snippets to retrieve the enclosed content.
87
  * Updated the dropdown help text.
88
+ * Included Lithuanian translation by Nata Strazda.
89
 
90
  = Version 1.8.1 - 11 Jul 2011 =
91
+ * Fixed that a PHP warning is thrown when other scripts called the
92
+ get_post_snippet() function without supplying a second argument.
93
 
94
  = Version 1.8 - 30 May 2011 =
95
  * Fixed an escaping problem with the snippet description.
97
  * Snippets used as shortcodes can now nest other shortcodes in them.
98
 
99
  = Version 1.7.3 - 3 Mar 2011 =
100
+ * Added a text area field in the settings panel to enter an optional
101
+ description for each snippet. This decription is displayed for the editor
102
+ writing a post in the jQuery Post Snippet dialog.
103
+ * Fixed the styling of the quicktag jQuery window when the user have disabled
104
+ the visual editor completely.
105
  * Fixed problem with line formatting in the new quicktag snippets.
106
  * Fixed a problem with JavaScript snippets breaking the admin page.
107
  * Various small bugfixes.
108
 
109
  = Version 1.7.2 - 28 Feb 2011 =
110
  * Specified text/javascript for the UI dialog script.
111
+ * Updated the Spanish translation by Melvis E. Leon Lopez.
112
 
113
  = Version 1.7.1 - 26 Feb 2011 =
114
  * Added styling to the Tabs in the Quicktag jQuery dialog window to make them more "tab-like".
124
  * Added get_post_snippet() function to retrieve snippets directly from PHP.
125
 
126
  = Version 1.5.4 - 26 Jan 2011 =
127
+ * Included Turkish translation by Ersan Özdil.
128
 
129
  = Version 1.5.3 - 19 Sep 2010 =
130
+ * Included Spanish translation by Melvis E. Leon Lopez.
131
 
132
  = Version 1.5.2 - 17 Sep 2010 =
133
+ * The plugin now keeps linefeed formatting when inserting a snippet directly
134
+ with a quicktag in the HTML editor.
135
+ * Updated the code to not generate warnings when running WordPress in debug
136
+ mode.
137
 
138
  = Version 1.5.1 - 12 Mar 2010 =
139
  * Fixed ampersands when used in a shortcode, so they are XHTML valid.
140
 
141
  = Version 1.5 - 12 Jan 2010 =
142
+ * Updated the plugin so it works with WordPress 2.9.x (the quicktags didn't
143
+ work in 2.9, now fixed.).
144
 
145
  = Version 1.4.9.1 - 5 Sep 2009 =
146
+ * Included French translation by Thomas Cailhe (Oyabi).
147
 
148
  = Version 1.4.9 - 10 Aug 2009 =
149
+ * Included Russian translation by FatCow.
150
 
151
  = Version 1.4.8 - 9 May 2009 =
152
+ * Changed the handling of the TinyMCE button as some server configurations had
153
+ problems finding the correct path.
154
  * Fixed a problem that didn't let a snippet contain a </script> tag.
155
 
156
  = Version 1.4.7 - 27 Apr 2009 =