Post Snippets - Version 2.3.6

Version Description

The minimum required PHP version have changed from v5.2.4 to v5.3.0 with this update of Post Snippets to prepare for the next major release.

Most servers should be using PHP v5.3.0 or newer by now, but if you are unsure what PHP version your server is using, please check before updating to this version of the plugin.

Download this release

Release Info

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

Code changes from version 2.3.5 to 2.3.6

lang/post-snippets.pot CHANGED
@@ -8,7 +8,7 @@ msgid ""
8
  msgstr ""
9
  "Project-Id-Version: PACKAGE VERSION\n"
10
  "Report-Msgid-Bugs-To: \n"
11
- "POT-Creation-Date: 2015-01-18 16:54+0700\n"
12
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
  "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -23,40 +23,40 @@ msgid "Title"
23
  msgstr ""
24
 
25
  #: views/admin_snippets.php:9 views/admin_snippets.php:18
26
- #: views/help/usage.php:10 src/PostSnippets/Admin.php:379
27
  msgid "Variables"
28
  msgstr ""
29
 
30
  #: views/admin_snippets.php:10 views/admin_snippets.php:19
31
- #: views/help/usage.php:21 src/PostSnippets/Admin.php:398
32
  msgid "Snippet"
33
  msgstr ""
34
 
35
- #: views/admin_snippets.php:39 views/help/usage.php:41
36
  msgid "Shortcode"
37
  msgstr ""
38
 
39
- #: views/admin_snippets.php:46 views/help/usage.php:54
40
  msgid "PHP Code"
41
  msgstr ""
42
 
43
- #: views/admin_snippets.php:58 views/help/usage.php:35
44
  msgid "Description"
45
  msgstr ""
46
 
47
- #: views/admin_snippets.php:70
48
  msgid "Update Snippets"
49
  msgstr ""
50
 
51
- #: views/admin_snippets.php:71
52
  msgid "Add New Snippet"
53
  msgstr ""
54
 
55
- #: views/admin_snippets.php:72
56
  msgid "Delete Selected"
57
  msgstr ""
58
 
59
- #: views/jquery-ui-dialog.php:47
60
  msgid "This snippet is insert only, no variables defined."
61
  msgstr ""
62
 
@@ -74,7 +74,8 @@ msgid ""
74
  "by using the PostSnippets::getSnippet() method."
75
  msgstr ""
76
 
77
- #: views/help/advanced.php:18 src/PostSnippets/Help.php:50
 
78
  msgid "Usage"
79
  msgstr ""
80
 
@@ -156,7 +157,7 @@ msgid ""
156
  "be wrapped in &lt;?php #code; ?&gt;."
157
  msgstr ""
158
 
159
- #: views/help/post.php:1 views/help/usage.php:1
160
  msgid "The Post Editor"
161
  msgstr ""
162
 
@@ -193,6 +194,76 @@ msgstr ""
193
  msgid "Donate"
194
  msgstr ""
195
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
196
  #: views/help/usage.php:6
197
  msgid ""
198
  "Give the snippet a title that helps you identify it in the post editor. This "
@@ -332,7 +403,7 @@ msgstr ""
332
  msgid "Update"
333
  msgstr ""
334
 
335
- #: src/PostSnippets/Admin.php:395
336
  msgid "Options"
337
  msgstr ""
338
 
8
  msgstr ""
9
  "Project-Id-Version: PACKAGE VERSION\n"
10
  "Report-Msgid-Bugs-To: \n"
11
+ "POT-Creation-Date: 2015-07-15 09:31+0000\n"
12
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
  "Language-Team: LANGUAGE <LL@li.org>\n"
23
  msgstr ""
24
 
25
  #: views/admin_snippets.php:9 views/admin_snippets.php:18
26
+ #: views/help/usage.php:10 src/PostSnippets/Admin.php:378
27
  msgid "Variables"
28
  msgstr ""
29
 
30
  #: views/admin_snippets.php:10 views/admin_snippets.php:19
31
+ #: views/help/usage.php:21 src/PostSnippets/Admin.php:397
32
  msgid "Snippet"
33
  msgstr ""
34
 
35
+ #: views/admin_snippets.php:44 views/help/usage.php:41
36
  msgid "Shortcode"
37
  msgstr ""
38
 
39
+ #: views/admin_snippets.php:51 views/help/usage.php:54
40
  msgid "PHP Code"
41
  msgstr ""
42
 
43
+ #: views/admin_snippets.php:65 views/help/usage.php:35
44
  msgid "Description"
45
  msgstr ""
46
 
47
+ #: views/admin_snippets.php:82
48
  msgid "Update Snippets"
49
  msgstr ""
50
 
51
+ #: views/admin_snippets.php:83
52
  msgid "Add New Snippet"
53
  msgstr ""
54
 
