Post Snippets - Version 1.3

Version Description

Download this release

Release Info

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

Code changes from version 1.2 to 1.3

languages/post-snippets-sv_SE.mo CHANGED
Binary file
languages/post-snippets-sv_SE.po CHANGED
@@ -7,61 +7,77 @@ msgstr ""
7
  "Project-Id-Version: Post Snippets\n"
8
  "Report-Msgid-Bugs-To: http://wordpress.org/tag/post-snippets\n"
9
  "POT-Creation-Date: 2009-03-24 09:38+0000\n"
10
- "PO-Revision-Date: 2009-04-01 13:03+0100\n"
11
  "Last-Translator: Johan Steen <artstorm@gmail.com>\n"
12
  "Language-Team: <artstorm@gmail.com>\n"
13
  "MIME-Version: 1.0\n"
14
- "Content-Type: text/plain; charset=utf-8\n"
15
  "Content-Transfer-Encoding: 8bit\n"
16
  "X-Poedit-Language: Swedish\n"
17
  "X-Poedit-Country: SWEDEN\n"
18
 
19
- #: post-snippets.php:75
 
 
 
 
20
  msgid "A snippet named Untitled has been added."
21
  msgstr "Ett nytt avsnitt med namnet Untitled har lagts till."
22
 
23
- #: post-snippets.php:88
24
  msgid "Snippets have been updated."
25
  msgstr "Avsnitten har uppdaterats."
26
 
27
- #: post-snippets.php:104
28
  msgid "Selected snippets have been deleted."
29
  msgstr "Valda avsnitt har raderats."
30
 
31
- #: post-snippets.php:116
32
  msgid "Add New Snippet"
33
  msgstr "Lägg Till Nytt Avsnitt"
34
 
35
- #: post-snippets.php:117
36
  msgid "Delete Selected"
37
  msgstr "Radera Valda"
38
 
39
- #: post-snippets.php:126
40
- #: post-snippets.php:135
41
  msgid "Title"
42
  msgstr "Titel"
43
 
44
- #: post-snippets.php:127
45
- #: post-snippets.php:136
46
  msgid "Variables"
47
  msgstr "Variabler"
48
 
49
- #: post-snippets.php:128
50
- #: post-snippets.php:137
51
  msgid "Snippet"
52
  msgstr "Avsnitt"
53
 
54
- #: post-snippets.php:159
55
  msgid "Update Snippets"
56
  msgstr "Uppdatera Avsnitt"
57
 
58
- #: post-snippets.php:161
59
  msgid "Help"
60
  msgstr "Hjälp"
61
 
62
- #: post-snippets.php:162
63
- msgid "<strong>Title</strong><br/>Give the snippet a title that helps you identify it in the post editor.<br/><br/><strong>Variables</strong><br/>A comma separated list of custom variables you can reference in your snippet.<br/><br/>Example:<br/>url,name<br/><br/><strong>Snippet</strong><br/>This is the block of text or HTML to insert in the post when you select the snippet from the insert button in the TinyMCE panel in the post editor. If you have entered predefined variables you can reference them from the snippet by enclosing them in {} brackets.<br/><br/>Example:<br/>To reference the variables in the example above, you would enter {url} and {name}.<br/><br/>So if you enter this snippet:<br/><i>This is the website of &lt;a href=\"{url}\"&gt;{name}&lt;/a&gt;</i><br/>You will get the option to replace url and name on insert if they are defined as variables."
64
- msgstr "<strong>Titel</strong><br/>Ge avsnittet en titel som hjälper dig att identifiera det i inläggsredigeraren.<br/><br/><strong>Variabler</strong><br/>En kommaseparerad lista av egendefinerade variabler som du kan referera i ditt avsnitt.<br/><br/>Exempel:<br/>url,namn<br/><br/><strong>Avsnitt</strong><br/>Detta är blocket med text eller HTML att lägga till inlägget när du väljer ett avsnitt med insättnings knappen i TinyMCE panelen i inläggsredigeraren. Om du har definerat egna variabler kan du referera dem i avnittet genom att omsluta dem med {}.<br/><br/>Exempel:<br/>För att referera variabler i exemplet ovan, skulle du skriva {url} and {namn}.<br/><br/>Så om du har det här avsnittet:<br/><i>Det är websidan till &lt;a href=\"{url}\"&gt;{namn}&lt;/a&gt;</i><br/>När du infogar avsnittet i ditt inlägg kan du fylla i vad som ska ersätta url och namn."
 
 
 
 
 
 
 
 
 
 
 
 
65
 
