Post Snippets - Version 1.8.9

Version Description

Download this release

Release Info

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

Code changes from version 1.8.8 to 1.8.9

classes/help.php ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Post Snippets Help.
4
+ *
5
+ * Class to handle the help texts and tabs on the settings screen.
6
+ *
7
+ * @package Post Snippets
8
+ * @author Johan Steen <artstorm at gmail dot com>
9
+ * @since Post Snippets 1.8.9
10
+ */
11
+ class Post_Snippets_Help
12
+ {
13
+ /**
14
+ * Constructor.
15
+ * @since Post Snippets 1.8.9
16
+ * @param string The option page to load the help text on
17
+ */
18
+ public function __construct( $option_page )
19
+ {
20
+ // If WordPress is 3.3 or higher, use the new Help API, otherwise call
21
+ // the old pre 3.3 help function.
22
+ global $wp_version;
23
+ if ( version_compare($wp_version, '3.3', '>=') ) {
24
+ add_action( 'load-' . $option_page, array(&$this,'add_help_tabs') );
25
+ } else {
26
+ add_action( 'contextual_help', array(&$this,'add_help'), 10, 3 );
27
+ }
28
+ }
29
+
30
+ /**
31
+ * Setup the help tabs and sidebar.
32
+ * @since Post Snippets 1.8.9
33
+ */
34
+ public function add_help_tabs() {
35
+ $screen = get_current_screen();
36
+ $screen->set_help_sidebar( $this->help_sidebar() );
37
+ $screen->add_help_tab( array(
38
+ 'id' => 'additional-plugin-help', // This should be unique for the screen.
39
+ 'title' => 'Plugin Usage',
40
+ 'content' => $this->contextual_help_wp_pre33()
41
+ // Use 'callback' instead of 'content' for a function callback that renders the tab content.
42
+ ) );
43
+ }
44
+
45
+ /**
46
+ * The right sidebar help text.
47
+ *
48
+ * @since Post Snippets 1.8.9
49
+ * @return string The help text
50
+ */
51
+ public function help_sidebar()
52
+ {
53
+ $content = '<p><strong>'.__('For more information:').'</strong></p>';
54
+ $content .= '<p><a href="http://wpstorm.net/wordpress-plugins/post-snippets/" target="_blank">'.__('Post Snippets Documentation').'</a></p>';
55
+ $content .= '<p><a href="http://wordpress.org/tags/post-snippets?forum_id=10" target="_blank">'.__('Support Forums').'</a></p>';
56
+ return $content;
57
+ }
58
+
59
+
60
+ // -------------------------------------------------------------------------
61
+ // Deprecated Methods
62
+ // -------------------------------------------------------------------------
63
+
64
+ /**
65
+ * Display contextual help in the help drop down menu at the options page.
66
+ *
67
+ * @deprecated Since WordPress 3.3
68
+ * @since Post Snippets 1.7.1
69
+ * @return string The Contextual Help
70
+ */
71
+ public function add_help($contextual_help, $screen_id, $screen) {
72
+ if ( $screen->id == 'settings_page_post-snippets/post-snippets' ) {
73
+ $contextual_help = $this->contextual_help_wp_pre33();
74
+ }
75
+ return $contextual_help;
76
+ }
77
+
78
+ /**
79
+ * The contextual help text displayed in WordPress older than 3.3.
80
+ *
81
+ * @deprecated Since WordPress 3.3
82
+ * @since Post Snippets 1.8.
83
+ * @return string The Contextual Help
84
+ */
85
+ public function contextual_help_wp_pre33()
86
+ {
87
+ $contextual_help =
88
+ '<p><strong>' . __('Title', 'post-snippets') . '</strong></p>' .
89
+ '<p>' . __('Give the snippet a title that helps you identify it in the post editor. If you make it into a shortcode, this is the name of the shortcode as well.', 'post-snippets') . '</p>' .
90
+
91
+ '<p><strong>' . __('Variables', 'post-snippets') . '</strong></p>' .
92
+ '<p>' . __('A comma separated list of custom variables you can reference in your snippet.<br/><br/>Example:<br/>url,name', 'post-snippets') . '</p>' .
93
+
94
+ '<p><strong>' . __('Snippet', 'post-snippets') . '</strong></p>' .
95
+ '<p>' . __('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>' .
96
+
97
+ '<p><strong>' . __('Description', 'post-snippets') . '</strong></p>' .
98
+ '<p>' . __('An optional description for the Snippet. If entered it will be displayed in the snippets popup window in the post editor.', 'post-snippets') . '</p>' .
99
+
100
+ '<p><strong>' . __('Shortcode', 'post-snippets') . '</strong></p>' .
101
+ '<p>' . __('Treats the snippet as a shortcode. The name for the shortcode is the same as the title of the snippet (spaces not allowed) and will be used on insert. If you enclose the shortcode in your posts, you can access the enclosed content by using the variable {content} in your snippet. The content variable is reserved, so don\'t use it in the variables field.', 'post-snippets') . '</p>' .
102
+
103
+ '<p><strong>' . __('Advanced', 'post-snippets') . '</strong></p>' .
104
+ '<p>' . __('The snippets can be retrieved directly from PHP, in a theme for instance, with the get_post_snippet() function. Visit the Post Snippets link under more information for instructions.', 'post-snippets') . '</p>' .
105
+
106
+ '<p><strong>' . __('For more information:', 'post-snippets') . '</strong></p>' .
107
+ '<p>' . __('Visit my <a href="http://wpstorm.net/wordpress-plugins/post-snippets/">Post Snippets</a> page for additional information.', 'post-snippets') . '</p>';
108
+ return $contextual_help;
109
+ }
110
+ }
classes/settings.php CHANGED
@@ -61,31 +61,32 @@ class Post_Snippets_Settings
61
  // $snippets = get_option($this->plugin_options);
62
  $snippets = $this->plugin_options;
63
  if (!empty($snippets)) {
64
- for ($i=0; $i < count($snippets); $i++) { ?>
 
65
  <tr class='recent'>
66
- <th scope='row' class='check-column'><input type='checkbox' name='checked[]' value='<?php echo $i; ?>' /></th>
67
  <td class='row-title'>
68
- <input type='text' name='<?php echo $i; ?>_title' value='<?php echo $snippets[$i]['title']; ?>' />
69
  </td>
70
  <td class='name'>
71
- <input type='text' name='<?php echo $i; ?>_vars' value='<?php echo $snippets[$i]['vars']; ?>' /><br/>
72
  <?php
73
- $this->checkbox(__('Shortcode', 'post-snippets'), $i.'_shortcode',
74
- $snippets[$i]['shortcode']);
75
  ?>
76
  <!-- <input type='checkbox' name='< ?php echo $i; ? >_php' value='true'< ?php if ($snippets[$i]['php'] == true) { echo " checked"; }? > /> < ?php _e( 'PHP Code', 'post-snippets' ) ? ><br/> -->
77
  </td>
78
  <td class='desc'>
79
- <textarea name="<?php echo $i; ?>_snippet" class="large-text" style='width: 100%;' rows="5"><?php echo htmlspecialchars($snippets[$i]['snippet'], ENT_NOQUOTES); ?></textarea>
80
  <?php _e( 'Description', 'post-snippets' ) ?>:
81
- <input type='text' style='width: 100%;' name='<?php echo $i; ?>_description' value='<?php if (isset( $snippets[$i]['description'] ) ) echo esc_html($snippets[$i]['description']); ?>' /><br/>
82
  </td>
83
  </tr>
84
  <?php
85
  }
86
  }
87
  ?>
88
- </tbody>
89
  </table>
90
  <div class="submit">
91
  <input type="submit" name="update-post-snippets" value="<?php _e( 'Update Snippets', 'post-snippets' ) ?>" class="button-primary" /></div>
61
  // $snippets = get_option($this->plugin_options);
62
  $snippets = $this->plugin_options;
63
  if (!empty($snippets)) {
64
+ foreach ($snippets as $key => $snippet) {
65
+ ?>
66
  <tr class='recent'>
67
+ <th scope='row' class='check-column'><input type='checkbox' name='checked[]' value='<?php echo $key; ?>' /></th>
68
  <td class='row-title'>
69
+ <input type='text' name='<?php echo $key; ?>_title' value='<?php echo $snippet['title']; ?>' />
70
  </td>
71
  <td class='name'>
72
+ <input type='text' name='<?php echo $key; ?>_vars' value='<?php echo $snippet['vars']; ?>' /><br/>
73
  <?php
74
+ $this->checkbox(__('Shortcode', 'post-snippets'), $key.'_shortcode',
75
+ $snippet['shortcode']);
76
  ?>
77
  <!-- <input type='checkbox' name='< ?php echo $i; ? >_php' value='true'< ?php if ($snippets[$i]['php'] == true) { echo " checked"; }? > /> < ?php _e( 'PHP Code', 'post-snippets' ) ? ><br/> -->
78
  </td>
79
  <td class='desc'>
80
+ <textarea name="<?php echo $key; ?>_snippet" class="large-text" style='width: 100%;' rows="5"><?php echo htmlspecialchars($snippet['snippet'], ENT_NOQUOTES); ?></textarea>
81
  <?php _e( 'Description', 'post-snippets' ) ?>:
82
+ <input type='text' style='width: 100%;' name='<?php echo $key; ?>_description' value='<?php if (isset( $snippet['description'] ) ) echo esc_html($snippet['description']); ?>' /><br/>
83
  </td>
84
  </tr>
85
  <?php
86
  }
87
  }
88
  ?>
89
+ </tbody>
90
  </table>
91
  <div class="submit">
92
  <input type="submit" name="update-post-snippets" value="<?php _e( 'Update Snippets', 'post-snippets' ) ?>" class="button-primary" /></div>
languages/post-snippets-sv_SE.mo CHANGED
Binary file
languages/post-snippets-sv_SE.po CHANGED
@@ -6,8 +6,8 @@ msgid ""
6
  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-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"
@@ -16,98 +16,198 @@ msgstr ""
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"
84
- msgstr "Du har inte tillåtelse att vara här"
85
 
86
- #: tinymce/window.php:109
87
- msgid "Cancel"
88
- msgstr "Avbryt"
89
 
90
- #: tinymce/window.php:113
91
- msgid "Insert"
92
- msgstr "Infoga"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
93
 
94
- #. Plugin Name of an extension
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
95
  msgid "Post Snippets"
96
  msgstr "Post Snippets"
97
 
98
- #. Plugin URI of an extension
99
- msgid "http://coding.cglounge.com/wordpress-plugins/post-snippets/"
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"
108
  msgstr "Johan Steen"
109
 
110
- #. Author URI of an extension
111
- msgid "http://coding.cglounge.com/"
112
- msgstr "http://coding.cglounge.com/"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
113
 
 
 
6
  msgstr ""
7
  "Project-Id-Version: Post Snippets\n"
8
  "Report-Msgid-Bugs-To: http://wordpress.org/tag/post-snippets\n"
9
+ "POT-Creation-Date: 2012-01-10 14:00:40+00:00\n"
10
+ "PO-Revision-Date: 2012-01-10 20:32+0100\n"
11
  "Last-Translator: Johan Steen <artstorm@gmail.com>\n"
12
  "Language-Team: <artstorm@gmail.com>\n"
13
  "MIME-Version: 1.0\n"
16
  "X-Poedit-Language: Swedish\n"
17
  "X-Poedit-Country: SWEDEN\n"
18
 
19
+ #: classes/settings.php:33
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  msgid "Add New Snippet"
21
+ msgstr "Lägg till ny snippet"
22
 
23
+ #: classes/settings.php:34
24
  msgid "Delete Selected"
25
+ msgstr "Radera valda"
26
+
27
+ #: classes/settings.php:35
28
+ msgid "(Use the help dropdown button above for additional information.)"
29
+ msgstr "(Se hjälpmenyn ovan för mer information.)"
30
 
31
+ #: classes/settings.php:44
32
+ #: classes/settings.php:53
33
+ #: post-snippets.php:495
34
  msgid "Title"
35
  msgstr "Titel"
36
 
37
+ #: classes/settings.php:45
38
+ #: classes/settings.php:54
39
+ #: post-snippets.php:498
40
  msgid "Variables"
41
  msgstr "Variabler"
42
 
43
+ #: classes/settings.php:46
44
+ #: classes/settings.php:55
45
+ #: post-snippets.php:501
46
  msgid "Snippet"
47
+ msgstr "Snippet"
48
+
49
+ #: classes/settings.php:74
50
+ #: post-snippets.php:507
51
+ msgid "Shortcode"
52
+ msgstr "Shortcode"
53
+
54
+ #: classes/settings.php:81
55
+ #: post-snippets.php:504
56
+ msgid "Description"
57
+ msgstr "Beskrivning"
58
 
59
+ #: classes/settings.php:92
60
  msgid "Update Snippets"
61
+ msgstr "Uppdatera snippets"
62
 
63
+ #: post-snippets.php:87
64
+ msgid "Settings"
65
+ msgstr "Inställningar"
66
 
67
+ #: post-snippets.php:354
68
+ msgid "This snippet is insert only, no variables defined."
69
+ msgstr "Denna snippet saknar variabler, den infogas som den är."
70
 
71
+ #: post-snippets.php:496
72
+ msgid "Give the snippet a title that helps you identify it in the post editor. If you make it into a shortcode, this is the name of the shortcode as well."
73
+ msgstr "Ge snippeten en titel som hjälper till att identifiera den i inläggsredigeraren. Om du väljer att snippeten ska fungera som en shortcode, blir titeln även shortcode namnet."
74
 
75
+ #: post-snippets.php:499
76
+ msgid "A comma separated list of custom variables you can reference in your snippet.<br/><br/>Example:<br/>url,name"
77
+ msgstr "En kommaseparerad lista av egendefinerade variabler som du kan referera i ditt avsnitt.<br/><br/>Exempel:<br/>url,namn"
78
 
79
+ #: post-snippets.php:502
80
+ msgid "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."
81
+ msgstr "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."
82
 
83
+ #: post-snippets.php:505
84
+ msgid "An optional description for the Snippet. If entered it will be displayed in the snippets popup window in the post editor."
85
+ msgstr "En valfri beskrivning för snippeten. Om den är ifylld, så kommer den synas i popup fönstret i inläggsredigeraren."
86
 
87
+ #: post-snippets.php:508
88
+ msgid "Treats the snippet as a shortcode. The name for the shortcode is the same as the title of the snippet (spaces not allowed) and will be used on insert. If you enclose the shortcode in your posts, you can access the enclosed content by using the variable {content} in your snippet. The content variable is reserved, so don't use it in the variables field."
89
+ msgstr "Definera snippeten som en shortcode. Namnet för shortcoden blir detsamma som snippetsens titel (mellanslag är inte tillåtet) och kommer användas vid infogning. Om du innesluter text med shortcoden i dina inlägg, så kan du komma åt det inneslutna innehålet genom att använda variabeln {content} i din snippet. Content variablen är reserverade, så använd inte det namnet i variabel fältet."
90
 
91
+ #: post-snippets.php:510
92
+ msgid "Advanced"
93
+ msgstr "Avancerat"
94
+
95
+ #: post-snippets.php:511
96
+ msgid "The snippets can be retrieved directly from PHP, in a theme for instance, with the get_post_snippet() function. Visit the Post Snippets link under more information for instructions."
97
+ msgstr "En snippet kan hämtas direkt via PHP, till exempel i ett tema, med get_post_snippet() funktionen. Besök Post Snippets länken under mer information för instruktioner."
98
+
99
+ #: post-snippets.php:513
100
+ msgid "For more information:"
101
+ msgstr "För mer information:"
102
+
103
+ #: post-snippets.php:514
104
+ msgid "Visit my <a href=\"http://wpstorm.net/wordpress-plugins/post-snippets/\">Post Snippets</a> page for additional information."
105
+ msgstr "Besök <a href=\"http://wpstorm.net/wordpress-plugins/post-snippets/\">Post Snippets</a> sidan för mer information."
106
+
107
+ #: post-snippets.php:533
108
+ msgid "A snippet named Untitled has been added."
109
+ msgstr "En ny snippet med namnet Untitled har lagts till."
110
+
111
+ #: post-snippets.php:550
112
+ #: post-snippets.php:700
113
+ msgid "Snippets have been updated."
114
+ msgstr "Ändrade snippets har uppdaterats."
115
+
116
+ #: post-snippets.php:566
117
+ msgid "Selected snippets have been deleted."
118
+ msgstr "Valda snippets har raderats."
119
 
120
+ #: post-snippets.php:580
121
+ msgid "Import/Export"
122
+ msgstr "Importera/Exportera"
123
+
124
+ #: post-snippets.php:581
125
+ msgid "Export"
126
+ msgstr "Exportera"
127
+
128
+ #: post-snippets.php:583
129
+ msgid "Export your snippets for backup or to import them on another site."
130
+ msgstr "Exportera dina snippets för backup eller för att importera dem till en annan sajt."
131
+
132
+ #: post-snippets.php:584
133
+ msgid "Export Snippets"
134
+ msgstr "Exportera snippets"
135
+
136
+ #: post-snippets.php:670
137
+ msgid "Import"
138
+ msgstr "Importera"
139
+
140
+ #: post-snippets.php:672
141
+ msgid "Import snippets from a post-snippets-export.zip file. Importing overwrites any existing snippets."
142
+ msgstr "Importera snippets från en post-snippets-export.zip fil. Importen skriver över eventuella snippets som redan finns."
143
+
144
+ #: post-snippets.php:676
145
+ msgid "Import Snippets"
146
+ msgstr "Importera snippets"
147
+
148
+ #: post-snippets.php:702
149
+ msgid "Snippets successfully imported."
150
+ msgstr "Importeringen av snippets lyckades."
151
+
152
+ #: post-snippets.php:704
153
+ #: post-snippets.php:708
154
+ #: post-snippets.php:710
155
+ msgid "Snippets could not be imported:"
156
+ msgstr "Snippets kunde inte importeras:"
157
+
158
+ #: post-snippets.php:704
159
+ msgid "Unzipping failed."
160
+ msgstr "Uppackningen misslyckades."
161
+
162
+ #: post-snippets.php:710
163
+ msgid "Upload failed."
164
+ msgstr "Uppladdningen misslyckades."
165
+
166
+ #: post-snippets.php:836
167
+ msgid "Error: Post Snippets requires WordPress Version %s or higher."
168
+ msgstr "Fel: Post Snippets kräver WordPress version %s eller nyare!"
169
+
170
+ #. Plugin Name of the plugin/theme
171
  msgid "Post Snippets"
172
  msgstr "Post Snippets"
173
 
174
+ #. Plugin URI of the plugin/theme
175
+ msgid "http://wpstorm.net/wordpress-plugins/post-snippets/"
176
+ msgstr "http://wpstorm.net/wordpress-plugins/post-snippets/"
177
 
178
+ #. Description of the plugin/theme
179
+ 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 or Quicktags."
180
+ msgstr "Lagrar 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."
181
 
182
+ #. Author of the plugin/theme
183
  msgid "Johan Steen"
184
  msgstr "Johan Steen"
185
 
186
+ #. Author URI of the plugin/theme
187
+ msgid "http://johansteen.se/"
188
+ msgstr "http://johansteen.se/"
189
+
190
+ #~ msgid "Help"
191
+ #~ msgstr "Hjälp"
192
+
193
+ #~ msgid ""
194
+ #~ "<strong>Title</strong><br/>Give the snippet a title that helps you "
195
+ #~ "identify it in the post editor."
196
+ #~ msgstr ""
197
+ #~ "<strong>Titel</strong><br/>Ge avsnittet en titel som hjälper dig att "
198
+ #~ "identifiera det i inläggsredigeraren."
199
+
200
+ #~ msgid "About Post Snippets"
201
+ #~ msgstr "Om Post Snippets"
202
+
203
+ #~ msgid "You are not allowed to be here"
204
+ #~ msgstr "Du har inte tillåtelse att vara här"
205
+
206
+ #~ msgid "Cancel"
207
+ #~ msgstr "Avbryt"
208
+
209
+ #~ msgid "Insert"
210
+ #~ msgstr "Infoga"
211
 
212
+ #~ msgid "http://coding.cglounge.com/"
213
+ #~ msgstr "http://coding.cglounge.com/"
languages/post-snippets.pot CHANGED
@@ -1,19 +1,16 @@
1
- # Translation Template for Post Snippets.
2
- # Copyright (C) 2009-2011 Johan Steen
3
- # This file is distributed under the same license as the PACKAGE package.
4
- #
5
- #, fuzzy
6
  msgid ""
7
  msgstr ""
8
- "Project-Id-Version: Post Snippets\n"
9
  "Report-Msgid-Bugs-To: http://wordpress.org/tag/post-snippets\n"
10
- "POT-Creation-Date: 2011-12-28 01:19:09+00:00\n"
11
  "MIME-Version: 1.0\n"
12
- "PO-Revision-Date: 2010-MO-DA HO:MI+ZONE\n"
13
- "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
- "Language-Team: <artstorm@gmail.com>\n"
15
  "Content-Type: text/plain; charset=UTF-8\n"
16
  "Content-Transfer-Encoding: 8bit\n"
 
 
 
17
 
18
  #: classes/settings.php:33
19
  msgid "Add New Snippet"
@@ -27,51 +24,51 @@ msgstr ""
27
  msgid "(Use the help dropdown button above for additional information.)"
28
  msgstr ""
29
 
30
- #: classes/settings.php:44 classes/settings.php:53 post-snippets.php:493
31
  msgid "Title"
32
  msgstr ""
33
 
34
- #: classes/settings.php:45 classes/settings.php:54 post-snippets.php:496
35
  msgid "Variables"
36
  msgstr ""
37
 
38
- #: classes/settings.php:46 classes/settings.php:55 post-snippets.php:499
39
  msgid "Snippet"
40
  msgstr ""
41
 
42
- #: classes/settings.php:73 post-snippets.php:505
43
  msgid "Shortcode"
44
  msgstr ""
45
 
46
- #: classes/settings.php:80 post-snippets.php:502
47
  msgid "Description"
48
  msgstr ""
49
 
50
- #: classes/settings.php:91
51
  msgid "Update Snippets"
52
  msgstr ""
53
 
54
- #: post-snippets.php:89
55
  msgid "Settings"
56
  msgstr ""
57
 
58
- #: post-snippets.php:352
59
  msgid "This snippet is insert only, no variables defined."
60
  msgstr ""
61
 
62
- #: post-snippets.php:494
63
  msgid ""
64
  "Give the snippet a title that helps you identify it in the post editor. If "
65
  "you make it into a shortcode, this is the name of the shortcode as well."
66
  msgstr ""
67
 
68
- #: post-snippets.php:497
69
  msgid ""
70
  "A comma separated list of custom variables you can reference in your snippet."
71
  "<br/><br/>Example:<br/>url,name"
72
  msgstr ""
73
 
74
- #: post-snippets.php:500
75
  msgid ""
76
  "This is the block of text or HTML to insert in the post when you select the "
77
  "snippet from the insert button in the TinyMCE panel in the post editor. If "
@@ -83,13 +80,13 @@ msgid ""
83
  "and name on insert if they are defined as variables."
84
  msgstr ""
85
 
86
- #: post-snippets.php:503
87
  msgid ""
88
  "An optional description for the Snippet. If entered it will be displayed in "
89
  "the snippets popup window in the post editor."
90
  msgstr ""
91
 
92
- #: post-snippets.php:506
93
  msgid ""
94
  "Treats the snippet as a shortcode. The name for the shortcode is the same as "
95
  "the title of the snippet (spaces not allowed) and will be used on insert. If "
@@ -98,98 +95,86 @@ msgid ""
98
  "reserved, so don't use it in the variables field."
99
  msgstr ""
100
 
101
- #: post-snippets.php:508
102
  msgid "Advanced"
103
  msgstr ""
104
 
105
- #: post-snippets.php:509
106
  msgid ""
107
  "The snippets can be retrieved directly from PHP, in a theme for instance, "
108
  "with the get_post_snippet() function. Visit the Post Snippets link under "
109
  "more information for instructions."
110
  msgstr ""
111
 
112
- #: post-snippets.php:511
113
  msgid "For more information:"
114
  msgstr ""
115
 
116
- #: post-snippets.php:512
117
  msgid ""
118
  "Visit my <a href=\"http://wpstorm.net/wordpress-plugins/post-snippets/"
119
  "\">Post Snippets</a> page for additional information."
120
  msgstr ""
121
 
122
- #: post-snippets.php:531
123
  msgid "A snippet named Untitled has been added."
124
  msgstr ""
125
 
126
- #: post-snippets.php:558 post-snippets.php:708
127
  msgid "Snippets have been updated."
128
  msgstr ""
129
 
130
- #: post-snippets.php:574
131
  msgid "Selected snippets have been deleted."
132
  msgstr ""
133
 
134
- #: post-snippets.php:588
135
  msgid "Import/Export"
136
  msgstr ""
137
 
138
- #: post-snippets.php:589
139
  msgid "Export"
140
  msgstr ""
141
 
142
- #: post-snippets.php:591
143
  msgid "Export your snippets for backup or to import them on another site."
144
  msgstr ""
145
 
146
- #: post-snippets.php:592
147
  msgid "Export Snippets"
148
  msgstr ""
149
 
150
- #: post-snippets.php:678
151
  msgid "Import"
152
  msgstr ""
153
 
154
- #: post-snippets.php:680
155
  msgid ""
156
  "Import snippets from a post-snippets-export.zip file. Importing overwrites "
157
  "any existing snippets."
158
  msgstr ""
159
 
160
- #: post-snippets.php:684
161
  msgid "Import Snippets"
162
  msgstr ""
163
 
164
- #: post-snippets.php:710
165
  msgid "Snippets successfully imported."
166
  msgstr ""
167
 
168
- #: post-snippets.php:712 post-snippets.php:716 post-snippets.php:718
169
  msgid "Snippets could not be imported:"
170
  msgstr ""
171
 
172
- #: post-snippets.php:712
173
  msgid "Unzipping failed."
174
  msgstr ""
175
 
176
- #: post-snippets.php:718
177
  msgid "Upload failed."
178
  msgstr ""
179
 
180
- #: post-snippets.php:798
181
- msgid ""
182
- "Notice:<br/>\r\n"
183
- "\t\t\tWhen Post Snippets v1.9 will be released, the minimum \r\n"
184
- "\t\t\trequired PHP Version will be %1$s to be on par with WordPress 3.3.\r\n"
185
- "\t\t\t<br/>\r\n"
186
- "\t\t\tPlease update your\r\n"
187
- "\t\t\tPHP installation before updating Post Snippets to v1.9+, or \r\n"
188
- "\t\t\tcontact the plugin author to plead your case.<br/>\r\n"
189
- "\t\t\tYour installed PHP version: %2$s"
190
- msgstr ""
191
-
192
- #: post-snippets.php:817
193
  msgid "Error: Post Snippets requires WordPress Version %s or higher."
194
  msgstr ""
195
 
1
+ # Copyright (C) 2012 Post Snippets
2
+ # This file is distributed under the same license as the Post Snippets package.
 
 
 
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: Post Snippets 1.8.8\n"
6
  "Report-Msgid-Bugs-To: http://wordpress.org/tag/post-snippets\n"
7
+ "POT-Creation-Date: 2012-01-10 14:00:40+00:00\n"
8
  "MIME-Version: 1.0\n"
 
 
 
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
11
+ "PO-Revision-Date: 2012-MO-DA HO:MI+ZONE\n"
12
+ "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
+ "Language-Team: LANGUAGE <LL@li.org>\n"
14
 
15
  #: classes/settings.php:33
16
  msgid "Add New Snippet"
24
  msgid "(Use the help dropdown button above for additional information.)"
25
  msgstr ""
26
 
27
+ #: classes/settings.php:44 classes/settings.php:53 post-snippets.php:495
28
  msgid "Title"
29
  msgstr ""
30
 
31
+ #: classes/settings.php:45 classes/settings.php:54 post-snippets.php:498
32
  msgid "Variables"
33
  msgstr ""
34
 
35
+ #: classes/settings.php:46 classes/settings.php:55 post-snippets.php:501
36
  msgid "Snippet"
37
  msgstr ""
38
 
39
+ #: classes/settings.php:74 post-snippets.php:507
40
  msgid "Shortcode"
41
  msgstr ""
42
 
43
+ #: classes/settings.php:81 post-snippets.php:504
44
  msgid "Description"
45
  msgstr ""
46
 
47
+ #: classes/settings.php:92
48
  msgid "Update Snippets"
49
  msgstr ""
50
 
51
+ #: post-snippets.php:87
52
  msgid "Settings"
53
  msgstr ""
54
 
55
+ #: post-snippets.php:354
56
  msgid "This snippet is insert only, no variables defined."
57
  msgstr ""
58
 
59
+ #: post-snippets.php:496
60
  msgid ""
61
  "Give the snippet a title that helps you identify it in the post editor. If "
62
  "you make it into a shortcode, this is the name of the shortcode as well."
63
  msgstr ""
64
 
65
+ #: post-snippets.php:499
66
  msgid ""
67
  "A comma separated list of custom variables you can reference in your snippet."
68
  "<br/><br/>Example:<br/>url,name"
69
  msgstr ""
70
 
71
+ #: post-snippets.php:502
72
  msgid ""
73
  "This is the block of text or HTML to insert in the post when you select the "
74
  "snippet from the insert button in the TinyMCE panel in the post editor. If "
80
  "and name on insert if they are defined as variables."
81
  msgstr ""
82
 
83
+ #: post-snippets.php:505
84
  msgid ""
85
  "An optional description for the Snippet. If entered it will be displayed in "
86
  "the snippets popup window in the post editor."
87
  msgstr ""
88
 
89
+ #: post-snippets.php:508
90
  msgid ""
91
  "Treats the snippet as a shortcode. The name for the shortcode is the same as "
92
  "the title of the snippet (spaces not allowed) and will be used on insert. If "
95
  "reserved, so don't use it in the variables field."
96
  msgstr ""
97
 
98
+ #: post-snippets.php:510
99
  msgid "Advanced"
100
  msgstr ""
101
 
102
+ #: post-snippets.php:511
103
  msgid ""
104
  "The snippets can be retrieved directly from PHP, in a theme for instance, "
105
  "with the get_post_snippet() function. Visit the Post Snippets link under "
106
  "more information for instructions."
107
  msgstr ""
108
 
109
+ #: post-snippets.php:513
110
  msgid "For more information:"
111
  msgstr ""
112
 
113
+ #: post-snippets.php:514
114
  msgid ""
115
  "Visit my <a href=\"http://wpstorm.net/wordpress-plugins/post-snippets/"
116
  "\">Post Snippets</a> page for additional information."
117
  msgstr ""
118
 
119
+ #: post-snippets.php:533
120
  msgid "A snippet named Untitled has been added."
121
  msgstr ""
122
 
123
+ #: post-snippets.php:550 post-snippets.php:700
124
  msgid "Snippets have been updated."
125
  msgstr ""
126
 
127
+ #: post-snippets.php:566
128
  msgid "Selected snippets have been deleted."
129
  msgstr ""
130
 
131
+ #: post-snippets.php:580
132
  msgid "Import/Export"
133
  msgstr ""
134
 
135
+ #: post-snippets.php:581
136
  msgid "Export"
137
  msgstr ""
138
 
139
+ #: post-snippets.php:583
140
  msgid "Export your snippets for backup or to import them on another site."
141
  msgstr ""
142
 
143
+ #: post-snippets.php:584
144
  msgid "Export Snippets"
145
  msgstr ""
146
 
147
+ #: post-snippets.php:670
148
  msgid "Import"
149
  msgstr ""
150
 
151
+ #: post-snippets.php:672
152
  msgid ""
153
  "Import snippets from a post-snippets-export.zip file. Importing overwrites "
154
  "any existing snippets."
155
  msgstr ""
156
 
157
+ #: post-snippets.php:676
158
  msgid "Import Snippets"
159
  msgstr ""
160
 
161
+ #: post-snippets.php:702
162
  msgid "Snippets successfully imported."
163
  msgstr ""
164
 
165
+ #: post-snippets.php:704 post-snippets.php:708 post-snippets.php:710
166
  msgid "Snippets could not be imported:"
167
  msgstr ""
168
 
169
+ #: post-snippets.php:704
170
  msgid "Unzipping failed."
171
  msgstr ""
172
 
173
+ #: post-snippets.php:710
174
  msgid "Upload failed."
175
  msgstr ""
176
 
177
+ #: post-snippets.php:836
 
 
 
 
 
 
 
 
 
 
 
 
178
  msgid "Error: Post Snippets requires WordPress Version %s or higher."
179
  msgstr ""
180
 
post-snippets.php CHANGED
@@ -3,12 +3,12 @@
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.8
7
  Author: Johan Steen
8
  Author URI: http://johansteen.se/
9
  Text Domain: post-snippets
10
 
11
- Copyright 2009-2011 Johan Steen (email : artstorm [at] gmail [dot] com)
12
 
13
  This program is free software; you can redistribute it and/or modify
14
  it under the terms of the GNU General Public License as published by
@@ -26,25 +26,21 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26
  */
27
 
28
  class Post_Snippets {
29
- private $tinymce_plugin_name = 'post_snippets';
30
- var $plugin_options = "post_snippets_options";
31
 
32
- /**
33
- * Constructor
34
- *
35
- */
36
- public function post_snippets() {
37
- // Define the domain for translations
38
- load_plugin_textdomain( 'post-snippets', false,
39
- dirname(plugin_basename(__FILE__)) . '/languages/');
40
 
41
  $this->init_hooks();
42
  }
43
 
44
  /**
45
  * Initializes the hooks for the plugin
46
- *
47
- * @returns Nothing
48
  */
49
  function init_hooks() {
50
 
@@ -82,10 +78,10 @@ class Post_Snippets {
82
  /**
83
  * Quick link to the Post Snippets Settings page from the Plugins page.
84
  *
85
- * @returns Array with all the plugin's action links
86
  */
87
  function plugin_action_links( $links, $file ) {
88
- if ( $file == plugin_basename( dirname(__FILE__).'/post-snippets.php' ) ) {
89
  $links[] = '<a href="options-general.php?page=post-snippets/post-snippets.php">'.__('Settings', 'post-snippets').'</a>';
90
  }
91
  return $links;
@@ -96,8 +92,6 @@ class Post_Snippets {
96
  * Enqueues the necessary scripts and styles for the plugins
97
  *
98
  * @since Post Snippets 1.7
99
- *
100
- * @returns Nothing
101
  */
102
  function enqueue_assets() {
103
  wp_enqueue_script( 'jquery-ui-dialog' );
@@ -105,7 +99,8 @@ class Post_Snippets {
105
  wp_enqueue_style( 'wp-jquery-ui-dialog');
106
 
107
  # Adds the CSS stylesheet for the jQuery UI dialog
108
- $style_url = plugins_url( '/assets/post-snippets.css', __FILE__);
 
109
  wp_register_style('post-snippets', $style_url);
110
  wp_enqueue_style( 'post-snippets');
111
  }
@@ -175,7 +170,7 @@ class Post_Snippets {
175
  {
176
  // Load the TinyMCE plugin, editor_plugin.js, into the array
177
  $plugins[$this->tinymce_plugin_name] =
178
- plugins_url('/tinymce/editor_plugin.js', __FILE__);
179
 
180
  return $plugins;
181
  }
@@ -184,13 +179,10 @@ class Post_Snippets {
184
  // -------------------------------------------------------------------------
185
 
186
 
187
-
188
  /**
189
  * jQuery control for the dialog and Javascript needed to insert snippets into the editor
190
  *
191
  * @since Post Snippets 1.7
192
- *
193
- * @returns Nothing
194
  */
195
  function jquery_ui_dialog() {
196
  echo "\n<!-- START: Post Snippets jQuery UI and related functions -->\n";
@@ -200,21 +192,23 @@ class Post_Snippets {
200
  # so they can be inserted into the editor, and get the variables replaced
201
  # with user defined strings.
202
  $snippets = get_option($this->plugin_options);
203
- for ($i = 0; $i < count($snippets); $i++) {
204
- if ($snippets[$i]['shortcode']) {
205
  # Build a long string of the variables, ie: varname1={varname1} varname2={varname2}
206
  # so {varnameX} can be replaced at runtime.
207
- $var_arr = explode(",",$snippets[$i]['vars']);
208
  $variables = '';
209
  if (!empty($var_arr[0])) {
210
- for ($j = 0; $j < count($var_arr); $j++) {
211
- $variables .= ' ' . $var_arr[$j] . '="{' . $var_arr[$j] . '}"';
212
  }
213
  }
214
- $shortcode = $snippets[$i]['title'] . $variables;
215
- echo "var postsnippet_{$i} = '[" . $shortcode . "]';\n";
216
  } else {
217
- $snippet = $snippets[$i]['snippet'];
 
 
218
  # Fixes for potential collisions:
219
  /* Replace <> with char codes, otherwise </script> in a snippet will break it */
220
  $snippet = str_replace( '<', '\x3C', str_replace( '>', '\x3E', $snippet ) );
@@ -223,7 +217,7 @@ class Post_Snippets {
223
  /* Remove CR and replace LF with \n to keep formatting */
224
  $snippet = str_replace( chr(13), '', str_replace( chr(10), '\n', $snippet ) );
225
  # Print out the variable containing the snippet
226
- echo "var postsnippet_{$i} = \"" . $snippet . "\";\n";
227
  }
228
  }
229
  ?>
@@ -231,11 +225,11 @@ class Post_Snippets {
231
  jQuery(document).ready(function($){
232
  <?php
233
  # Create js variables for all form fields
234
- for ($i = 0; $i < count($snippets); $i++) {
235
- $var_arr = explode(",",$snippets[$i]['vars']);
236
  if (!empty($var_arr[0])) {
237
- for ($j = 0; $j < count($var_arr); $j++) {
238
- $varname = "var_" . $i . "_" . $j;
239
  echo "var {$varname} = $( \"#{$varname}\" );\n";
240
  }
241
  }
@@ -257,16 +251,16 @@ class Post_Snippets {
257
  $( this ).dialog( "close" );
258
  var selected = $tabs.tabs('option', 'selected');
259
  <?php
260
- for ($i = 0; $i < count($snippets); $i++) {
261
  ?>
262
- if (selected == <?php echo $i; ?>) {
263
- insert_snippet = postsnippet_<?php echo $i; ?>;
264
  <?php
265
- $var_arr = explode(",",$snippets[$i]['vars']);
266
  if (!empty($var_arr[0])) {
267
- for ($j = 0; $j < count($var_arr); $j++) {
268
- $varname = "var_" . $i . "_" . $j; ?>
269
- insert_snippet = insert_snippet.replace(/\{<?php echo $var_arr[$j]; ?>\}/g, <?php echo $varname; ?>.val());
270
  <?php
271
  echo "\n";
272
  }
@@ -309,8 +303,6 @@ function edOpenPostSnippets(myField) {
309
  * Insert Snippet jQuery UI dialog HTML for the post editor
310
  *
311
  * @since Post Snippets 1.7
312
- *
313
- * @returns Nothing
314
  */
315
  function insert_ui_dialog() {
316
  echo "\n<!-- START: Post Snippets UI Dialog -->\n";
@@ -323,32 +315,33 @@ function edOpenPostSnippets(myField) {
323
  <?php
324
  # Create a tab for each available snippet
325
  $snippets = get_option($this->plugin_options);
326
- for ($i = 0; $i < count($snippets); $i++) { ?>
327
- <li><a href="#ps-tabs-<?php echo $i; ?>"><?php echo $snippets[$i]['title']; ?></a></li>
 
328
  <?php } ?>
329
  </ul>
330
 
331
  <?php
332
  # Create a panel with form fields for each available snippet
333
- for ($i = 0; $i < count($snippets); $i++) { ?>
334
- <div id="ps-tabs-<?php echo $i; ?>">
335
  <?php
336
  // Print a snippet description is available
337
- if ( isset($snippets[$i]['description']) )
338
- echo '<p class="howto">' . $snippets[$i]['description'] . "</p>\n";
339
 
340
  // Get all variables defined for the snippet and output them as input fields
341
- $var_arr = explode(",",$snippets[$i]['vars']);
342
  if (!empty($var_arr[0])) {
343
- for ($j = 0; $j < count($var_arr); $j++) { ?>
344
- <label for="var_<?php echo $i; ?>_<?php echo $j; ?>"><?php echo($var_arr[$j]);?>:</label>
345
- <input type="text" id="var_<?php echo $i; ?>_<?php echo $j; ?>" name="var_<?php echo $i; ?>_<?php echo $j; ?>" style="width: 190px" />
346
  <br/>
347
  <?php
348
  }
349
  } else {
350
  // If no variables and no description available, output a text to inform the user that it's an insert snippet only
351
- if ( empty($snippets[$i]['description']) )
352
  echo '<p class="howto">' . __('This snippet is insert only, no variables defined.', 'post-snippets') . "</p>";
353
  }
354
  ?>
@@ -371,8 +364,6 @@ function edOpenPostSnippets(myField) {
371
  *
372
  * @see wp-includes/js/quicktags.dev.js -> qt.addButton()
373
  * @since Post Snippets 1.8.6
374
- *
375
- * @returns Nothing
376
  */
377
  public function add_quicktag_button() {
378
  echo "\n<!-- START: Add QuickTag button for Post Snippets -->\n";
@@ -395,8 +386,6 @@ function edOpenPostSnippets(myField) {
395
  * @see wp-includes/js/quicktags.dev.js
396
  * @since Post Snippets 1.7
397
  * @deprecated Since 1.8.6
398
- *
399
- * @returns Nothing
400
  */
401
  function add_quicktag_button_pre33() {
402
  echo "\n<!-- START: Post Snippets QuickTag button -->\n";
@@ -423,22 +412,21 @@ function edOpenPostSnippets(myField) {
423
 
424
  /**
425
  * Create the functions for shortcodes dynamically and register them
426
- *
427
  */
428
  function create_shortcodes() {
429
  $snippets = get_option($this->plugin_options);
430
  if (!empty($snippets)) {
431
- for ($i=0; $i < count($snippets); $i++) {
432
  // If shortcode is enabled for the snippet, and a snippet has been entered, register it as a shortcode.
433
- if ( $snippets[$i]['shortcode'] && !empty($snippets[$i]['snippet']) ) {
434
 
435
- $vars = explode(",",$snippets[$i]['vars']);
436
  $vars_str = '';
437
- for ($j=0; $j < count($vars); $j++) {
438
- $vars_str = $vars_str . '"'.$vars[$j].'" => "",';
439
-
440
  }
441
- add_shortcode($snippets[$i]['title'], create_function('$atts,$content=null',
 
442
  '$shortcode_symbols = array('.$vars_str.');
443
  extract(shortcode_atts($shortcode_symbols, $atts));
444
 
@@ -448,7 +436,7 @@ function edOpenPostSnippets(myField) {
448
  if ( $content != null )
449
  $attributes["content"] = $content;
450
 
451
- $snippet = "'. addslashes($snippets[$i]["snippet"]) .'";
452
  $snippet = str_replace("&", "&amp;", $snippet);
453
 
454
  foreach ($attributes as $key => $val) {
@@ -464,11 +452,12 @@ function edOpenPostSnippets(myField) {
464
 
465
  /**
466
  * The Admin Page and all it's functions
467
- *
468
  */
469
  function wp_admin() {
470
- add_action( 'contextual_help', array(&$this,'add_help_text'), 10, 3 );
471
- add_options_page( 'Post Snippets Options', 'Post Snippets', 'administrator', __FILE__, array(&$this, 'options_page') );
 
 
472
  }
473
 
474
  function admin_message($message) {
@@ -479,42 +468,6 @@ function edOpenPostSnippets(myField) {
479
  }
480
  }
481
 
482
- /**
483
- * Display contextual help in the help drop down menu at the options page.
484
- *
485
- * @since Post Snippets 1.7.1
486
- *
487
- * @returns string The Contextual Help
488
- */
489
- function add_help_text($contextual_help, $screen_id, $screen) {
490
- //$contextual_help .= var_dump($screen); // use this to help determine $screen->id
491
- if ( $screen->id == 'settings_page_post-snippets/post-snippets' ) {
492
- $contextual_help =
493
- '<p><strong>' . __('Title', 'post-snippets') . '</strong></p>' .
494
- '<p>' . __('Give the snippet a title that helps you identify it in the post editor. If you make it into a shortcode, this is the name of the shortcode as well.', 'post-snippets') . '</p>' .
495
-
496
- '<p><strong>' . __('Variables', 'post-snippets') . '</strong></p>' .
497
- '<p>' . __('A comma separated list of custom variables you can reference in your snippet.<br/><br/>Example:<br/>url,name', 'post-snippets') . '</p>' .
498
-
499
- '<p><strong>' . __('Snippet', 'post-snippets') . '</strong></p>' .
500
- '<p>' . __('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>' .
501
-
502
- '<p><strong>' . __('Description', 'post-snippets') . '</strong></p>' .
503
- '<p>' . __('An optional description for the Snippet. If entered it will be displayed in the snippets popup window in the post editor.', 'post-snippets') . '</p>' .
504
-
505
- '<p><strong>' . __('Shortcode', 'post-snippets') . '</strong></p>' .
506
- '<p>' . __('Treats the snippet as a shortcode. The name for the shortcode is the same as the title of the snippet (spaces not allowed) and will be used on insert. If you enclose the shortcode in your posts, you can access the enclosed content by using the variable {content} in your snippet. The content variable is reserved, so don\'t use it in the variables field.', 'post-snippets') . '</p>' .
507
-
508
- '<p><strong>' . __('Advanced', 'post-snippets') . '</strong></p>' .
509
- '<p>' . __('The snippets can be retrieved directly from PHP, in a theme for instance, with the get_post_snippet() function. Visit the Post Snippets link under more information for instructions.', 'post-snippets') . '</p>' .
510
-
511
- '<p><strong>' . __('For more information:', 'post-snippets') . '</strong></p>' .
512
- '<p>' . __('Visit my <a href="http://wpstorm.net/wordpress-plugins/post-snippets/">Post Snippets</a> page for additional information.', 'post-snippets') . '</p>';
513
- }
514
- return $contextual_help;
515
- }
516
-
517
-
518
  function options_page() {
519
  // Add a new Snippet
520
  if (isset($_POST['add-snippet'])) {
@@ -535,24 +488,14 @@ function edOpenPostSnippets(myField) {
535
  if (isset($_POST['update-post-snippets'])) {
536
  $snippets = get_option($this->plugin_options);
537
  if (!empty($snippets)) {
538
- for ($i=0; $i < count($snippets); $i++) {
539
- $new_snippets[$i]['title'] = trim($_POST[$i.'_title']);
540
- $new_snippets[$i]['vars'] = str_replace(" ", "", trim($_POST[$i.'_vars']) );
541
- $new_snippets[$i]['shortcode'] = isset($_POST[$i.'_shortcode']) ? true : false;
542
- $new_snippets[$i]['php'] = isset($_POST[$i.'_php']) ? true : false;
543
- /* Check if the plugin runs on PHP below version 5.1.0
544
- Because of a bug in WP 2.7.x in includes/compat.php the htmlspecialchars_decode
545
- don't revert back to a PHP 4.x compatible version. So this is a workaround to make
546
- the plugin work correctly on PHP versions below 5.1.
547
- This problem is fixed in WP 2.8.
548
- */
549
- if (version_compare(PHP_VERSION, '5.1.0', '<')) {
550
- $new_snippets[$i]['snippet'] = htmlspecialchars_decode( trim(stripslashes($_POST[$i.'_snippet'])), ENT_NOQUOTES);
551
- $new_snippets[$i]['description'] = htmlspecialchars_decode( trim(stripslashes($_POST[$i.'_description'])), ENT_NOQUOTES);
552
- } else {
553
- $new_snippets[$i]['snippet'] = wp_specialchars_decode( trim(stripslashes($_POST[$i.'_snippet'])), ENT_NOQUOTES);
554
- $new_snippets[$i]['description'] = wp_specialchars_decode( trim(stripslashes($_POST[$i.'_description'])), ENT_NOQUOTES);
555
- }
556
  }
557
  update_option($this->plugin_options, $new_snippets);
558
  $this->admin_message( __( 'Snippets have been updated.', 'post-snippets' ) );
@@ -565,9 +508,9 @@ function edOpenPostSnippets(myField) {
565
  if (!empty($snippets)) {
566
  $delete = $_POST['checked'];
567
  $newsnippets = array();
568
- for ($i=0; $i < count($snippets); $i++) {
569
- if (in_array($i,$delete) == false) {
570
- array_push($newsnippets,$snippets[$i]);
571
  }
572
  }
573
  update_option($this->plugin_options, $newsnippets);
@@ -603,7 +546,7 @@ function edOpenPostSnippets(myField) {
603
  *
604
  * @since Post Snippets 1.8
605
  *
606
- * @returns string URL to the exported snippets
607
  */
608
  function export_snippets() {
609
  if ( isset($_POST['postsnippets_export']) ) {
@@ -636,7 +579,7 @@ function edOpenPostSnippets(myField) {
636
  *
637
  * @since Post Snippets 1.8
638
  *
639
- * @returns string URL to the exported snippets
640
  */
641
  function create_export_file() {
642
  $snippets = serialize(get_option($this->plugin_options));
@@ -672,7 +615,7 @@ function edOpenPostSnippets(myField) {
672
  * @uses wp_handle_upload() in wp-admin/includes/file.php
673
  * @since Post Snippets 1.8
674
  *
675
- * @returns string HTML to handle the import
676
  */
677
  function import_snippets() {
678
  $import = '<br/><br/><strong>'.__( 'Import', 'post-snippets' ).'</strong><br/>';
@@ -720,7 +663,34 @@ function edOpenPostSnippets(myField) {
720
  }
721
  return $import;
722
  }
723
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
724
  }
725
 
726
 
@@ -737,6 +707,7 @@ if($test_post_snippets_host->passed) {
737
  // Load external classes
738
  if (is_admin()) {
739
  require plugin_dir_path(__FILE__).'classes/settings.php';
 
740
  }
741
 
742
  add_action(
@@ -796,14 +767,14 @@ class Post_Snippets_Host_Environment
796
  function php_version_error() {
797
  echo '<div class="error"><p><strong>';
798
  printf( __(
799
- 'Notice:<br/>
800
- When Post Snippets v1.9 will be released, the minimum
801
- required PHP Version will be %1$s to be on par with WordPress 3.3.
802
- <br/>
803
- Please update your
804
- PHP installation before updating Post Snippets to v1.9+, or
805
- contact the plugin author to plead your case.<br/>
806
- Your installed PHP version: %2$s',
807
  'post-snippets'),
808
  $this->MIN_PHP_VERSION, PHP_VERSION);
809
  echo '</strong></p></div>';
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.9
7
  Author: Johan Steen
8
  Author URI: http://johansteen.se/
9
  Text Domain: post-snippets
10
 
11
+ Copyright 2009-2012 Johan Steen (email : artstorm [at] gmail [dot] com)
12
 
13
  This program is free software; you can redistribute it and/or modify
14
  it under the terms of the GNU General Public License as published by
26
  */
27
 
28
  class Post_Snippets {
29
+ private $tinymce_plugin_name = 'post_snippets';
30
+ private $plugin_options = 'post_snippets_options';
31
 
32
+ // -------------------------------------------------------------------------
33
+
34
+ public function __construct() {
35
+ // Define the domain and path for translations
36
+ $rel_path = dirname(plugin_basename($this->get_File())).'/languages/';
37
+ load_plugin_textdomain( 'post-snippets', false, $rel_path );
 
 
38
 
39
  $this->init_hooks();
40
  }
41
 
42
  /**
43
  * Initializes the hooks for the plugin
 
 
44
  */
45
  function init_hooks() {
46
 
78
  /**
79
  * Quick link to the Post Snippets Settings page from the Plugins page.
80
  *
81
+ * @return Array with all the plugin's action links
82
  */
83
  function plugin_action_links( $links, $file ) {
84
+ if ( $file == plugin_basename( dirname($this->get_FILE()).'/post-snippets.php' ) ) {
85
  $links[] = '<a href="options-general.php?page=post-snippets/post-snippets.php">'.__('Settings', 'post-snippets').'</a>';
86
  }
87
  return $links;
92
  * Enqueues the necessary scripts and styles for the plugins
93
  *
94
  * @since Post Snippets 1.7
 
 
95
  */
96
  function enqueue_assets() {
97
  wp_enqueue_script( 'jquery-ui-dialog' );
99
  wp_enqueue_style( 'wp-jquery-ui-dialog');
100
 
101
  # Adds the CSS stylesheet for the jQuery UI dialog
102
+ $style_url = plugins_url( '/assets/post-snippets.css', __FILE__ );
103
+ $style_url = plugins_url( '/assets/post-snippets.css', $this->get_FILE() );
104
  wp_register_style('post-snippets', $style_url);
105
  wp_enqueue_style( 'post-snippets');
106
  }
170
  {
171
  // Load the TinyMCE plugin, editor_plugin.js, into the array
172
  $plugins[$this->tinymce_plugin_name] =
173
+ plugins_url('/tinymce/editor_plugin.js', $this->get_FILE());
174
 
175
  return $plugins;
176
  }
179
  // -------------------------------------------------------------------------
180
 
181
 
 
182
  /**
183
  * jQuery control for the dialog and Javascript needed to insert snippets into the editor
184
  *
185
  * @since Post Snippets 1.7
 
 
186
  */
187
  function jquery_ui_dialog() {
188
  echo "\n<!-- START: Post Snippets jQuery UI and related functions -->\n";
192
  # so they can be inserted into the editor, and get the variables replaced
193
  # with user defined strings.
194
  $snippets = get_option($this->plugin_options);
195
+ foreach ($snippets as $key => $snippet) {
196
+ if ($snippet['shortcode']) {
197
  # Build a long string of the variables, ie: varname1={varname1} varname2={varname2}
198
  # so {varnameX} can be replaced at runtime.
199
+ $var_arr = explode(",",$snippet['vars']);
200
  $variables = '';
201
  if (!empty($var_arr[0])) {
202
+ foreach ($var_arr as $var) {
203
+ $variables .= ' ' . $var . '="{' . $var . '}"';
204
  }
205
  }
206
+ $shortcode = $snippet['title'] . $variables;
207
+ echo "var postsnippet_{$key} = '[" . $shortcode . "]';\n";
208
  } else {
209
+ // To use $snippet is probably not a good naming convention here.
210
+ // rename to js_snippet or something?
211
+ $snippet = $snippet['snippet'];
212
  # Fixes for potential collisions:
213
  /* Replace <> with char codes, otherwise </script> in a snippet will break it */
214
  $snippet = str_replace( '<', '\x3C', str_replace( '>', '\x3E', $snippet ) );
217
  /* Remove CR and replace LF with \n to keep formatting */
218
  $snippet = str_replace( chr(13), '', str_replace( chr(10), '\n', $snippet ) );
219
  # Print out the variable containing the snippet
220
+ echo "var postsnippet_{$key} = \"" . $snippet . "\";\n";
221
  }
222
  }
223
  ?>
225
  jQuery(document).ready(function($){
226
  <?php
227
  # Create js variables for all form fields
228
+ foreach ($snippets as $key => $snippet) {
229
+ $var_arr = explode(",",$snippet['vars']);
230
  if (!empty($var_arr[0])) {
231
+ foreach ($var_arr as $key_2 => $var) {
232
+ $varname = "var_" . $key . "_" . $key_2;
233
  echo "var {$varname} = $( \"#{$varname}\" );\n";
234
  }
235
  }
251
  $( this ).dialog( "close" );
252
  var selected = $tabs.tabs('option', 'selected');
253
  <?php
254
+ foreach ($snippets as $key => $snippet) {
255
  ?>
256
+ if (selected == <?php echo $key; ?>) {
257
+ insert_snippet = postsnippet_<?php echo $key; ?>;
258
  <?php
259
+ $var_arr = explode(",",$snippet['vars']);
260
  if (!empty($var_arr[0])) {
261
+ foreach ($var_arr as $key_2 => $var) {
262
+ $varname = "var_" . $key . "_" . $key_2; ?>
263
+ insert_snippet = insert_snippet.replace(/\{<?php echo $var; ?>\}/g, <?php echo $varname; ?>.val());
264
  <?php
265
  echo "\n";
266
  }
303
  * Insert Snippet jQuery UI dialog HTML for the post editor
304
  *
305
  * @since Post Snippets 1.7
 
 
306
  */
307
  function insert_ui_dialog() {
308
  echo "\n<!-- START: Post Snippets UI Dialog -->\n";
315
  <?php
316
  # Create a tab for each available snippet
317
  $snippets = get_option($this->plugin_options);
318
+ foreach ($snippets as $key => $snippet) {
319
+ ?>
320
+ <li><a href="#ps-tabs-<?php echo $key; ?>"><?php echo $snippet['title']; ?></a></li>
321
  <?php } ?>
322
  </ul>
323
 
324
  <?php
325
  # Create a panel with form fields for each available snippet
326
+ foreach ($snippets as $key => $snippet) { ?>
327
+ <div id="ps-tabs-<?php echo $key; ?>">
328
  <?php
329
  // Print a snippet description is available
330
+ if ( isset($snippet['description']) )
331
+ echo '<p class="howto">' . $snippet['description'] . "</p>\n";
332
 
333
  // Get all variables defined for the snippet and output them as input fields
334
+ $var_arr = explode(",",$snippet['vars']);
335
  if (!empty($var_arr[0])) {
336
+ foreach ($var_arr as $key_2 => $var) { ?>
337
+ <label for="var_<?php echo $key; ?>_<?php echo $key_2; ?>"><?php echo($var);?>:</label>
338
+ <input type="text" id="var_<?php echo $key; ?>_<?php echo $key_2; ?>" name="var_<?php echo $key; ?>_<?php echo $key_2; ?>" style="width: 190px" />
339
  <br/>
340
  <?php
341
  }
342
  } else {
343
  // If no variables and no description available, output a text to inform the user that it's an insert snippet only
344
+ if ( empty($snippet['description']) )
345
  echo '<p class="howto">' . __('This snippet is insert only, no variables defined.', 'post-snippets') . "</p>";
346
  }
347
  ?>
364
  *
365
  * @see wp-includes/js/quicktags.dev.js -> qt.addButton()
366
  * @since Post Snippets 1.8.6
 
 
367
  */
368
  public function add_quicktag_button() {
369
  echo "\n<!-- START: Add QuickTag button for Post Snippets -->\n";
386
  * @see wp-includes/js/quicktags.dev.js
387
  * @since Post Snippets 1.7
388
  * @deprecated Since 1.8.6
 
 
389
  */
390
  function add_quicktag_button_pre33() {
391
  echo "\n<!-- START: Post Snippets QuickTag button -->\n";
412
 
413
  /**
414
  * Create the functions for shortcodes dynamically and register them
 
415
  */
416
  function create_shortcodes() {
417
  $snippets = get_option($this->plugin_options);
418
  if (!empty($snippets)) {
419
+ foreach ($snippets as $snippet) {
420
  // If shortcode is enabled for the snippet, and a snippet has been entered, register it as a shortcode.
421
+ if ( $snippet['shortcode'] && !empty($snippet['snippet']) ) {
422
 
423
+ $vars = explode(",",$snippet['vars']);
424
  $vars_str = '';
425
+ foreach ($vars as $var) {
426
+ $vars_str = $vars_str . '"'.$var.'" => "",';
 
427
  }
428
+
429
+ add_shortcode($snippet['title'], create_function('$atts,$content=null',
430
  '$shortcode_symbols = array('.$vars_str.');
431
  extract(shortcode_atts($shortcode_symbols, $atts));
432
 
436
  if ( $content != null )
437
  $attributes["content"] = $content;
438
 
439
+ $snippet = "'. addslashes($snippet["snippet"]) .'";
440
  $snippet = str_replace("&", "&amp;", $snippet);
441
 
442
  foreach ($attributes as $key => $val) {
452
 
453
  /**
454
  * The Admin Page and all it's functions
 
455
  */
456
  function wp_admin() {
457
+ $option_page = add_options_page( 'Post Snippets Options', 'Post Snippets', 'administrator', $this->get_FILE(), array(&$this, 'options_page') );
458
+ if ( $option_page ) {
459
+ $help = new Post_Snippets_Help( $option_page );
460
+ }
461
  }
462
 
463
  function admin_message($message) {
468
  }
469
  }
470
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
471
  function options_page() {
472
  // Add a new Snippet
473
  if (isset($_POST['add-snippet'])) {
488
  if (isset($_POST['update-post-snippets'])) {
489
  $snippets = get_option($this->plugin_options);
490
  if (!empty($snippets)) {
491
+ foreach ($snippets as $key => $value) {
492
+ $new_snippets[$key]['title'] = trim($_POST[$key.'_title']);
493
+ $new_snippets[$key]['vars'] = str_replace(" ", "", trim($_POST[$key.'_vars']) );
494
+ $new_snippets[$key]['shortcode'] = isset($_POST[$key.'_shortcode']) ? true : false;
495
+ $new_snippets[$key]['php'] = isset($_POST[$key.'_php']) ? true : false;
496
+
497
+ $new_snippets[$key]['snippet'] = wp_specialchars_decode( trim(stripslashes($_POST[$key.'_snippet'])), ENT_NOQUOTES);
498
+ $new_snippets[$key]['description'] = wp_specialchars_decode( trim(stripslashes($_POST[$key.'_description'])), ENT_NOQUOTES);
 
 
 
 
 
 
 
 
 
 
499
  }
500
  update_option($this->plugin_options, $new_snippets);
501
  $this->admin_message( __( 'Snippets have been updated.', 'post-snippets' ) );
508
  if (!empty($snippets)) {
509
  $delete = $_POST['checked'];
510
  $newsnippets = array();
511
+ foreach ($snippets as $key => $snippet) {
512
+ if (in_array($key,$delete) == false) {
513
+ array_push($newsnippets,$snippet);
514
  }
515
  }
516
  update_option($this->plugin_options, $newsnippets);
546
  *
547
  * @since Post Snippets 1.8
548
  *
549
+ * @return string URL to the exported snippets
550
  */
551
  function export_snippets() {
552
  if ( isset($_POST['postsnippets_export']) ) {
579
  *
580
  * @since Post Snippets 1.8
581
  *
582
+ * @return string URL to the exported snippets
583
  */
584
  function create_export_file() {
585
  $snippets = serialize(get_option($this->plugin_options));
615
  * @uses wp_handle_upload() in wp-admin/includes/file.php
616
  * @since Post Snippets 1.8
617
  *
618
+ * @return string HTML to handle the import
619
  */
620
  function import_snippets() {
621
  $import = '<br/><br/><strong>'.__( 'Import', 'post-snippets' ).'</strong><br/>';
663
  }
664
  return $import;
665
  }
666
+
667
+ // -------------------------------------------------------------------------
668
+ // Helpers
669
+ // -------------------------------------------------------------------------
670
+
671
+ /**
672
+ * Get __FILE__ with no symlinks.
673
+ *
674
+ * For development purposes mainly. Returns __FILE__ without resolved
675
+ * symlinks to be used when __FILE__ is needed while resolving symlinks
676
+ * breaks WP functionaly, so the actual WordPress path is returned instead.
677
+ * This makes it possible for all WordPress versions to point to the same
678
+ * plugin folder for faster testing of the plugin in different WordPress
679
+ * versions.
680
+ *
681
+ * @since Post Snippets 1.9
682
+ * @return The __FILE__ constant without resolved symlinks.
683
+ */
684
+ private function get_FILE() {
685
+ $dev_path = 'E:\Code\WordPress';
686
+ $result = strpos( __FILE__, $dev_path );
687
+
688
+ if ( $result === false ) {
689
+ return __FILE__;
690
+ } else {
691
+ return str_replace($dev_path, WP_PLUGIN_DIR, __FILE__);
692
+ }
693
+ }
694
  }
695
 
696
 
707
  // Load external classes
708
  if (is_admin()) {
709
  require plugin_dir_path(__FILE__).'classes/settings.php';
710
+ require plugin_dir_path(__FILE__).'classes/help.php';
711
  }
712
 
713
  add_action(
767
  function php_version_error() {
768
  echo '<div class="error"><p><strong>';
769
  printf( __(
770
+ 'Notice:<br/>'.
771
+ 'When Post Snippets v1.9 will be released, the minimum '.
772
+ 'required PHP Version will be %1$s to be on par with WordPress 3.3.'.
773
+ '<br/>'.
774
+ 'Please update your '.
775
+ 'PHP installation before updating Post Snippets to v1.9+, or '.
776
+ 'contact the plugin author to plead your case.<br/>'.
777
+ 'Your installed PHP version: %2$s',
778
  'post-snippets'),
779
  $this->MIN_PHP_VERSION, PHP_VERSION);
780
  echo '</strong></p></div>';
readme.txt CHANGED
@@ -3,10 +3,11 @@ 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.3
7
- Stable tag: 1.8.8
8
 
9
- Store snippets of HTML code or reoccurring text that you often use in your posts. Custom variables can be used.
 
10
 
11
  == Description ==
12
 
@@ -22,7 +23,7 @@ This admin plugin stores snippets of HTML code or reoccurring text that you ofte
22
  * **Import/Export** Snippets can be imported and exported between sites.
23
  * **Uninstall** If you delete the plugin from your plugins panel it cleans up all data it has created in the Wordpress database.
24
 
25
- Related Links:
26
 
27
  * [Documentation](http://wpstorm.net/wordpress-plugins/post-snippets/
28
  "Complete usage instructions")
@@ -34,6 +35,11 @@ See the [Changelog](http://wordpress.org/extend/plugins/post-snippets/changelog/
34
 
35
  == Installation ==
36
 
 
 
 
 
 
37
  = Install =
38
 
39
  1. Upload the 'post-snippets' folder to the '/wp-content/plugins/' directory.
@@ -43,8 +49,10 @@ See the [Changelog](http://wordpress.org/extend/plugins/post-snippets/changelog/
43
  = Uninstall =
44
 
45
  1. Deactivate Post Snippets in the 'Plugins' menu in Wordpress.
46
- 2. Select Post Snippets in the 'Recently Active Plugins' section and select 'Delete' from the 'Bulk Actions' drop down menu.
47
- 3. This will delete all the plugin files from the server as well as erasing all options the plugin has stored in the database.
 
 
48
 
49
  == Frequently Asked Questions ==
50
 
@@ -54,11 +62,15 @@ Upload of zip files must be allowed, enable this in Sites Network Admin -> Setti
54
 
55
  = How can I use the content in an enclosed shortcode? =
56
 
57
- If the shortcode is enclosed and contains content between the tags in a post. Example: [shortcode]Some text[/shortcode] the text within will be availble in a variable called content. So in your snippet use {content} to display it. Don't enter 'content' in the variable field, it's automatically assigned.
 
 
 
58
 
59
  = Where can I get support? =
60
 
61
- Please visit the [Support Forum](http://wordpress.org/tags/post-snippets?forum_id=10 "Use this for support and feature requests") for questions, answers, support and feature requests.
 
62
 
63
  == Screenshots ==
64
 
@@ -68,6 +80,11 @@ Please visit the [Support Forum](http://wordpress.org/tags/post-snippets?forum_i
68
 
69
  == Changelog ==
70
 
 
 
 
 
 
71
  = Version 1.8.8 - 28 Dec 2011 =
72
  * Removed the unneeded QuickTag checkbox from the settings screen for snippets,
73
  as all snippets are now always available from the HTML editor's QuickTag
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.1
7
+ Stable tag: 1.8.9
8
 
9
+ Build a library of snippets with HTML code or reoccurring text that you often
10
+ use in your posts. Custom variables can be used.
11
 
12
  == Description ==
13
 
23
  * **Import/Export** Snippets can be imported and exported between sites.
24
  * **Uninstall** If you delete the plugin from your plugins panel it cleans up all data it has created in the Wordpress database.
25
 
26
+ = Related Links =
27
 
28
  * [Documentation](http://wpstorm.net/wordpress-plugins/post-snippets/
29
  "Complete usage instructions")
35
 
36
  == Installation ==
37
 
38
+ = Requirements =
39
+
40
+ * PHP version 5.2.4 or greater.
41
+ * WordPress version 3.0 or greater.
42
+
43
  = Install =
44
 
45
  1. Upload the 'post-snippets' folder to the '/wp-content/plugins/' directory.
49
  = Uninstall =
50
 
51
  1. Deactivate Post Snippets in the 'Plugins' menu in Wordpress.
52
+ 2. Select Post Snippets in the 'Recently Active Plugins' section and select
53
+ 'Delete' from the 'Bulk Actions' drop down menu.
54
+ 3. This will delete all the plugin files from the server as well as erasing all
55
+ options the plugin has stored in the database.
56
 
57
  == Frequently Asked Questions ==
58
 
62
 
63
  = How can I use the content in an enclosed shortcode? =
64
 
65
+ If the shortcode is enclosed and contains content between the tags in a post.
66
+ Example: `[shortcode]Some text[/shortcode]` the text within will be availble in
67
+ a variable called content. So in your snippet use {content} to display it. Don't
68
+ enter 'content' in the variable field, it's automatically assigned.
69
 
70
  = Where can I get support? =
71
 
72
+ Please visit the [Support Forum](http://wordpress.org/tags/post-snippets?forum_id=10 "Use this for support and feature requests")
73
+ for questions, answers, support and feature requests.
74
 
75
  == Screenshots ==
76
 
80
 
81
  == Changelog ==
82
 
83
+ = Version 1.8.9 - 10 Jan 2012 =
84
+ * Updated the help text to take advantage of the new Help API introduced with
85
+ WordPress 3.3.
86
+ * Updated the Swedish translation.
87
+
88
  = Version 1.8.8 - 28 Dec 2011 =
89
  * Removed the unneeded QuickTag checkbox from the settings screen for snippets,
90
  as all snippets are now always available from the HTML editor's QuickTag