55
+ #: views/admin_snippets.php:84
56
  msgid "Delete Selected"
57
  msgstr ""
58
 
59
+ #: views/jquery-ui-dialog.php:64
60
  msgid "This snippet is insert only, no variables defined."
61
  msgstr ""
62
 
74
  "by using the PostSnippets::getSnippet() method."
75
  msgstr ""
76
 
77
+ #: views/help/advanced.php:18 views/help/usage.php:1
78
+ #: src/PostSnippets/Help.php:50
79
  msgid "Usage"
80
  msgstr ""
81
 
157
  "be wrapped in &lt;?php #code; ?&gt;."
158
  msgstr ""
159
 
160
+ #: views/help/post.php:1
161
  msgid "The Post Editor"
162
  msgstr ""
163
 
194
  msgid "Donate"
195
  msgstr ""
196
 
197
+ #: views/help/translators.php:1 src/PostSnippets/Help.php:87
198
+ msgid "Translators"
199
+ msgstr ""
200
+
201
+ #: views/help/translators.php:3
202
+ msgid ""
203
+ "Other than the default English language, Post Snippets has been translated "
204
+ "to the following languages by these great people:"
205
+ msgstr ""
206
+
207
+ #: views/help/translators.php:19
208
+ msgid "by"
209
+ msgstr ""
210
+
211
+ #: views/help/translators.php:22
212
+ msgid "Belarusian"
213
+ msgstr ""
214
+
215
+ #: views/help/translators.php:23
216
+ msgid "French"
217
+ msgstr ""
218
+
219
+ #: views/help/translators.php:24
220
+ msgid "German"
221
+ msgstr ""
222
+
223
+ #: views/help/translators.php:25
224
+ msgid "Hebrew"
225
+ msgstr ""
226
+
227
+ #: views/help/translators.php:26
228
+ msgid "Lithuanian"
229
+ msgstr ""
230
+
231
+ #: views/help/translators.php:27
232
+ msgid "Polish"
233
+ msgstr ""
234
+
235
+ #: views/help/translators.php:28
236
+ msgid "Romanian"
237
+ msgstr ""
238
+
239
+ #: views/help/translators.php:29
240
+ msgid "Russian"
241
+ msgstr ""
242
+
243
+ #: views/help/translators.php:30
244
+ msgid "Slovak"
245
+ msgstr ""
246
+
247
+ #: views/help/translators.php:31
248
+ msgid "Serbo-Croatian"
249
+ msgstr ""
250
+
251
+ #: views/help/translators.php:32
252
+ msgid "Spanish"
253
+ msgstr ""
254
+
255
+ #: views/help/translators.php:33
256
+ msgid "Swedish"
257
+ msgstr ""
258
+
259
+ #: views/help/translators.php:34
260
+ msgid "Turkish"
261
+ msgstr ""
262
+
263
+ #: views/help/translators.php:35
264
+ msgid "Ukrainian"
265
+ msgstr ""
266
+
267
  #: views/help/usage.php:6
268
  msgid ""
269
  "Give the snippet a title that helps you identify it in the post editor. This "
403
  msgid "Update"
404
  msgstr ""
405
 
406
+ #: src/PostSnippets/Admin.php:394
407
  msgid "Options"
408
  msgstr ""
409
 
post-snippets.php CHANGED
@@ -5,7 +5,7 @@ Plugin URI: http://johansteen.se/code/post-snippets/
5
  Description: Build a library with snippets of HTML, PHP code or reoccurring text that you often use in your posts. Variables to replace parts of the snippet on insert can be used. The snippets can be inserted as-is or as shortcodes.
6
  Author: Johan Steen
7
  Author URI: http://johansteen.se/
8
- Version: 2.3.5
9
  License: GPLv2 or later
10
  Text Domain: post-snippets
11
 
@@ -41,7 +41,7 @@ class PostSnippets
41
  private static $instance = false;
42
 
43
  /** Define plugin constants */
44
- const MIN_PHP_VERSION = '5.2.4';
45
  const MIN_WP_VERSION = '3.3';
46
  const OPTION_KEY = 'post_snippets_options';
47
  const USER_META_KEY = 'post_snippets';
5
  Description: Build a library with snippets of HTML, PHP code or reoccurring text that you often use in your posts. Variables to replace parts of the snippet on insert can be used. The snippets can be inserted as-is or as shortcodes.
6
  Author: Johan Steen
7
  Author URI: http://johansteen.se/
8
+ Version: 2.3.6
9
  License: GPLv2 or later
10
  Text Domain: post-snippets
11
 
41
  private static $instance = false;
42
 
43
  /** Define plugin constants */
44
+ const MIN_PHP_VERSION = '5.3.0';
45
  const MIN_WP_VERSION = '3.3';
46
  const OPTION_KEY = 'post_snippets_options';