66
  #: tinymce/window.php:9
67
  msgid "You are not allowed to be here"
@@ -84,8 +100,8 @@ msgid "http://coding.cglounge.com/wordpress-plugins/post-snippets/"
84
  msgstr "http://coding.cglounge.com/wordpress-plugins/post-snippets/"
85
 
86
  #. Description of an extension
87
- msgid "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."
88
- msgstr "Lagrar avsnitt (snippets) av HTML kod eller återkommande text som du ofta använder i dina inlägg. Du kan använda fördefinerade variabler för att ersätta delar av ditt avsnitt vid infogning. All avsnitt är tillgängliga i inläggsredigeraren via en TinyMCE knapp."
89
 
90
  #. Author of an extension
91
  msgid "Johan Steen"
7
  "Project-Id-Version: Post Snippets\n"
8
  "Report-Msgid-Bugs-To: http://wordpress.org/tag/post-snippets\n"
9
  "POT-Creation-Date: 2009-03-24 09:38+0000\n"
10
+ "PO-Revision-Date: 2009-04-02 20:41+0100\n"
11
  "Last-Translator: Johan Steen <artstorm@gmail.com>\n"
12
  "Language-Team: <artstorm@gmail.com>\n"
13
  "MIME-Version: 1.0\n"
14
+ "Content-Type: text/plain; charset=UTF-8\n"
15
  "Content-Transfer-Encoding: 8bit\n"
16
  "X-Poedit-Language: Swedish\n"
17
  "X-Poedit-Country: SWEDEN\n"
18
 
19
+ #: post-snippets.php:70
20
+ msgid "Post Snippets requires WordPress version 2.7 or later!"
21
+ msgstr "Post Snippets kräver WordPress version 2.7 eller nyare!"
22
+
23
+ #: post-snippets.php:179
24
  msgid "A snippet named Untitled has been added."
25
  msgstr "Ett nytt avsnitt med namnet Untitled har lagts till."
26
 
27
+ #: post-snippets.php:192
28
  msgid "Snippets have been updated."
29
  msgstr "Avsnitten har uppdaterats."
30
 
31
+ #: post-snippets.php:208
32
  msgid "Selected snippets have been deleted."
33
  msgstr "Valda avsnitt har raderats."
34
 
35
+ #: post-snippets.php:220
36
  msgid "Add New Snippet"
37
  msgstr "Lägg Till Nytt Avsnitt"
38
 
39
+ #: post-snippets.php:221
40
  msgid "Delete Selected"
41
  msgstr "Radera Valda"
42
 
43
+ #: post-snippets.php:230
44
+ #: post-snippets.php:239
45
  msgid "Title"
46
  msgstr "Titel"
47
 
48
+ #: post-snippets.php:231
49
+ #: post-snippets.php:240
50
  msgid "Variables"
51
  msgstr "Variabler"
52
 
53
+ #: post-snippets.php:232
54
+ #: post-snippets.php:241
55
  msgid "Snippet"
56
  msgstr "Avsnitt"
57
 
58
+ #: post-snippets.php:263
59
  msgid "Update Snippets"
60
  msgstr "Uppdatera Avsnitt"
61
 
62
+ #: post-snippets.php:268
63
  msgid "Help"
64
  msgstr "Hjälp"
65
 