47
  const USER_META_KEY = 'post_snippets';
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: artstorm
3
  Donate link: http://johansteen.se/donate/
4
  Tags: post, admin, snippet, shortcode, html, custom, page, dynamic, editor, php, code
5
  Requires at least: 3.3
6
- Tested up to: 4.1
7
- Stable tag: 2.3.5
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -33,13 +33,15 @@ updating the snippet. PHP code is supported for snippets inserted as shortcodes.
33
  * **Variables** Each snippet can have as many custom variables as you like,
34
  which can be used on insert.
35
  * **Import/Export** Snippets can be imported and exported between sites.
 
 
36
  * **Uninstall** If you delete the plugin from your plugins panel it cleans up
37
  all data it has created in the Wordpress database.
38
 
39
  = Related Links =
40
 
41
- * [Documentation](http://johansteen.se/code/post-snippets/
42
- "Usage instructions")
43
  * [Support Forum](http://wordpress.org/support/plugin/post-snippets
44
  "Use this for support and feature requests")
45
  * [GitHub](https://github.com/artstorm/post-snippets
@@ -50,7 +52,7 @@ updating the snippet. PHP code is supported for snippets inserted as shortcodes.
50
 
51
  = Requirements =
52
 
53
- * PHP version 5.2.4 or greater.
54
  * WordPress version 3.3 or greater.
55
 
56
  = Install =
@@ -69,6 +71,11 @@ updating the snippet. PHP code is supported for snippets inserted as shortcodes.
69
 
70
  == Frequently Asked Questions ==
71
 
 
 
 
 
 
72
  = Why do importing Snippets on a multi site install fail? =
73
 
74
  Upload of zip files must be allowed, enable this in Sites Network Admin ->
@@ -121,6 +128,10 @@ Contributions are appreciated and encouraged.
121
 
122
  == Changelog ==
123
 
 
 
 
 
124
  = Version 2.3.5 - 18 Jan 2015 =
125
  * Adds new developer filter, `post_snippets_snippets_list`.
126
  * Integrates plugin doc to the post editor help tab.
@@ -471,3 +482,11 @@ in version 2.1. In this update it is now completely removed. Please update any
471
  code you might have that uses this function to use `PostSnippets::getSnippet()` instead, which replaces the deprecated function.
472
 
473
  Most users are not affected by this change.
 
 
 
 
 
 
 
 
3
  Donate link: http://johansteen.se/donate/
4
  Tags: post, admin, snippet, shortcode, html, custom, page, dynamic, editor, php, code
5
  Requires at least: 3.3
6
+ Tested up to: 4.2.2
7
+ Stable tag: 2.3.6
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
33
  * **Variables** Each snippet can have as many custom variables as you like,
34
  which can be used on insert.
35
  * **Import/Export** Snippets can be imported and exported between sites.
36
+ * **Documentation** Full documentation is available directly from the help panel
37
+ in the plugin administration screen.
38
  * **Uninstall** If you delete the plugin from your plugins panel it cleans up
39
  all data it has created in the Wordpress database.
40
 
41
  = Related Links =
42
 
43
+ * [Plugin Page](http://johansteen.se/code/post-snippets/
44
+ "Post snippets plugin page")
45
  * [Support Forum](http://wordpress.org/support/plugin/post-snippets
46
  "Use this for support and feature requests")
47
  * [GitHub](https://github.com/artstorm/post-snippets
52
 
53
  = Requirements =
54
 
55
+ * PHP version 5.3.0 or greater.
56
  * WordPress version 3.3 or greater.
57
 
58
  = Install =
71
 
72
  == Frequently Asked Questions ==
73
 
74
+ = Where can I find usage and developer information? =
75
+
76
+ Documentation for the plugin is available directly from the help panel in the
77
+ plugin administration screen.
78
+
79
  = Why do importing Snippets on a multi site install fail? =
80
 
81
  Upload of zip files must be allowed, enable this in Sites Network Admin ->
128
 
129
  == Changelog ==
130
 
131
+ = Version 2.3.6 - 15 Jul 2015 =
132
+ * Bumps minimum required PHP version to 5.3.0.
133
+ * Adds list of translators to inline documentation.
134
+
135
  = Version 2.3.5 - 18 Jan 2015 =
136
  * Adds new developer filter, `post_snippets_snippets_list`.
137
  * Integrates plugin doc to the post editor help tab.
482
  code you might have that uses this function to use `PostSnippets::getSnippet()` instead, which replaces the deprecated function.
483
 
484
  Most users are not affected by this change.
485
+
486
+ = 2.3.6 =
487
+ The minimum required PHP version have changed from v5.2.4 to v5.3.0 with this
488
+ update of Post Snippets to prepare for the next major release.
489
+
490
+ Most servers should be using PHP v5.3.0 or newer by now, but if you are unsure
491
+ what PHP version your server is using, please check before updating to this
492
+ version of the plugin.
src/PostSnippets/Admin.php CHANGED
@@ -214,7 +214,7 @@ class PostSnippets_Admin
214
  && wp_verify_nonce($_POST['post_snippets_user_nonce'], 'post_snippets_user_options')
215
  ) {
216
  $id = get_current_user_id();
217
- $render = isset( $_POST['render'] ) ? true : false;
218
  update_user_meta($id, PostSnippets::USER_META_KEY, $render);
219
  }
220
  }