66
+ #: post-snippets.php:270
67
+ msgid "<strong>Title</strong><br/>Give the snippet a title that helps you identify it in the post editor."
68
+ msgstr "<strong>Titel</strong><br/>Ge avsnittet en titel som hjälper dig att identifiera det i inläggsredigeraren."
69
+
70
+ #: post-snippets.php:272
71
+ msgid "<strong>Variables</strong><br/>A comma separated list of custom variables you can reference in your snippet.<br/><br/>Example:<br/>url,name"
72
+ msgstr "<strong>Variabler</strong><br/>En kommaseparerad lista av egendefinerade variabler som du kan referera i ditt avsnitt.<br/><br/>Exempel:<br/>url,namn"
73
+
74
+ #: post-snippets.php:274
75
+ msgid "<strong>Snippet</strong><br/>This is the block of text or HTML to insert in the post when you select the snippet from the insert button in the TinyMCE panel in the post editor. If you have entered predefined variables you can reference them from the snippet by enclosing them in {} brackets.<br/><br/>Example:<br/>To reference the variables in the example above, you would enter {url} and {name}.<br/><br/>So if you enter this snippet:<br/><i>This is the website of &lt;a href=\"{url}\"&gt;{name}&lt;/a&gt;</i><br/>You will get the option to replace url and name on insert if they are defined as variables."
76
+ msgstr "<strong>Avsnitt</strong><br/>Detta är blocket med text eller HTML att lägga till inlägget när du väljer ett avsnitt med insättnings knappen i TinyMCE panelen i inläggsredigeraren. Om du har definerat egna variabler kan du referera dem i avnittet genom att omsluta dem med {}.<br/><br/>Exempel:<br/>För att referera variabler i exemplet ovan, skulle du skriva {url} and {namn}.<br/><br/>Så om du har det här avsnittet:<br/><i>Det är websidan till &lt;a href=\"{url}\"&gt;{namn}&lt;/a&gt;</i><br/>När du infogar avsnittet i ditt inlägg kan du fylla i vad som ska ersätta url och namn."
77
+
78
+ #: post-snippets.php:281
79
+ msgid "About Post Snippets"
80
+ msgstr "Om Post Snippets"
81
 
82
  #: tinymce/window.php:9
83
  msgid "You are not allowed to be here"
100
  msgstr "http://coding.cglounge.com/wordpress-plugins/post-snippets/"
101
 
102
  #. Description of an extension
103
+ msgid "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, Quicktags or Shortcodes."
104
+ msgstr "Lagrar avsnitt (snippets) av HTML kod eller återkommande text som du ofta använder i dina inlägg. Du kan använda fördefinerade variabler för att ersätta delar av ditt avsnitt vid infogning. All avsnitt är tillgängliga i inläggsredigeraren via en TinyMCE knapp, Quicktags eller Shortcodes."
105
 
106
  #. Author of an extension
107
  msgid "Johan Steen"
languages/post-snippets.pot CHANGED
@@ -15,60 +15,77 @@ msgstr ""
15
  "Content-Type: text/plain; charset=CHARSET\n"
16
  "Content-Transfer-Encoding: 8bit\n"
17
 
18
- #: post-snippets.php:75
 
 
 
 
19
  msgid "A snippet named Untitled has been added."
20
  msgstr ""
21
 
22
- #: post-snippets.php:88
23
  msgid "Snippets have been updated."
24
  msgstr ""
25
 
26
- #: post-snippets.php:104
27
  msgid "Selected snippets have been deleted."
28
  msgstr ""
29
 
30
- #: post-snippets.php:116
31
  msgid "Add New Snippet"
32
  msgstr ""
33
 
34
- #: post-snippets.php:117
35
  msgid "Delete Selected"
36
  msgstr ""
37
 
38
- #: post-snippets.php:126 post-snippets.php:135
39
  msgid "Title"
40
  msgstr ""
41
 
42
- #: post-snippets.php:127 post-snippets.php:136
43
  msgid "Variables"
44
  msgstr ""
45
 
46
- #: post-snippets.php:128 post-snippets.php:137
47
  msgid "Snippet"
48
  msgstr ""
49
 
50
- #: post-snippets.php:159
51
  msgid "Update Snippets"
52
  msgstr ""
53
 
54
- #: post-snippets.php:161
55
  msgid "Help"
56
  msgstr ""