@@ -274,12 +274,12 @@ class PostSnippets_Admin
274
  ';
275
 
276
  // Tabs
277
- $active_tab = isset( $_GET[ 'tab' ] ) ? $_GET[ 'tab' ] : 'snippets';
278
  $base_url = '?page=post-snippets/post-snippets.php&amp;tab=';
279
  $tabs = array('snippets' => __('Manage Snippets', PostSnippets::TEXT_DOMAIN), 'tools' => __('Import/Export', PostSnippets::TEXT_DOMAIN));
280
  echo '<h2 class="nav-tab-wrapper">';
281
  foreach ($tabs as $tab => $title) {
282
- $active = ( $active_tab == $tab ) ? ' nav-tab-active' : '';
283
  echo "<a href='{$base_url}{$tab}' class='nav-tab {$active}'>{$title}</a>";
284
  }
285
  echo '</h2>';
@@ -366,7 +366,6 @@ class PostSnippets_Admin
366
  $snippets = get_option(PostSnippets::OPTION_KEY);
367
  if (!empty($snippets)) {
368
  foreach ($snippets as $key => $snippet) {
369
-
370
  echo "<hr style='border: none;border-top:1px dashed #aaa; margin:24px 0;' />";
371
 
372
  echo "<h3>{$snippet['title']}";
214
  && wp_verify_nonce($_POST['post_snippets_user_nonce'], 'post_snippets_user_options')
215
  ) {
216
  $id = get_current_user_id();
217
+ $render = isset($_POST['render']) ? true : false;
218
  update_user_meta($id, PostSnippets::USER_META_KEY, $render);
219
  }
220
  }
274
  ';
275
 
276
  // Tabs
277
+ $active_tab = isset($_GET[ 'tab' ]) ? $_GET[ 'tab' ] : 'snippets';
278
  $base_url = '?page=post-snippets/post-snippets.php&amp;tab=';
279
  $tabs = array('snippets' => __('Manage Snippets', PostSnippets::TEXT_DOMAIN), 'tools' => __('Import/Export', PostSnippets::TEXT_DOMAIN));
280
  echo '<h2 class="nav-tab-wrapper">';
281
  foreach ($tabs as $tab => $title) {
282
+ $active = ($active_tab == $tab) ? ' nav-tab-active' : '';
283
  echo "<a href='{$base_url}{$tab}' class='nav-tab {$active}'>{$title}</a>";
284
  }
285
  echo '</h2>';
366
  $snippets = get_option(PostSnippets::OPTION_KEY);