57
 
58
- #: post-snippets.php:162
59
  msgid ""
60
  "<strong>Title</strong><br/>Give the snippet a title that helps you identify "
61
- "it in the post editor.<br/><br/><strong>Variables</strong><br/>A comma "
62
- "separated list of custom variables you can reference in your snippet.<br/"
63
- "><br/>Example:<br/>url,name<br/><br/><strong>Snippet</strong><br/>This is "
64
- "the block of text or HTML to insert in the post when you select the snippet "
65
- "from the insert button in the TinyMCE panel in the post editor. If you have "
66
- "entered predefined variables you can reference them from the snippet by "
67
- "enclosing them in {} brackets.<br/><br/>Example:<br/>To reference the "
68
- "variables in the example above, you would enter {url} and {name}.<br/><br/"
69
- ">So if you enter this snippet:<br/><i>This is the website of &lt;a href="
70
- "\"{url}\"&gt;{name}&lt;/a&gt;</i><br/>You will get the option to replace url "
71
- "and name on insert if they are defined as variables."
 
 
 
 
 
 
 
 
 
 
 
 
 
72
  msgstr ""
73
 
74
  #: tinymce/window.php:9
@@ -95,7 +112,8 @@ msgstr ""
95
  msgid ""
96
  "Stores snippets of HTML code or reoccurring text that you often use in your "
97
  "posts. You can use predefined variables to replace parts of the snippet on "
98
- "insert. All snippets are available in the post editor with a TinyMCE button."
 
99
  msgstr ""
100
 
101
  #. Author of an extension
15
  "Content-Type: text/plain; charset=CHARSET\n"
16
  "Content-Transfer-Encoding: 8bit\n"
17
 
18
+ #: post-snippets.php:70
19
+ msgid "Post Snippets requires WordPress version 2.7 or later!"
20
+ msgstr ""
21
+
22
+ #: post-snippets.php:179
23
  msgid "A snippet named Untitled has been added."
24
  msgstr ""
25
 
26
+ #: post-snippets.php:192
27
  msgid "Snippets have been updated."
28
  msgstr ""
29
 
30
+ #: post-snippets.php:208
31
  msgid "Selected snippets have been deleted."
32
  msgstr ""
33
 
34
+ #: post-snippets.php:220
35
  msgid "Add New Snippet"
36
  msgstr ""
37
 
38
+ #: post-snippets.php:221
39
  msgid "Delete Selected"
40
  msgstr ""
41
 
42
+ #: post-snippets.php:230 post-snippets.php:239
43
  msgid "Title"
44
  msgstr ""
45
 
46
+ #: post-snippets.php:231 post-snippets.php:240
47
  msgid "Variables"
48
  msgstr ""
49
 
50
+ #: post-snippets.php:232 post-snippets.php:241
51
  msgid "Snippet"
52
  msgstr ""
53
 
54
+ #: post-snippets.php:263
55
  msgid "Update Snippets"
56
  msgstr ""
57
 
58
+ #: post-snippets.php:268
59
  msgid "Help"
60
  msgstr ""
61
 
62
+ #: post-snippets.php:270
63
  msgid ""
64
  "<strong>Title</strong><br/>Give the snippet a title that helps you identify "
65
+ "it in the post editor."
66
+ msgstr ""
67
+
68
+ #: post-snippets.php:272
69
+ msgid ""
70
+ "<strong>Variables</strong><br/>A comma separated list of custom variables "
71
+ "you can reference in your snippet.<br/><br/>Example:<br/>url,name"
72
+ msgstr ""
73
+
74
+ #: post-snippets.php:274
75
+ msgid ""
76
+ "<strong>Snippet</strong><br/>This is the block of text or HTML to insert in "
77
+ "the post when you select the snippet from the insert button in the TinyMCE "
78
+ "panel in the post editor. If you have entered predefined variables you can "
79
+ "reference them from the snippet by enclosing them in {} brackets.<br/><br/"
80
+ ">Example:<br/>To reference the variables in the example above, you would "
81
+ "enter {url} and {name}.<br/><br/>So if you enter this snippet:<br/><i>This "
82
+ "is the website of &lt;a href=\"{url}\"&gt;{name}&lt;/a&gt;</i><br/>You will "
83
+ "get the option to replace url and name on insert if they are defined as "
84
+ "variables."
85
+ msgstr ""
86
+
87
+ #: post-snippets.php:281
88
+ msgid "About Post Snippets"
89
  msgstr ""