367
  if (!empty($snippets)) {
368
  foreach ($snippets as $key => $snippet) {
 
369
  echo "<hr style='border: none;border-top:1px dashed #aaa; margin:24px 0;' />";
370
 
371
  echo "<h3>{$snippet['title']}";
src/PostSnippets/Help.php CHANGED
@@ -15,10 +15,10 @@ class PostSnippets_Help
15
  */
16
  public function __construct($optionPage)
17
  {
18
- add_action('load-'.$optionPage, array(&$this,'tabs'));
19
 
20
- add_action('load-post.php', array(&$this,'postEditor'));
21
- add_action('load-post-new.php', array(&$this,'postEditor'));
22
  }
23
 
24
  /**
@@ -32,7 +32,7 @@ class PostSnippets_Help
32
  */
33
  public function postEditor()
34
  {
35
- add_action('admin_head', array(&$this,'postEditorTabs'));
36
  }
37
 
38
  /**
@@ -81,6 +81,13 @@ class PostSnippets_Help
81
  'content' => $this->content('help/filters')
82
  )
83
  );
 
 
 
 
 
 
 
84
  }
85
 
86
  /**
15
  */
16
  public function __construct($optionPage)
17
  {
18
+ add_action('load-'.$optionPage, array(&$this, 'tabs'));
19
 
20
+ add_action('load-post.php', array(&$this, 'postEditor'));
21
+ add_action('load-post-new.php', array(&$this, 'postEditor'));
22
  }
23
 
24
  /**
32
  */
33
  public function postEditor()
34
  {
35
+ add_action('admin_head', array(&$this, 'postEditorTabs'));
36
  }
37
 
38
  /**
81
  'content' => $this->content('help/filters')
82
  )
83
  );
84
+ $screen->add_help_tab(
85
+ array(
86
+ 'id' => 'translators-plugin-help',
87
+ 'title' => __('Translators', PostSnippets::TEXT_DOMAIN),
88
+ 'content' => $this->content('help/translators')
89
+ )
90
+ );
91
  }
92
 
93
  /**
src/PostSnippets/Shortcode.php CHANGED
@@ -22,7 +22,6 @@ class PostSnippets_Shortcode
22
  foreach ($snippets as $snippet) {
23
  // If shortcode is enabled for the snippet, and a snippet has been entered, register it as a shortcode.
24
  if ($snippet['shortcode'] && !empty($snippet['snippet'])) {
25
-
26
  $vars = explode(",", $snippet['vars']);
27
  $vars_str = "";
28
  foreach ($vars as $var) {
@@ -32,7 +31,7 @@ class PostSnippets_Shortcode
32
  }
33
 
34
  // Get the wptexturize setting
35
- $texturize = isset( $snippet["wptexturize"] ) ? $snippet["wptexturize"] : false;
36
 
37
  add_shortcode(
38
  $snippet['title'],
@@ -95,7 +94,7 @@ class PostSnippets_Shortcode
95
  $content = stripslashes($content);
96
 
97
  ob_start();
98
- eval ($content);
99
  $content = ob_get_clean();
100
 
101
  return addslashes($content);
22
  foreach ($snippets as $snippet) {
23
  // If shortcode is enabled for the snippet, and a snippet has been entered, register it as a shortcode.
24
  if ($snippet['shortcode'] && !empty($snippet['snippet'])) {
 
25
  $vars = explode(",", $snippet['vars']);
26
  $vars_str = "";
27
  foreach ($vars as $var) {
31
  }
32
 
33
  // Get the wptexturize setting
34
+ $texturize = isset($snippet["wptexturize"]) ? $snippet["wptexturize"] : false;
35
 
36
  add_shortcode(
37
  $snippet['title'],
94
  $content = stripslashes($content);
95
 
96
  ob_start();
97
+ eval($content);
98
  $content = ob_get_clean();
99
 
100
  return addslashes($content);
src/PostSnippets/WPEditor.php CHANGED
@@ -18,16 +18,16 @@ class PostSnippets_WPEditor
18
  // Add Editor QuickTag button:
19
  add_action(
20
  'admin_print_footer_scripts',
21
- array(&$this,'addQuicktagButton'),
22
  100
23
  );
24
 
25
- add_action('admin_head', array(&$this,'jqueryUiDialog'));
26
- add_action('admin_footer', array(&$this,'addJqueryUiDialog'));
27
 
28
  // Adds the JS and HTML code in the header and footer for the jQuery
29
  // insert UI dialog in the editor
30
- add_action('admin_init', array(&$this,'enqueueAssets'));
31
  }
32
 
33
 
@@ -232,29 +232,35 @@ class PostSnippets_WPEditor
232
  $(this).dialog("close");
233
  <?php
234
  global $wp_version;
235
- if (version_compare($wp_version, '3.5', '<')) {
236
- ?>
237
  var selected = tabs.tabs('option', 'selected');
238
  <?php
239
- } else {
240
- ?>
 
241
  var selected = tabs.tabs('option', 'active');
242
  <?php
243
- }
244
- ?>
 
245
  <?php
246
  foreach ($snippets as $key => $snippet) {
247
- ?>
248
- if (selected == <?php echo $key; ?>) {
249
- insert_snippet = postsnippet_<?php echo $key; ?>;
 
 
250
  <?php
251
  $var_arr = explode(",", $snippet['vars']);
252
  if (!empty($var_arr[0])) {
253
  foreach ($var_arr as $key_2 => $var) {
254
- $varname = "var_" . $key . "_" . $key_2; ?>
 
255
  insert_snippet = insert_snippet.replace(/\{<?php
256
  echo $this->stripDefaultVal($var);
257
- ?>\}/g, <?php echo $varname; ?>.val());
 
258
  <?php
259
  echo "\n";
260
  }
@@ -262,6 +268,7 @@ class PostSnippets_WPEditor
262
  ?>
263
  }
264
  <?php
 
265
  }
266
  ?>
267
 
18
  // Add Editor QuickTag button:
19
  add_action(
20
  'admin_print_footer_scripts',
21
+ array(&$this, 'addQuicktagButton'),
22
  100
23
  );
24
 
25
+ add_action('admin_head', array(&$this, 'jqueryUiDialog'));
26
+ add_action('admin_footer', array(&$this, 'addJqueryUiDialog'));
27
 
28
  // Adds the JS and HTML code in the header and footer for the jQuery
29
  // insert UI dialog in the editor
30
+ add_action('admin_init', array(&$this, 'enqueueAssets'));
31
  }
32
 
33
 
232
  $(this).dialog("close");
233
  <?php
234
  global $wp_version;
235
+ if (version_compare($wp_version, '3.5', '<')) {
236
+ ?>
237
  var selected = tabs.tabs('option', 'selected');
238
  <?php
239
+
240
+ } else {
241
+ ?>
242
  var selected = tabs.tabs('option', 'active');
243
  <?php
244
+
245
+ }
246
+ ?>
247
  <?php
248
  foreach ($snippets as $key => $snippet) {
249
+ ?>
250
+ if (selected == <?php echo $key;
251
+ ?>) {
252
+ insert_snippet = postsnippet_<?php echo $key;
253
+ ?>;
254
  <?php
255
  $var_arr = explode(",", $snippet['vars']);
256
  if (!empty($var_arr[0])) {
257
  foreach ($var_arr as $key_2 => $var) {
258
+ $varname = "var_" . $key . "_" . $key_2;
259
+ ?>
260
  insert_snippet = insert_snippet.replace(/\{<?php
261
  echo $this->stripDefaultVal($var);
262
+ ?>\}/g, <?php echo $varname;
263
+ ?>.val());
264
  <?php
265
  echo "\n";
266
  }
268
  ?>
269
  }
270
  <?php
271
+
272
  }
273
  ?>
274
 
views/admin_snippets.php CHANGED
@@ -27,19 +27,24 @@ if (!empty($snippets)) {
27
  foreach ($snippets as $key => $snippet) {
28
  ?>
29
  <tr class='recent'>
30
- <th scope='row' class='check-column'><input type='checkbox' name='checked[]' value='<?php echo $key; ?>' /></th>
 
31
  <td class='row-title'>
32
- <input type='text' name='<?php echo $key; ?>_title' value='<?php echo $snippet['title']; ?>' />
 
 
33
  </td>
34
  <td class='name'>
35
- <input type='text' name='<?php echo $key; ?>_vars' value='<?php echo $snippet['vars']; ?>' />
 
 
36
  <br/>
37
  <br/>
38
  <?php
39
  PostSnippets_Admin::checkbox(__('Shortcode', PostSnippets::TEXT_DOMAIN), $key.'_shortcode',
40
  $snippet['shortcode']);
41
 
42
- echo '<br/><strong>Shortcode Options:</strong><br/>';
43
 
44
  if (!defined('POST_SNIPPETS_DISABLE_PHP')) {
45
  PostSnippets_Admin::checkbox(
@@ -49,19 +54,26 @@ if (!empty($snippets)) {
49
  );
50
  }
51
 
52
- $wptexturize = isset( $snippet['wptexturize'] ) ? $snippet['wptexturize'] : false;
53
- PostSnippets_Admin::checkbox('wptexturize', $key.'_wptexturize', $wptexturize);
54
- ?>
55
  </td>
56
  <td class='desc'>
57
- <textarea name="<?php echo $key; ?>_snippet" class="large-text" style='width: 100%;' rows="5"><?php echo htmlspecialchars($snippet['snippet'], ENT_NOQUOTES); ?></textarea>
58
- <?php _e( 'Description', PostSnippets::TEXT_DOMAIN ) ?>:
59
- <input type='text' style='width: 100%;' name='<?php echo $key; ?>_description' value='<?php if (isset( $snippet['description'] ) ) echo esc_html($snippet['description']); ?>' /><br/>
 
 
 
 
 
 
60
  </td>
61
  </tr>
62
  <?php
63
- }
64
- }
 
65
  ?>
66
  </tbody>
67
  </table>
@@ -70,4 +82,4 @@ if (!empty($snippets)) {
70
  PostSnippets_Admin::submit('update-snippets', __('Update Snippets', PostSnippets::TEXT_DOMAIN));
71
  PostSnippets_Admin::submit('add-snippet', __('Add New Snippet', PostSnippets::TEXT_DOMAIN), 'button-secondary', false);
72
  PostSnippets_Admin::submit('delete-snippets', __('Delete Selected', PostSnippets::TEXT_DOMAIN), 'button-secondary', false);
73
- echo '</form>';
27
  foreach ($snippets as $key => $snippet) {
28
  ?>
29
  <tr class='recent'>
30
+ <th scope='row' class='check-column'><input type='checkbox' name='checked[]' value='<?php echo $key;
31
+ ?>' /></th>
32
  <td class='row-title'>
33
+ <input type='text' name='<?php echo $key;
34
+ ?>_title' value='<?php echo $snippet['title'];
35
+ ?>' />
36
  </td>
37
  <td class='name'>
38
+ <input type='text' name='<?php echo $key;
39
+ ?>_vars' value='<?php echo $snippet['vars'];
40
+ ?>' />
41
  <br/>
42
  <br/>
43
  <?php
44
  PostSnippets_Admin::checkbox(__('Shortcode', PostSnippets::TEXT_DOMAIN), $key.'_shortcode',
45
  $snippet['shortcode']);
46
 
47
+ echo '<br/><strong>Shortcode Options:</strong><br/>';
48
 
49
  if (!defined('POST_SNIPPETS_DISABLE_PHP')) {
50
  PostSnippets_Admin::checkbox(
54
  );
55
  }
56
 
57
+ $wptexturize = isset($snippet['wptexturize']) ? $snippet['wptexturize'] : false;
58
+ PostSnippets_Admin::checkbox('wptexturize', $key.'_wptexturize', $wptexturize);
59
+ ?>
60
  </td>
61
  <td class='desc'>
62
+ <textarea name="<?php echo $key;
63
+ ?>_snippet" class="large-text" style='width: 100%;' rows="5"><?php echo htmlspecialchars($snippet['snippet'], ENT_NOQUOTES);
64
+ ?></textarea>
65
+ <?php _e('Description', PostSnippets::TEXT_DOMAIN) ?>:
66
+ <input type='text' style='width: 100%;' name='<?php echo $key;
67
+ ?>_description' value='<?php if (isset($snippet['description'])) {
68
+ echo esc_html($snippet['description']);
69
+ }
70
+ ?>' /><br/>
71
  </td>
72
  </tr>
73
  <?php
74
+
75
+ }
76
+ }
77
  ?>
78
  </tbody>
79
  </table>
82
  PostSnippets_Admin::submit('update-snippets', __('Update Snippets', PostSnippets::TEXT_DOMAIN));
83
  PostSnippets_Admin::submit('add-snippet', __('Add New Snippet', PostSnippets::TEXT_DOMAIN), 'button-secondary', false);
84
  PostSnippets_Admin::submit('delete-snippets', __('Delete Selected', PostSnippets::TEXT_DOMAIN), 'button-secondary', false);
85
+ echo '</form>';
views/help/translators.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <h2><?php _e('Translators', $td); ?></h2>
2
+
3
+ <p><?php _e('Other than the default English language, Post Snippets has been translated to the following languages by these great people:', $td); ?></p>
4
+
5
+ <ul>
6
+ <?php
7
+ /**
8
+ * Output a translator list item.
9
+ *
10
+ * @param string $country
11
+ * @param string $countryCode
12
+ * @param string $url
13
+ * @param string $name
14
+ * @param string $note
15
+ */
16
+ function postsnippetTranslator($country, $countryCode, $url, $name, $note = '')
17
+ {
18
+ global $td;
19
+ printf('<li>%s (%s) %s <a href="%s">%s</a>%s.</li>', $country, $countryCode, __('by', $td), $url, $name, $note);
20
+ }
21
+
22
+ postsnippetTranslator(__('Belarusian', $td), 'be_BY', 'http://webhostinggeeks.com/science/', 'Alexander Ovsov');
23
+ postsnippetTranslator(__('French', $td), 'fr_FR', 'http://www.oyabi.fr/', 'Thomas Cailhe (Oyabi)');
24
+ postsnippetTranslator(__('German', $td), 'de_DE', 'http://www.inmotionhosting.com/', 'Brian Flores');
25
+ postsnippetTranslator(__('Hebrew', $td), 'he_IL', 'http://www.sagive.co.il/', 'Sagive');
26
+ postsnippetTranslator(__('Lithuanian', $td), 'lt_LT', 'http://www.webhostinghub.com/', 'Nata Strazda');
27
+ postsnippetTranslator(__('Polish', $td), 'pl_PL', 'http://ittw.pl/', 'Tomasz Wesołowski');
28
+ postsnippetTranslator(__('Romanian', $td), 'ro_RO', 'http://webhostinggeeks.com/', 'Web Hosting Geeks');
29
+ postsnippetTranslator(__('Russian', $td), 'ru_RU', 'http://www.fatcow.com/', 'FatCow');
30
+ postsnippetTranslator(__('Slovak', $td), 'sk_SK', 'http://webhostinggeeks.com/blog/', 'Branco Radenovich');
31
+ postsnippetTranslator(__('Serbo-Croatian', $td), 'sr_RS', 'http://www.webhostinghub.com/', 'Borisa Djuraskovic');
32
+ postsnippetTranslator(__('Spanish', $td), 'es_ES', 'http://www.soludata.net/site/', 'Melvis E. Leon Lopez');
33
+ postsnippetTranslator(__('Swedish', $td), 'sv_SE', 'http://johansteen.se/', 'Johan Steen', ' (Plugin author)');
34
+ postsnippetTranslator(__('Turkish', $td), 'tr_TR', 'http://www.tml.web.tr/', 'Ersan Özdil');
35
+ postsnippetTranslator(__('Ukrainian', $td), 'uk_UA', 'http://getvoip.com/', 'Michael Yunat');
36
+ ?>
views/help/usage.php CHANGED
@@ -1,4 +1,4 @@
1
- <h2><?php _e('The Post Editor', $td); ?></h2>
2
 
3
 
4
  <h3><?php _e('Title', $td); ?></h3>
1
+ <h2><?php _e('Usage', $td); ?></h2>
2
 
3
 
4
  <h3><?php _e('Title', $td); ?></h3>
views/jquery-ui-dialog.php CHANGED
@@ -7,20 +7,29 @@
7
  <ul>
8
  <?php
9
  // Create a tab for each available snippet
10
- foreach ($snippets as $key => $snippet) { ?>
11
- <li><a href="#ps-tabs-<?php echo $key; ?>"><?php echo $snippet['title']; ?></a></li>
12
- <?php } ?>
 
 
 
 
13
  </ul>
14
 
15
  <?php
16
  // Create a panel with form fields for each available snippet
17
- foreach ($snippets as $key => $snippet) { ?>
18
- <div id="ps-tabs-<?php echo $key; ?>">
 
 
19
  <?php
20
  // Print a snippet description is available
21
- if (isset($snippet['description'])) { ?>
22
- <p class="howto"><?php echo $snippet['description']; ?></p>
23
- <?php }
 
 
 
24
 
25
  // Get all variables defined for the snippet and output them as
26
  // input fields
@@ -35,20 +44,33 @@
35
  $def = $split[1];
36
  } else {
37
  $def = '';
38
- } ?>
39
- <label for="var_<?php echo $key.'_'.$key_2; ?>"><?php echo $var; ?>:</label>
40
- <input type="text" id="var_<?php echo $key.'_'.$key_2; ?>" name="var_<?php echo $key.'_'.$key_2; ?>" value="<?php echo $def; ?>" style="width: 190px" />
 
 
 
 
 
 
41
  <br/>
42
- <?php }
 
43
  } else {
44
  // If no variables and no description available, output a text
45
  // to inform the user that it's an insert snippet only.
46
- if (empty($snippet['description'])) { ?>
47
- <p class="howto"><?php _e('This snippet is insert only, no variables defined.', PostSnippets::TEXT_DOMAIN); ?></p>
48
- <?php }
49
- } ?>
50
- </div><!-- #ps-tabs-<?php echo $key; ?> -->
51
- <?php }
 
 
 
 
 
 
52
  // Close the tabs and dialog divs ?>