90
 
91
  #: tinymce/window.php:9
112
  msgid ""
113
  "Stores snippets of HTML code or reoccurring text that you often use in your "
114
  "posts. You can use predefined variables to replace parts of the snippet on "
115
+ "insert. All snippets are available in the post editor with a TinyMCE button, "
116
+ "Quicktags or Shortcodes."
117
  msgstr ""
118
 
119
  #. Author of an extension
post-snippets.php CHANGED
@@ -2,8 +2,8 @@
2
  /*
3
  Plugin Name: Post Snippets
4
  Plugin URI: http://coding.cglounge.com/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.
6
- Version: 1.2
7
  Author: Johan Steen
8
  Author URI: http://coding.cglounge.com/
9
  Text Domain: post-snippets
@@ -28,22 +28,47 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
28
  class postSnippets {
29
  var $plugin_options = "post_snippets_options";
30
 
 
 
 
 
31
  function postSnippets()
32
  {
33
  // define URL
34
  define('postSnippets_ABSPATH', WP_PLUGIN_DIR.'/'.plugin_basename( dirname(__FILE__) ).'/' );
35
  define('postSnippets_URLPATH', WP_PLUGIN_URL.'/'.plugin_basename( dirname(__FILE__) ).'/' );
36
-
37
- include_once (dirname (__FILE__)."/tinymce/tinymce.php");
38
 
39
- $this->init_hooks();
 
 
 
 
 
 
 
 
 
 
40
  }
41
 
 
 
 
 
 
42
  function init_hooks() {
43
- load_plugin_textdomain( 'post-snippets', false, dirname(plugin_basename(__FILE__)) . '/languages/');
44
  add_action('admin_menu', array(&$this,'wp_admin'));
45
  add_action('admin_footer', array(&$this,'quicktags'));
46
  }
 
 
 
 
 
 
 
 
 
47
 
48
  /**
49
  * Handling of QuickTags in the HTML editor
@@ -237,14 +262,36 @@ class postSnippets {
237
  <div class="submit">
238
  <input type="submit" name="update-post-snippets" value="<?php _e( 'Update Snippets', 'post-snippets' ) ?>" class="button-primary" /></div>
239
  </form>
240
- <h3><?php _e( 'Help', 'post-snippets' ); ?></h3>
241
- <p><?php _e( '<strong>Title</strong><br/>Give the snippet a title that helps you identify it in the post editor.<br/><br/><strong>Variables</strong><br/>A comma separated list of custom variables you can reference in your snippet.<br/><br/>Example:<br/>url,name<br/><br/><strong>Snippet</strong><br/>This is the block of text or HTML to insert in the post when you select the snippet from the insert button in the TinyMCE panel in the post editor. If you have entered predefined variables you can reference them from the snippet by enclosing them in {} brackets.<br/><br/>Example:<br/>To reference the variables in the example above, you would enter {url} and {name}.<br/><br/>So if you enter this snippet:<br/><i>This is the website of &lt;a href="{url}"&gt;{name}&lt;/a&gt;</i><br/>You will get the option to replace url and name on insert if they are defined as variables.', 'post-snippets' ); ?></p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
242
  </div>
243
  <?php
244
  }
245
  }
246
 
247
-
248
  add_action( 'plugins_loaded', create_function( '', 'global $postSnippets; $postSnippets = new postSnippets();' ) );
249
-
250
  ?>
2
  /*
3
  Plugin Name: Post Snippets
4
  Plugin URI: http://coding.cglounge.com/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.3
7
  Author: Johan Steen
8
  Author URI: http://coding.cglounge.com/
9
  Text Domain: post-snippets
28
  class postSnippets {
29
  var $plugin_options = "post_snippets_options";
30
 
31
+ /**
32
+ * Constructor
33
+ *
34
+ */
35
  function postSnippets()