53
  </div><!-- #post-snippets-tabs -->
54
  </div><!-- #post-snippets-dialog -->
7
  <ul>
8
  <?php
9
  // Create a tab for each available snippet
10
+ foreach ($snippets as $key => $snippet) {
11
+ ?>
12
+ <li><a href="#ps-tabs-<?php echo $key;
13
+ ?>"><?php echo $snippet['title'];
14
+ ?></a></li>
15
+ <?php
16
+ } ?>
17
  </ul>
18
 
19
  <?php
20
  // Create a panel with form fields for each available snippet
21
+ foreach ($snippets as $key => $snippet) {
22
+ ?>
23
+ <div id="ps-tabs-<?php echo $key;
24
+ ?>">
25
  <?php
26
  // Print a snippet description is available
27
+ if (isset($snippet['description'])) {
28
+ ?>
29
+ <p class="howto"><?php echo $snippet['description'];
30
+ ?></p>
31
+ <?php
32
+ }
33
 
34
  // Get all variables defined for the snippet and output them as
35
  // input fields
44
  $def = $split[1];
45
  } else {
46
  $def = '';
47
+ }
48
+ ?>
49
+ <label for="var_<?php echo $key.'_'.$key_2;
50
+ ?>"><?php echo $var;
51
+ ?>:</label>
52
+ <input type="text" id="var_<?php echo $key.'_'.$key_2;
53
+ ?>" name="var_<?php echo $key.'_'.$key_2;
54
+ ?>" value="<?php echo $def;
55
+ ?>" style="width: 190px" />
56
  <br/>
57
+ <?php
58
+ }
59
  } else {
60
  // If no variables and no description available, output a text
61
  // to inform the user that it's an insert snippet only.
62
+ if (empty($snippet['description'])) {
63
+ ?>
64
+ <p class="howto"><?php _e('This snippet is insert only, no variables defined.', PostSnippets::TEXT_DOMAIN);
65
+ ?></p>
66
+ <?php
67
+ }
68
+ }
69
+ ?>
70
+ </div><!-- #ps-tabs-<?php echo $key;
71
+ ?> -->
72
+ <?php
73
+ }
74
  // Close the tabs and dialog divs ?>
75
  </div><!-- #post-snippets-tabs -->
76
  </div><!-- #post-snippets-dialog -->