36
  {
37
  // define URL
38
  define('postSnippets_ABSPATH', WP_PLUGIN_DIR.'/'.plugin_basename( dirname(__FILE__) ).'/' );
39
  define('postSnippets_URLPATH', WP_PLUGIN_URL.'/'.plugin_basename( dirname(__FILE__) ).'/' );
 
 
40
 
41
+ // Define the domain for translations
42
+ load_plugin_textdomain( 'post-snippets', false, dirname(plugin_basename(__FILE__)) . '/languages/');
43
+
44
+ // Check installed Wordpress version.
45
+ global $wp_version;
46
+ if ( version_compare($wp_version, '2.7', '>=') ) {
47
+ include_once (dirname (__FILE__)."/tinymce/tinymce.php");
48
+ $this->init_hooks();
49
+ } else {
50
+ $this->version_warning();
51
+ }
52
  }
53
 
54
+ /**
55
+ * Initializes the hooks for the plugin
56
+ *
57
+ * @returns Nothing
58
+ */
59
  function init_hooks() {
 
60
  add_action('admin_menu', array(&$this,'wp_admin'));
61
  add_action('admin_footer', array(&$this,'quicktags'));
62
  }
63
+
64
+ /**
65
+ * Displays a warning when installed in an old Wordpress Version
66
+ *
67
+ * @returns Nothing
68
+ */
69
+ function version_warning() {
70
+ echo '<div class="updated fade"><p><strong>'.__('Post Snippets requires WordPress version 2.7 or later!', 'post-snippets').'</strong></p></div>';
71
+ }
72
 
73
  /**
74
  * Handling of QuickTags in the HTML editor
262
  <div class="submit">
263
  <input type="submit" name="update-post-snippets" value="<?php _e( 'Update Snippets', 'post-snippets' ) ?>" class="button-primary" /></div>
264
  </form>
265
+
266
+ <div id="poststuff" class="ui-sortable">
267
+ <div class="postbox closed">
268
+ <h3><?php _e( 'Help', 'post-snippets' ); ?></h3>
269
+ <div class="inside">
270
+ <p><?php _e( '<strong>Title</strong><br/>Give the snippet a title that helps you identify it in the post editor.', 'post-snippets' ); ?></p>
271
+
272
+ <p><?php _e( '<strong>Variables</strong><br/>A comma separated list of custom variables you can reference in your snippet.<br/><br/>Example:<br/>url,name', 'post-snippets' ); ?></p>
273
+
274
+ <p><?php _e( '<strong>Snippet</strong><br/>This is the block of text or HTML to insert in the post when you select the snippet from the insert button in the TinyMCE panel in the post editor. If you have entered predefined variables you can reference them from the snippet by enclosing them in {} brackets.<br/><br/>Example:<br/>To reference the variables in the example above, you would enter {url} and {name}.<br/><br/>So if you enter this snippet:<br/><i>This is the website of &lt;a href="{url}"&gt;{name}&lt;/a&gt;</i><br/>You will get the option to replace url and name on insert if they are defined as variables.', 'post-snippets' ); ?></p>
275
+ </div>
276
+ </div>
277
+ </div>
278
+
279
+ <script type="text/javascript">
280
+ <!--
281
+ <?php global $wp_version; ?>
282
+ <?php if ( version_compare( $wp_version, '2.6.999', '<' ) ) { ?>
283
+ jQuery('.postbox h3').prepend('<a class="togbox">+</a> ');
284
+ <?php } ?>
285
+ jQuery('.postbox h3').click( function() { jQuery(jQuery(this).parent().get(0)).toggleClass('closed'); } );
286
+ jQuery('.postbox.close-me').each(function(){
287
+ jQuery(this).addClass("closed");
288
+ });
289
+ //-->
290
+ </script>
291
  </div>
292
  <?php
293
  }
294
  }
295
 
 
296
  add_action( 'plugins_loaded', create_function( '', 'global $postSnippets; $postSnippets = new postSnippets();' ) );
 
297
  ?>
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === Post Snippets ===
2
  Contributors: artstorm
3
  Donate link: http://coding.cglounge.com/wordpress-plugins/post-snippets/
4
- Tags: post, admin, snippet, snippets, html, custom, page, dynamic, editor, quicktag
5
  Requires at least: 2.7
6
  Tested up to: 2.7.1
7
- Stable tag: 1.2
8
 
9
  Store snippets of HTML code or reoccurring text that you often use in your posts. Custom variables can be used.
10
 
@@ -14,6 +14,8 @@ This admin plugin stores snippets of HTML code or reoccurring text that you ofte
14
 
15
  For complete usage instructions see: [Post Snippets](http://coding.cglounge.com/wordpress-plugins/post-snippets/ "Complete Usage Instructions for Post Snippets")
16
 
 
 
17
  Some features:
18
 
19
  * **Insert** All defined snippets is inserted from a button directly in the post editor.
@@ -44,12 +46,17 @@ Meditation.
44
 
45
  == Changelog ==
46
 
47
- = 1.2 =
 
 
 
 
 
48
  * Added support for Quicktags so the snippets can be made available in the HTML editor as well.
49
 
50
- = 1.1 =
51
  * Included Swedish translation.
52
  * Added TextDomain functionality for I18n.
53
 
54
- = 1.0 =
55
  * Initial Release
1
  === Post Snippets ===
2
  Contributors: artstorm
3
  Donate link: http://coding.cglounge.com/wordpress-plugins/post-snippets/
4
+ Tags: post, admin, snippet, html, custom, page, dynamic, editor, quicktag
5
  Requires at least: 2.7
6
  Tested up to: 2.7.1
7
+ Stable tag: 1.3
8
 
9
  Store snippets of HTML code or reoccurring text that you often use in your posts. Custom variables can be used.
10
 
14
 
15
  For complete usage instructions see: [Post Snippets](http://coding.cglounge.com/wordpress-plugins/post-snippets/ "Complete Usage Instructions for Post Snippets")
16
 
17
+ See the [Changelog](http://wordpress.org/extend/plugins/post-snippets/other_notes/) for what's new.
18
+
19
  Some features:
20
 
21
  * **Insert** All defined snippets is inserted from a button directly in the post editor.
46
 
47
  == Changelog ==
48
 
49
+ = Version 1.3 - 2 Apr 2009 =
50
+ * Fixed a problem with the regular expressions that prohibited variables consisting of just a single number to work.
51
+ * Updated the Help info in the admin page to take less space.
52
+ * Included a check so the plugin only runs in WP 2.7 or newer.
53
+
54
+ = Version 1.2 - 1 Apr 2009 =
55
  * Added support for Quicktags so the snippets can be made available in the HTML editor as well.
56
 
57
+ = Version 1.1 - 24 Mar 2009 =
58
  * Included Swedish translation.
59
  * Added TextDomain functionality for I18n.
60
 
61
+ = Version 1.0 - 23 Mar 2009 =
62
  * Initial Release
tinymce/tinymce.php CHANGED
@@ -1,14 +1,14 @@
1
  <?php
2
-
3
  /**
4
- * @title TinyMCE V3 Button Integration (for Wp2.5)
5
- * @author Alex Rabe
6
- */
7
-
8
  class add_postSnippets_button {
9
-
10
  var $pluginname = "postSnippets";
11
 
 
 
 
12
  function add_postSnippets_button() {
13
  // Modify the version when tinyMCE plugins are changed.
14
  add_filter('tiny_mce_version', array (&$this, 'change_tinymce_version') );
@@ -18,14 +18,12 @@ class add_postSnippets_button {
18
  }
19
 
20
  function addbuttons() {
21
-
22
  // Don't bother doing this stuff if the current user lacks permissions
23
  if ( !current_user_can('edit_posts') && !current_user_can('edit_pages') ) return;
24
 
25
  // Add only in Rich Editor mode
26
  if ( get_user_option('rich_editing') == 'true') {
27
-
28
- // add the button for wp2.5 in a new way
29
  add_filter("mce_external_plugins", array (&$this, "add_tinymce_plugin" ), 5);
30
  add_filter('mce_buttons', array (&$this, 'register_button' ), 5);
31
  }
@@ -33,27 +31,20 @@ class add_postSnippets_button {
33
 
34
  // used to insert button in wordpress 2.5x editor
35
  function register_button($buttons) {
36
-
37
  array_push($buttons, "separator", $this->pluginname );
38
-
39
  return $buttons;
40
  }
41
 
42
  // Load the TinyMCE plugin : editor_plugin.js (wp2.5)
43
  function add_tinymce_plugin($plugin_array) {
44
-
45
  $plugin_array[$this->pluginname] = postSnippets_URLPATH.'tinymce/editor_plugin.js';
46
-
47
  return $plugin_array;
48
  }
49
 
50
  function change_tinymce_version($version) {
51
  return ++$version;
52
  }
53
-
54
  }
55
 
56
- // Call it now
57
  $tinymce_button = new add_postSnippets_button();
58
-
59
  ?>
1
  <?php
 
2
  /**
3
+ * Class that adds a TinyMCE button to the Post editor
4
+ *
5
+ */
 
6
  class add_postSnippets_button {
 
7
  var $pluginname = "postSnippets";
8
 
9
+ /**
10
+ * Constructor
11
+ */
12
  function add_postSnippets_button() {
13
  // Modify the version when tinyMCE plugins are changed.
14
  add_filter('tiny_mce_version', array (&$this, 'change_tinymce_version') );
18
  }
19
 
20
  function addbuttons() {
 
21
  // Don't bother doing this stuff if the current user lacks permissions
22
  if ( !current_user_can('edit_posts') && !current_user_can('edit_pages') ) return;
23
 
24
  // Add only in Rich Editor mode
25
  if ( get_user_option('rich_editing') == 'true') {
26
+ // add the button for wp2.5 in a new way
 
27
  add_filter("mce_external_plugins", array (&$this, "add_tinymce_plugin" ), 5);
28
  add_filter('mce_buttons', array (&$this, 'register_button' ), 5);
29
  }
31
 
32
  // used to insert button in wordpress 2.5x editor
33
  function register_button($buttons) {
 
34
  array_push($buttons, "separator", $this->pluginname );
 
35
  return $buttons;
36
  }
37
 
38
  // Load the TinyMCE plugin : editor_plugin.js (wp2.5)
39
  function add_tinymce_plugin($plugin_array) {
 
40
  $plugin_array[$this->pluginname] = postSnippets_URLPATH.'tinymce/editor_plugin.js';
 
41
  return $plugin_array;
42
  }
43
 
44
  function change_tinymce_version($version) {
45
  return ++$version;
46
  }
 
47
  }
48
 
 
49
  $tinymce_button = new add_postSnippets_button();
 
50
  ?>
tinymce/window.php CHANGED
@@ -48,7 +48,7 @@ if ( !is_user_logged_in() || !current_user_can('edit_posts') )
48
  if (!empty($var_arr[0])) {
49
  for ($j = 0; $j < count($var_arr); $j++) { ?>
50
  var var_<?= $i ?>_<?= $j ?> = document.getElementById('var_<?= $i ?>_<?= $j ?>').value;
51
- insertString = insertString.replace(/{<?= $var_arr[$j] ?>}/g, var_<?= $i ?>_<?= $j ?>);
52
  <?php } } ?>
53
  }
54
  <?php } ?>
48
  if (!empty($var_arr[0])) {
49
  for ($j = 0; $j < count($var_arr); $j++) { ?>
50
  var var_<?= $i ?>_<?= $j ?> = document.getElementById('var_<?= $i ?>_<?= $j ?>').value;
51
+ insertString = insertString.replace(/\{<?= $var_arr[$j] ?>\}/g, var_<?= $i ?>_<?= $j ?>);
52
  <?php } } ?>
53
  }
54
  <?php } ?>