Version Description
Download this release
Release Info
Developer | artstorm |
Plugin | Post Snippets |
Version | 2.3.7 |
Comparing to | |
See all releases |
Code changes from version 2.3.6 to 2.3.7
- lang/post-snippets-ru_RU.mo +0 -0
- lang/post-snippets-ru_RU.po +15 -19
- post-snippets.php +8 -22
- readme.txt +4 -1
- src/PostSnippets/Admin.php +17 -17
- src/PostSnippets/Help.php +6 -16
- src/PostSnippets/ImportExport.php +13 -13
- tinymce/editor_plugin.js +2 -2
- views/admin_snippets.php +15 -15
- views/help/advanced.php +7 -7
- views/help/filters.php +6 -6
- views/help/php.php +5 -5
- views/help/post.php +3 -3
- views/help/sidebar.php +4 -4
- views/help/translators.php +0 -36
- views/help/usage.php +21 -21
- views/jquery-ui-dialog.php +11 -6
lang/post-snippets-ru_RU.mo
CHANGED
Binary file
|
lang/post-snippets-ru_RU.po
CHANGED
@@ -7,15 +7,15 @@ 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:
|
11 |
"Last-Translator: Fat Cow <zhr@tut.by>\n"
|
12 |
"Language-Team: Fat Cow <zhr@tut.by>\n"
|
13 |
"MIME-Version: 1.0\n"
|
14 |
"Content-Type: text/plain; charset=utf-8\n"
|
15 |
"Content-Transfer-Encoding: 8bit\n"
|
16 |
-
"X-Poedit-Language: Russian\n"
|
17 |
-
"X-Poedit-Country: RUSSIAN FEDERATION\n"
|
18 |
"X-Poedit-SourceCharset: utf-8\n"
|
|
|
|
|
19 |
|
20 |
#: post-snippets.php:70
|
21 |
msgid "Post Snippets requires WordPress version 2.7 or later!"
|
@@ -27,7 +27,7 @@ msgstr "Сниппет с названием Untitled был добавлен."
|
|
27 |
|
28 |
#: post-snippets.php:192
|
29 |
msgid "Snippets have been updated."
|
30 |
-
msgstr "
|
31 |
|
32 |
#: post-snippets.php:208
|
33 |
msgid "Selected snippets have been deleted."
|
@@ -35,46 +35,43 @@ msgstr "Выбранные сниппеты были удалены."
|
|
35 |
|
36 |
#: post-snippets.php:220
|
37 |
msgid "Add New Snippet"
|
38 |
-
msgstr "
|
39 |
|
40 |
#: post-snippets.php:221
|
41 |
msgid "Delete Selected"
|
42 |
-
msgstr "
|
43 |
|
44 |
-
#: post-snippets.php:230
|
45 |
-
#: post-snippets.php:239
|
46 |
msgid "Title"
|
47 |
msgstr "Заглавие"
|
48 |
|
49 |
-
#: post-snippets.php:231
|
50 |
-
#: post-snippets.php:240
|
51 |
msgid "Variables"
|
52 |
msgstr "Переменные"
|
53 |
|
54 |
-
#: post-snippets.php:232
|
55 |
-
#: post-snippets.php:241
|
56 |
msgid "Snippet"
|
57 |
msgstr "Сниппет"
|
58 |
|
59 |
#: post-snippets.php:263
|
60 |
msgid "Update Snippets"
|
61 |
-
msgstr "
|
62 |
|
63 |
#: post-snippets.php:268
|
64 |
msgid "Help"
|
65 |
-
msgstr "
|
66 |
|
67 |
#: post-snippets.php:270
|
68 |
msgid "<strong>Title</strong><br/>Give the snippet a title that helps you identify it in the post editor."
|
69 |
-
msgstr "<strong>Заглавие</strong><br
|
70 |
|
71 |
#: post-snippets.php:272
|
72 |
msgid "<strong>Variables</strong><br/>A comma separated list of custom variables you can reference in your snippet.<br/><br/>Example:<br/>url,name"
|
73 |
-
msgstr "<strong>Переменные</strong><br
|
74 |
|
75 |
#: post-snippets.php:274
|
76 |
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 <a href=\"{url}\">{name}</a></i><br/>You will get the option to replace url and name on insert if they are defined as variables."
|
77 |
-
msgstr "<strong>Сниппет</strong><br/>Это блок текста или HTML для вставки в пост,
|
78 |
|
79 |
#: post-snippets.php:281
|
80 |
msgid "About Post Snippets"
|
@@ -82,7 +79,7 @@ msgstr "О Post Snippets"
|
|
82 |
|
83 |
#: tinymce/window.php:9
|
84 |
msgid "You are not allowed to be here"
|
85 |
-
msgstr "Вам не разрешено
|
86 |
|
87 |
#: tinymce/window.php:109
|
88 |
msgid "Cancel"
|
@@ -111,4 +108,3 @@ msgstr "Johan Steen"
|
|
111 |
#. Author URI of an extension
|
112 |
msgid "http://coding.cglounge.com/"
|
113 |
msgstr "http://coding.cglounge.com/"
|
114 |
-
|
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: 2015-08-07 15:16+0300\n"
|
11 |
"Last-Translator: Fat Cow <zhr@tut.by>\n"
|
12 |
"Language-Team: Fat Cow <zhr@tut.by>\n"
|
13 |
"MIME-Version: 1.0\n"
|
14 |
"Content-Type: text/plain; charset=utf-8\n"
|
15 |
"Content-Transfer-Encoding: 8bit\n"
|
|
|
|
|
16 |
"X-Poedit-SourceCharset: utf-8\n"
|
17 |
+
"Language: ru_RU\n"
|
18 |
+
"X-Generator: Poedit 1.8.4\n"
|
19 |
|
20 |
#: post-snippets.php:70
|
21 |
msgid "Post Snippets requires WordPress version 2.7 or later!"
|
27 |
|
28 |
#: post-snippets.php:192
|
29 |
msgid "Snippets have been updated."
|
30 |
+
msgstr "Сниппеты обновлены."
|
31 |
|
32 |
#: post-snippets.php:208
|
33 |
msgid "Selected snippets have been deleted."
|
35 |
|
36 |
#: post-snippets.php:220
|
37 |
msgid "Add New Snippet"
|
38 |
+
msgstr "Добавить новый сниппет"
|
39 |
|
40 |
#: post-snippets.php:221
|
41 |
msgid "Delete Selected"
|
42 |
+
msgstr "Удалить выделенное"
|
43 |
|
44 |
+
#: post-snippets.php:230 post-snippets.php:239
|
|
|
45 |
msgid "Title"
|
46 |
msgstr "Заглавие"
|
47 |
|
48 |
+
#: post-snippets.php:231 post-snippets.php:240
|
|
|
49 |
msgid "Variables"
|
50 |
msgstr "Переменные"
|
51 |
|
52 |
+
#: post-snippets.php:232 post-snippets.php:241
|
|
|
53 |
msgid "Snippet"
|
54 |
msgstr "Сниппет"
|
55 |
|
56 |
#: post-snippets.php:263
|
57 |
msgid "Update Snippets"
|
58 |
+
msgstr "Обновить сниппеты"
|
59 |
|
60 |
#: post-snippets.php:268
|
61 |
msgid "Help"
|
62 |
+
msgstr "Помощь"
|
63 |
|
64 |
#: post-snippets.php:270
|
65 |
msgid "<strong>Title</strong><br/>Give the snippet a title that helps you identify it in the post editor."
|
66 |
+
msgstr "<strong>Заглавие</strong><br/>Даёт сниппету имя, которое помогает опознать его в редакторе поста."
|
67 |
|
68 |
#: post-snippets.php:272
|
69 |
msgid "<strong>Variables</strong><br/>A comma separated list of custom variables you can reference in your snippet.<br/><br/>Example:<br/>url,name"
|
70 |
+
msgstr "<strong>Переменные</strong><br/>Имена переменных, через запятую, которые можно использовать в сниппете. Пример:<br/>url,name"
|
71 |
|
72 |
#: post-snippets.php:274
|
73 |
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 <a href=\"{url}\">{name}</a></i><br/>You will get the option to replace url and name on insert if they are defined as variables."
|
74 |
+
msgstr "<strong>Сниппет</strong><br/>Это блок текста или HTML для вставки в пост, выбираемый по нажатию на кнопку TinyMCE в редакторе поста. Если вы предварительно указали допустимые имена переменных, вы можете использовать их в сниппете, заключая в фигурные скобки {}.<br/><br/>Пример:<br/>Чтобы использовать переменные в примере ниже, введите {url} и {name}.<br/><br/>Вызывая такой сниппет:<br/><i>This is the website of <a href=\"{url}\">{name}</a></i><br/>вы можете заменять url и name, если укажете их в переданных переменных."
|
75 |
|
76 |
#: post-snippets.php:281
|
77 |
msgid "About Post Snippets"
|
79 |
|
80 |
#: tinymce/window.php:9
|
81 |
msgid "You are not allowed to be here"
|
82 |
+
msgstr "Вам не разрешено находиться здесь"
|
83 |
|
84 |
#: tinymce/window.php:109
|
85 |
msgid "Cancel"
|
108 |
#. Author URI of an extension
|
109 |
msgid "http://coding.cglounge.com/"
|
110 |
msgstr "http://coding.cglounge.com/"
|
|
post-snippets.php
CHANGED
@@ -5,9 +5,10 @@ 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.
|
9 |
License: GPLv2 or later
|
10 |
Text Domain: post-snippets
|
|
|
11 |
|
12 |
Copyright 2009-2015 Johan Steen (email : artstorm [at] gmail [dot] com)
|
13 |
|
@@ -45,7 +46,6 @@ class PostSnippets
|
|
45 |
const MIN_WP_VERSION = '3.3';
|
46 |
const OPTION_KEY = 'post_snippets_options';
|
47 |
const USER_META_KEY = 'post_snippets';
|
48 |
-
const TEXT_DOMAIN = 'post-snippets';
|
49 |
const FILE = __FILE__;
|
50 |
|
51 |
/**
|
@@ -68,10 +68,14 @@ class PostSnippets
|
|
68 |
return;
|
69 |
}
|
70 |
|
71 |
-
|
|
|
|
|
|
|
|
|
72 |
register_uninstall_hook(__FILE__, array(__CLASS__, 'uninstall'));
|
73 |
-
|
74 |
add_action('after_setup_theme', array(&$this, 'phpExecState'));
|
|
|
75 |
new PostSnippets_Admin;
|
76 |
new PostSnippets_WPEditor;
|
77 |
new PostSnippets_Shortcode;
|
@@ -104,24 +108,6 @@ class PostSnippets
|
|
104 |
require $fileName;
|
105 |
}
|
106 |
|
107 |
-
/**
|
108 |
-
* Loads the plugin text domain for translation
|
109 |
-
*/
|
110 |
-
public function textDomain()
|
111 |
-
{
|
112 |
-
$domain = self::TEXT_DOMAIN;
|
113 |
-
$locale = apply_filters('plugin_locale', get_locale(), $domain);
|
114 |
-
load_textdomain(
|
115 |
-
$domain,
|
116 |
-
WP_LANG_DIR.'/'.$domain.'/'.$domain.'-'.$locale.'.mo'
|
117 |
-
);
|
118 |
-
load_plugin_textdomain(
|
119 |
-
$domain,
|
120 |
-
false,
|
121 |
-
dirname(plugin_basename(__FILE__)).'/lang/'
|
122 |
-
);
|
123 |
-
}
|
124 |
-
|
125 |
/**
|
126 |
* Fired when the plugin is uninstalled.
|
127 |
*/
|
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.7
|
9 |
License: GPLv2 or later
|
10 |
Text Domain: post-snippets
|
11 |
+
Domain Path: /lang
|
12 |
|
13 |
Copyright 2009-2015 Johan Steen (email : artstorm [at] gmail [dot] com)
|
14 |
|
46 |
const MIN_WP_VERSION = '3.3';
|
47 |
const OPTION_KEY = 'post_snippets_options';
|
48 |
const USER_META_KEY = 'post_snippets';
|
|
|
49 |
const FILE = __FILE__;
|
50 |
|
51 |
/**
|
68 |
return;
|
69 |
}
|
70 |
|
71 |
+
load_plugin_textdomain(
|
72 |
+
'post-snippets',
|
73 |
+
false,
|
74 |
+
dirname(plugin_basename(__FILE__)).'/lang/'
|
75 |
+
);
|
76 |
register_uninstall_hook(__FILE__, array(__CLASS__, 'uninstall'));
|
|
|
77 |
add_action('after_setup_theme', array(&$this, 'phpExecState'));
|
78 |
+
|
79 |
new PostSnippets_Admin;
|
80 |
new PostSnippets_WPEditor;
|
81 |
new PostSnippets_Shortcode;
|
108 |
require $fileName;
|
109 |
}
|
110 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
111 |
/**
|
112 |
* Fired when the plugin is uninstalled.
|
113 |
*/
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ 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.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -128,6 +128,9 @@ Contributions are appreciated and encouraged.
|
|
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.
|
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.7
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
128 |
|
129 |
== Changelog ==
|
130 |
|
131 |
+
= Version 2.3.7 - 4 Nov 2015 =
|
132 |
+
* Updates translatable strings to be Language Pack compatible.
|
133 |
+
|
134 |
= Version 2.3.6 - 15 Jul 2015 =
|
135 |
* Bumps minimum required PHP version to 5.3.0.
|
136 |
* Adds list of translators to inline documentation.
|
src/PostSnippets/Admin.php
CHANGED
@@ -37,7 +37,7 @@ class PostSnippets_Admin
|
|
37 |
if ($file == $pluginFile) {
|
38 |
$url = 'options-general.php?page=post-snippets/post-snippets.php';
|
39 |
$link = "<a href='{$url}'>";
|
40 |
-
$link .= __('Settings',
|
41 |
$links[] = $link;
|
42 |
}
|
43 |
return $links;
|
@@ -126,7 +126,7 @@ class PostSnippets_Admin
|
|
126 |
$this->message(
|
127 |
__(
|
128 |
'A snippet named Untitled has been added.',
|
129 |
-
|
130 |
)
|
131 |
);
|
132 |
}
|
@@ -145,7 +145,7 @@ class PostSnippets_Admin
|
|
145 |
|
146 |
if (empty($snippets) || !isset($_POST['checked'])) {
|
147 |
$this->message(
|
148 |
-
__('Nothing selected to delete.',
|
149 |
);
|
150 |
return;
|
151 |
}
|
@@ -162,7 +162,7 @@ class PostSnippets_Admin
|
|
162 |
$this->message(
|
163 |
__(
|
164 |
'Selected snippets have been deleted.',
|
165 |
-
|
166 |
)
|
167 |
);
|
168 |
}
|
@@ -196,7 +196,7 @@ class PostSnippets_Admin
|
|
196 |
$new_snippets[$key]['description'] = wp_specialchars_decode(trim(stripslashes($_POST[$key.'_description'])), ENT_NOQUOTES);
|
197 |
}
|
198 |
update_option(PostSnippets::OPTION_KEY, $new_snippets);
|
199 |
-
$this->message(__('Snippets have been updated.',
|
200 |
}
|
201 |
}
|
202 |
}
|
@@ -276,7 +276,7 @@ class PostSnippets_Admin
|
|
276 |
// Tabs
|
277 |
$active_tab = isset($_GET[ 'tab' ]) ? $_GET[ 'tab' ] : 'snippets';
|
278 |
$base_url = '?page=post-snippets/post-snippets.php&tab=';
|
279 |
-
$tabs = array('snippets' => __('Manage Snippets',
|
280 |
echo '<h2 class="nav-tab-wrapper">';
|
281 |
foreach ($tabs as $tab => $title) {
|
282 |
$active = ($active_tab == $tab) ? ' nav-tab-active' : '';
|
@@ -284,7 +284,7 @@ class PostSnippets_Admin
|
|
284 |
}
|
285 |
echo '</h2>';
|
286 |
echo '<p class="description">';
|
287 |
-
_e('Use the help dropdown button for additional information.',
|
288 |
echo '</p>';
|
289 |
|
290 |
// Tab content
|
@@ -319,13 +319,13 @@ class PostSnippets_Admin
|
|
319 |
$ie = new PostSnippets_ImportExport();
|
320 |
|
321 |
// Create header and export html form
|
322 |
-
printf("<h3>%s</h3>", __('Import/Export',
|
323 |
-
printf("<h4>%s</h4>", __('Export',
|
324 |
echo '<form method="post">';
|
325 |
echo '<p>';
|
326 |
-
_e('Export your snippets for backup or to import them on another site.',
|
327 |
echo '</p>';
|
328 |
-
printf("<input type='submit' class='button' name='postsnippets_export' value='%s' />", __('Export Snippets',
|
329 |
echo '</form>';
|
330 |
|
331 |
// Export logic, and import html form and logic
|
@@ -348,7 +348,7 @@ class PostSnippets_Admin
|
|
348 |
echo '<div class="wrap">';
|
349 |
echo '<h2>Post Snippets</h2>';
|
350 |
echo '<p>';
|
351 |
-
_e('This is an overview of all snippets defined for this site. These snippets are inserted into posts from the post editor using the Post Snippets button. You can choose to see the snippets here as-is or as they are actually rendered on the website. Enabling rendered snippets for this overview might look strange if the snippet have dependencies on variables, CSS or other parameters only available on the frontend. If that is the case it is recommended to keep this option disabled.',
|
352 |
echo '</p>';
|
353 |
|
354 |
// Form
|
@@ -358,8 +358,8 @@ class PostSnippets_Admin
|
|
358 |
echo '<form method="post" action="">';
|
359 |
wp_nonce_field('post_snippets_user_options', 'post_snippets_user_nonce');
|
360 |
|
361 |
-
$this->checkbox(__('Display rendered snippets',
|
362 |
-
$this->submit('update-post-snippets-user', __('Update',
|
363 |
echo '</form>';
|
364 |
|
365 |
// Snippet List
|
@@ -375,7 +375,7 @@ class PostSnippets_Admin
|
|
375 |
echo "</h3>";
|
376 |
|
377 |
if ($snippet['vars']) {
|
378 |
-
printf("<strong>%s:</strong> {$snippet['vars']}<br/>", __('Variables',
|
379 |
}
|
380 |
|
381 |
// echo "<strong>Variables:</strong> {$snippet['vars']}<br/>";
|
@@ -391,10 +391,10 @@ class PostSnippets_Admin
|
|
391 |
array_push($options, 'wptexturize');
|
392 |
}
|
393 |
if ($options) {
|
394 |
-
printf("<strong>%s:</strong> %s<br/>", __('Options',
|
395 |
}
|
396 |
|
397 |
-
printf("<br/><strong>%s:</strong><br/>", __('Snippet',
|
398 |
if ($render) {
|
399 |
echo do_shortcode($snippet['snippet']);
|
400 |
} else {
|
37 |
if ($file == $pluginFile) {
|
38 |
$url = 'options-general.php?page=post-snippets/post-snippets.php';
|
39 |
$link = "<a href='{$url}'>";
|
40 |
+
$link .= __('Settings', 'post-snippets').'</a>';
|
41 |
$links[] = $link;
|
42 |
}
|
43 |
return $links;
|
126 |
$this->message(
|
127 |
__(
|
128 |
'A snippet named Untitled has been added.',
|
129 |
+
'post-snippets'
|
130 |
)
|
131 |
);
|
132 |
}
|
145 |
|
146 |
if (empty($snippets) || !isset($_POST['checked'])) {
|
147 |
$this->message(
|
148 |
+
__('Nothing selected to delete.', 'post-snippets')
|
149 |
);
|
150 |
return;
|
151 |
}
|
162 |
$this->message(
|
163 |
__(
|
164 |
'Selected snippets have been deleted.',
|
165 |
+
'post-snippets'
|
166 |
)
|
167 |
);
|
168 |
}
|
196 |
$new_snippets[$key]['description'] = wp_specialchars_decode(trim(stripslashes($_POST[$key.'_description'])), ENT_NOQUOTES);
|
197 |
}
|
198 |
update_option(PostSnippets::OPTION_KEY, $new_snippets);
|
199 |
+
$this->message(__('Snippets have been updated.', 'post-snippets'));
|
200 |
}
|
201 |
}
|
202 |
}
|
276 |
// Tabs
|
277 |
$active_tab = isset($_GET[ 'tab' ]) ? $_GET[ 'tab' ] : 'snippets';
|
278 |
$base_url = '?page=post-snippets/post-snippets.php&tab=';
|
279 |
+
$tabs = array('snippets' => __('Manage Snippets', 'post-snippets'), 'tools' => __('Import/Export', 'post-snippets'));
|
280 |
echo '<h2 class="nav-tab-wrapper">';
|
281 |
foreach ($tabs as $tab => $title) {
|
282 |
$active = ($active_tab == $tab) ? ' nav-tab-active' : '';
|
284 |
}
|
285 |
echo '</h2>';
|
286 |
echo '<p class="description">';
|
287 |
+
_e('Use the help dropdown button for additional information.', 'post-snippets');
|
288 |
echo '</p>';
|
289 |
|
290 |
// Tab content
|
319 |
$ie = new PostSnippets_ImportExport();
|
320 |
|
321 |
// Create header and export html form
|
322 |
+
printf("<h3>%s</h3>", __('Import/Export', 'post-snippets'));
|
323 |
+
printf("<h4>%s</h4>", __('Export', 'post-snippets'));
|
324 |
echo '<form method="post">';
|
325 |
echo '<p>';
|
326 |
+
_e('Export your snippets for backup or to import them on another site.', 'post-snippets');
|
327 |
echo '</p>';
|
328 |
+
printf("<input type='submit' class='button' name='postsnippets_export' value='%s' />", __('Export Snippets', 'post-snippets'));
|
329 |
echo '</form>';
|
330 |
|
331 |
// Export logic, and import html form and logic
|
348 |
echo '<div class="wrap">';
|
349 |
echo '<h2>Post Snippets</h2>';
|
350 |
echo '<p>';
|
351 |
+
_e('This is an overview of all snippets defined for this site. These snippets are inserted into posts from the post editor using the Post Snippets button. You can choose to see the snippets here as-is or as they are actually rendered on the website. Enabling rendered snippets for this overview might look strange if the snippet have dependencies on variables, CSS or other parameters only available on the frontend. If that is the case it is recommended to keep this option disabled.', 'post-snippets');
|
352 |
echo '</p>';
|
353 |
|
354 |
// Form
|
358 |
echo '<form method="post" action="">';
|
359 |
wp_nonce_field('post_snippets_user_options', 'post_snippets_user_nonce');
|
360 |
|
361 |
+
$this->checkbox(__('Display rendered snippets', 'post-snippets'), 'render', $render);
|
362 |
+
$this->submit('update-post-snippets-user', __('Update', 'post-snippets'));
|
363 |
echo '</form>';
|
364 |
|
365 |
// Snippet List
|
375 |
echo "</h3>";
|
376 |
|
377 |
if ($snippet['vars']) {
|
378 |
+
printf("<strong>%s:</strong> {$snippet['vars']}<br/>", __('Variables', 'post-snippets'));
|
379 |
}
|
380 |
|
381 |
// echo "<strong>Variables:</strong> {$snippet['vars']}<br/>";
|
391 |
array_push($options, 'wptexturize');
|
392 |
}
|
393 |
if ($options) {
|
394 |
+
printf("<strong>%s:</strong> %s<br/>", __('Options', 'post-snippets'), implode(', ', $options));
|
395 |
}
|
396 |
|
397 |
+
printf("<br/><strong>%s:</strong><br/>", __('Snippet', 'post-snippets'));
|
398 |
if ($render) {
|
399 |
echo do_shortcode($snippet['snippet']);
|
400 |
} else {
|
src/PostSnippets/Help.php
CHANGED
@@ -47,14 +47,14 @@ class PostSnippets_Help
|
|
47 |
$screen->add_help_tab(
|
48 |
array(
|
49 |
'id' => 'usage-plugin-help',
|
50 |
-
'title' => __('Usage',
|
51 |
'content' => $this->content('help/usage')
|
52 |
)
|
53 |
);
|
54 |
$screen->add_help_tab(
|
55 |
array(
|
56 |
'id' => 'post-plugin-help',
|
57 |
-
'title' => __('Post Editor',
|
58 |
'content' => $this->content('help/post')
|
59 |
)
|
60 |
);
|
@@ -62,7 +62,7 @@ class PostSnippets_Help
|
|
62 |
$screen->add_help_tab(
|
63 |
array(
|
64 |
'id' => 'php-plugin-help',
|
65 |
-
'title' => __('PHP',
|
66 |
'content' => $this->content('help/php')
|
67 |
)
|
68 |
);
|
@@ -70,24 +70,17 @@ class PostSnippets_Help
|
|
70 |
$screen->add_help_tab(
|
71 |
array(
|
72 |
'id' => 'advanced-plugin-help',
|
73 |
-
'title' => __('Advanced',
|
74 |
'content' => $this->content('help/advanced')
|
75 |
)
|
76 |
);
|
77 |
$screen->add_help_tab(
|
78 |
array(
|
79 |
'id' => 'filters-plugin-help',
|
80 |
-
'title' => __('Filters',
|
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 |
/**
|
@@ -116,9 +109,6 @@ class PostSnippets_Help
|
|
116 |
*/
|
117 |
private function content($tab)
|
118 |
{
|
119 |
-
return PostSnippets_View::render(
|
120 |
-
$tab,
|
121 |
-
array('td' => PostSnippets::TEXT_DOMAIN)
|
122 |
-
);
|
123 |
}
|
124 |
}
|
47 |
$screen->add_help_tab(
|
48 |
array(
|
49 |
'id' => 'usage-plugin-help',
|
50 |
+
'title' => __('Usage', 'post-snippets'),
|
51 |
'content' => $this->content('help/usage')
|
52 |
)
|
53 |
);
|
54 |
$screen->add_help_tab(
|
55 |
array(
|
56 |
'id' => 'post-plugin-help',
|
57 |
+
'title' => __('Post Editor', 'post-snippets'),
|
58 |
'content' => $this->content('help/post')
|
59 |
)
|
60 |
);
|
62 |
$screen->add_help_tab(
|
63 |
array(
|
64 |
'id' => 'php-plugin-help',
|
65 |
+
'title' => __('PHP', 'post-snippets'),
|
66 |
'content' => $this->content('help/php')
|
67 |
)
|
68 |
);
|
70 |
$screen->add_help_tab(
|
71 |
array(
|
72 |
'id' => 'advanced-plugin-help',
|
73 |
+
'title' => __('Advanced', 'post-snippets'),
|
74 |
'content' => $this->content('help/advanced')
|
75 |
)
|
76 |
);
|
77 |
$screen->add_help_tab(
|
78 |
array(
|
79 |
'id' => 'filters-plugin-help',
|
80 |
+
'title' => __('Filters', 'post-snippets'),
|
81 |
'content' => $this->content('help/filters')
|
82 |
)
|
83 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
84 |
}
|
85 |
|
86 |
/**
|
109 |
*/
|
110 |
private function content($tab)
|
111 |
{
|
112 |
+
return PostSnippets_View::render($tab);
|
|
|
|
|
|
|
113 |
}
|
114 |
}
|
src/PostSnippets/ImportExport.php
CHANGED
@@ -35,7 +35,7 @@ class PostSnippets_ImportExport
|
|
35 |
10000
|
36 |
);
|
37 |
} else {
|
38 |
-
echo __('Error: ',
|
39 |
}
|
40 |
} else {
|
41 |
// Check if there is any old export files to delete
|
@@ -58,24 +58,24 @@ class PostSnippets_ImportExport
|
|
58 |
{
|
59 |
$import =
|
60 |
'<br/><br/><strong>'.
|
61 |
-
__('Import',
|
62 |
'</strong><br/>';
|
63 |
if (!isset($_FILES['postsnippets_import_file'])
|
64 |
|| empty($_FILES['postsnippets_import_file'])
|
65 |
) {
|
66 |
$import .=
|
67 |
-
'<p>'.__('Import snippets from a post-snippets-export.zip file. Importing overwrites any existing snippets.',
|
68 |
'</p>';
|
69 |
$import .= '<form method="post" enctype="multipart/form-data">';
|
70 |
$import .= '<input type="file" name="postsnippets_import_file"/>';
|
71 |
$import .= '<input type="hidden" name="action" value="wp_handle_upload"/>';
|
72 |
$import .=
|
73 |
'<input type="submit" class="button" value="'.
|
74 |
-
__('Import Snippets',
|
75 |
$import .= '</form>';
|
76 |
} else {
|
77 |
$file = wp_handle_upload($_FILES['postsnippets_import_file']);
|
78 |
-
|
79 |
if (isset($file['file']) && !is_wp_error($file)) {
|
80 |
require_once(ABSPATH . 'wp-admin/includes/class-pclzip.php');
|
81 |
$zip = new PclZip($file['file']);
|
@@ -110,29 +110,29 @@ class PostSnippets_ImportExport
|
|
110 |
|
111 |
$import .=
|
112 |
'<p><strong>'.
|
113 |
-
__('Snippets successfully imported.',
|
114 |
'</strong></p>';
|
115 |
} else {
|
116 |
$import .=
|
117 |
'<p><strong>'.
|
118 |
-
__('Snippets could not be imported:',
|
119 |
' '.
|
120 |
-
__('Unzipping failed.',
|
121 |
'</strong></p>';
|
122 |
}
|
123 |
} else {
|
124 |
if ($file['error'] || is_wp_error($file)) {
|
125 |
$import .=
|
126 |
'<p><strong>'.
|
127 |
-
__('Snippets could not be imported:',
|
128 |
' '.
|
129 |
$file['error'].'</strong></p>';
|
130 |
} else {
|
131 |
$import .=
|
132 |
'<p><strong>'.
|
133 |
-
__('Snippets could not be imported:',
|
134 |
' '.
|
135 |
-
__('Upload failed.',
|
136 |
'</strong></p>';
|
137 |
}
|
138 |
}
|
@@ -152,7 +152,7 @@ class PostSnippets_ImportExport
|
|
152 |
$dir = wp_upload_dir();
|
153 |
$upload_dir = $dir['basedir'] . '/';
|
154 |
$upload_url = $dir['baseurl'] . '/';
|
155 |
-
|
156 |
// Open a file stream and write the serialized options to it.
|
157 |
if (!$handle = fopen($upload_dir.'./'.self::FILE_CFG, 'w')) {
|
158 |
die();
|
@@ -174,7 +174,7 @@ class PostSnippets_ImportExport
|
|
174 |
if (!$zipped) {
|
175 |
return false;
|
176 |
}
|
177 |
-
|
178 |
return $upload_url.'./'.self::FILE_ZIP;
|
179 |
}
|
180 |
|
35 |
10000
|
36 |
);
|
37 |
} else {
|
38 |
+
echo __('Error: ', 'post-snippets').$url;
|
39 |
}
|
40 |
} else {
|
41 |
// Check if there is any old export files to delete
|
58 |
{
|
59 |
$import =
|
60 |
'<br/><br/><strong>'.
|
61 |
+
__('Import', 'post-snippets').
|
62 |
'</strong><br/>';
|
63 |
if (!isset($_FILES['postsnippets_import_file'])
|
64 |
|| empty($_FILES['postsnippets_import_file'])
|
65 |
) {
|
66 |
$import .=
|
67 |
+
'<p>'.__('Import snippets from a post-snippets-export.zip file. Importing overwrites any existing snippets.', 'post-snippets').
|
68 |
'</p>';
|
69 |
$import .= '<form method="post" enctype="multipart/form-data">';
|
70 |
$import .= '<input type="file" name="postsnippets_import_file"/>';
|
71 |
$import .= '<input type="hidden" name="action" value="wp_handle_upload"/>';
|
72 |
$import .=
|
73 |
'<input type="submit" class="button" value="'.
|
74 |
+
__('Import Snippets', 'post-snippets').'"/>';
|
75 |
$import .= '</form>';
|
76 |
} else {
|
77 |
$file = wp_handle_upload($_FILES['postsnippets_import_file']);
|
78 |
+
|
79 |
if (isset($file['file']) && !is_wp_error($file)) {
|
80 |
require_once(ABSPATH . 'wp-admin/includes/class-pclzip.php');
|
81 |
$zip = new PclZip($file['file']);
|
110 |
|
111 |
$import .=
|
112 |
'<p><strong>'.
|
113 |
+
__('Snippets successfully imported.', 'post-snippets').
|
114 |
'</strong></p>';
|
115 |
} else {
|
116 |
$import .=
|
117 |
'<p><strong>'.
|
118 |
+
__('Snippets could not be imported:', 'post-snippets').
|
119 |
' '.
|
120 |
+
__('Unzipping failed.', 'post-snippets').
|
121 |
'</strong></p>';
|
122 |
}
|
123 |
} else {
|
124 |
if ($file['error'] || is_wp_error($file)) {
|
125 |
$import .=
|
126 |
'<p><strong>'.
|
127 |
+
__('Snippets could not be imported:', 'post-snippets').
|
128 |
' '.
|
129 |
$file['error'].'</strong></p>';
|
130 |
} else {
|
131 |
$import .=
|
132 |
'<p><strong>'.
|
133 |
+
__('Snippets could not be imported:', 'post-snippets').
|
134 |
' '.
|
135 |
+
__('Upload failed.', 'post-snippets').
|
136 |
'</strong></p>';
|
137 |
}
|
138 |
}
|
152 |
$dir = wp_upload_dir();
|
153 |
$upload_dir = $dir['basedir'] . '/';
|
154 |
$upload_url = $dir['baseurl'] . '/';
|
155 |
+
|
156 |
// Open a file stream and write the serialized options to it.
|
157 |
if (!$handle = fopen($upload_dir.'./'.self::FILE_CFG, 'w')) {
|
158 |
die();
|
174 |
if (!$zipped) {
|
175 |
return false;
|
176 |
}
|
177 |
+
|
178 |
return $upload_url.'./'.self::FILE_ZIP;
|
179 |
}
|
180 |
|
tinymce/editor_plugin.js
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
(function() {
|
4 |
// Load plugin specific language pack
|
5 |
tinymce.PluginManager.requireLangPack('post_snippets');
|
6 |
-
|
7 |
tinymce.create('tinymce.plugins.post_snippets', {
|
8 |
/**
|
9 |
* Initializes the plugin, this will be executed after the plugin has been created.
|
@@ -24,7 +24,7 @@
|
|
24 |
|
25 |
// Register example button
|
26 |
ed.addButton('post_snippets', {
|
27 |
-
title : '
|
28 |
cmd : 'mce_post_snippets',
|
29 |
image : url + '/post-snippets.gif'
|
30 |
});
|
3 |
(function() {
|
4 |
// Load plugin specific language pack
|
5 |
tinymce.PluginManager.requireLangPack('post_snippets');
|
6 |
+
|
7 |
tinymce.create('tinymce.plugins.post_snippets', {
|
8 |
/**
|
9 |
* Initializes the plugin, this will be executed after the plugin has been created.
|
24 |
|
25 |
// Register example button
|
26 |
ed.addButton('post_snippets', {
|
27 |
+
title : 'Post Snippets',
|
28 |
cmd : 'mce_post_snippets',
|
29 |
image : url + '/post-snippets.gif'
|
30 |
});
|
views/admin_snippets.php
CHANGED
@@ -5,23 +5,23 @@
|
|
5 |
<thead>
|
6 |
<tr>
|
7 |
<th scope="col" class="check-column"><input type="checkbox" /></th>
|
8 |
-
<th scope="col" style="width: 180px;"><?php _e('Title',
|
9 |
-
<th scope="col" style="width: 180px;"><?php _e('Variables',
|
10 |
-
<th scope="col"><?php _e('Snippet',
|
11 |
</tr>
|
12 |
</thead>
|
13 |
-
|
14 |
<tfoot>
|
15 |
<tr>
|
16 |
<th scope="col" class="check-column"><input type="checkbox" /></th>
|
17 |
-
<th scope="col"><?php _e('Title',
|
18 |
-
<th scope="col"><?php _e('Variables',
|
19 |
-
<th scope="col"><?php _e('Snippet',
|
20 |
</tr>
|
21 |
</tfoot>
|
22 |
-
|
23 |
<tbody>
|
24 |
-
<?php
|
25 |
$snippets = get_option(PostSnippets::OPTION_KEY);
|
26 |
if (!empty($snippets)) {
|
27 |
foreach ($snippets as $key => $snippet) {
|
@@ -41,14 +41,14 @@ if (!empty($snippets)) {
|
|
41 |
<br/>
|
42 |
<br/>
|
43 |
<?php
|
44 |
-
PostSnippets_Admin::checkbox(__('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(
|
51 |
-
__('PHP Code',
|
52 |
$key.'_php',
|
53 |
$snippet['php']
|
54 |
);
|
@@ -62,7 +62,7 @@ if (!empty($snippets)) {
|
|
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',
|
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']);
|
@@ -79,7 +79,7 @@ if (!empty($snippets)) {
|
|
79 |
</table>
|
80 |
|
81 |
<?php
|
82 |
-
PostSnippets_Admin::submit('update-snippets', __('Update Snippets',
|
83 |
-
PostSnippets_Admin::submit('add-snippet', __('Add New Snippet',
|
84 |
-
PostSnippets_Admin::submit('delete-snippets', __('Delete Selected',
|
85 |
echo '</form>';
|
5 |
<thead>
|
6 |
<tr>
|
7 |
<th scope="col" class="check-column"><input type="checkbox" /></th>
|
8 |
+
<th scope="col" style="width: 180px;"><?php _e('Title', 'post-snippets'); ?></th>
|
9 |
+
<th scope="col" style="width: 180px;"><?php _e('Variables', 'post-snippets'); ?></th>
|
10 |
+
<th scope="col"><?php _e('Snippet', 'post-snippets'); ?></th>
|
11 |
</tr>
|
12 |
</thead>
|
13 |
+
|
14 |
<tfoot>
|
15 |
<tr>
|
16 |
<th scope="col" class="check-column"><input type="checkbox" /></th>
|
17 |
+
<th scope="col"><?php _e('Title', 'post-snippets') ?></th>
|
18 |
+
<th scope="col"><?php _e('Variables', 'post-snippets') ?></th>
|
19 |
+
<th scope="col"><?php _e('Snippet', 'post-snippets') ?></th>
|
20 |
</tr>
|
21 |
</tfoot>
|
22 |
+
|
23 |
<tbody>
|
24 |
+
<?php
|
25 |
$snippets = get_option(PostSnippets::OPTION_KEY);
|
26 |
if (!empty($snippets)) {
|
27 |
foreach ($snippets as $key => $snippet) {
|
41 |
<br/>
|
42 |
<br/>
|
43 |
<?php
|
44 |
+
PostSnippets_Admin::checkbox(__('Shortcode', 'post-snippets'), $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(
|
51 |
+
__('PHP Code', 'post-snippets'),
|
52 |
$key.'_php',
|
53 |
$snippet['php']
|
54 |
);
|
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', 'post-snippets') ?>:
|
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']);
|
79 |
</table>
|
80 |
|
81 |
<?php
|
82 |
+
PostSnippets_Admin::submit('update-snippets', __('Update Snippets', 'post-snippets'));
|
83 |
+
PostSnippets_Admin::submit('add-snippet', __('Add New Snippet', 'post-snippets'), 'button-secondary', false);
|
84 |
+
PostSnippets_Admin::submit('delete-snippets', __('Delete Selected', 'post-snippets'), 'button-secondary', false);
|
85 |
echo '</form>';
|
views/help/advanced.php
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
<h2><?php _e('Advanced',
|
2 |
|
3 |
<p>
|
4 |
You can add constants to wp-config.php or the theme’s functions.php file to control some aspects of the plugin. Available constants to set are:
|
@@ -12,26 +12,26 @@ define('POST_SNIPPETS_DISABLE_PHP', true);
|
|
12 |
</code></pre>
|
13 |
|
14 |
<p>
|
15 |
-
<?php _e('You can retrieve a Post Snippet directly from PHP, in a theme for instance, by using the PostSnippets::getSnippet() method.',
|
16 |
</p>
|
17 |
|
18 |
-
<h2><?php _e('Usage',
|
19 |
<p>
|
20 |
<code>
|
21 |
<?php $my_snippet = PostSnippets::getSnippet( $snippet_name, $snippet_vars ); ?>
|
22 |
</code></p>
|
23 |
|
24 |
-
<h2><?php _e('Parameters',
|
25 |
<p>
|
26 |
<strong>$snippet_name</strong><br/>
|
27 |
-
<?php _e('(string) (required) The name of the snippet to retrieve.',
|
28 |
<br/><br/>
|
29 |
<strong>$snippet_vars</strong><br/>
|
30 |
-
<?php _e('(string) The variables to pass to the snippet, formatted as a query string.',
|
31 |
</p>
|
32 |
|
33 |
|
34 |
-
<h2><?php _e('Example',
|
35 |
|
36 |
<pre><code>// Use querystring for variables
|
37 |
$mySnippet = PostSnippets::getSnippet('internal-link', 'title=Awesome&url=2011/02/awesome/');
|
1 |
+
<h2><?php _e('Advanced', 'post-snippets'); ?> (<em><?php _e('for developers', 'post-snippets'); ?></em>)</h2>
|
2 |
|
3 |
<p>
|
4 |
You can add constants to wp-config.php or the theme’s functions.php file to control some aspects of the plugin. Available constants to set are:
|
12 |
</code></pre>
|
13 |
|
14 |
<p>
|
15 |
+
<?php _e('You can retrieve a Post Snippet directly from PHP, in a theme for instance, by using the PostSnippets::getSnippet() method.', 'post-snippets'); ?>
|
16 |
</p>
|
17 |
|
18 |
+
<h2><?php _e('Usage', 'post-snippets'); ?></h2>
|
19 |
<p>
|
20 |
<code>
|
21 |
<?php $my_snippet = PostSnippets::getSnippet( $snippet_name, $snippet_vars ); ?>
|
22 |
</code></p>
|
23 |
|
24 |
+
<h2><?php _e('Parameters', 'post-snippets'); ?></h2>
|
25 |
<p>
|
26 |
<strong>$snippet_name</strong><br/>
|
27 |
+
<?php _e('(string) (required) The name of the snippet to retrieve.', 'post-snippets'); ?>
|
28 |
<br/><br/>
|
29 |
<strong>$snippet_vars</strong><br/>
|
30 |
+
<?php _e('(string) The variables to pass to the snippet, formatted as a query string.', 'post-snippets'); ?>
|
31 |
</p>
|
32 |
|
33 |
|
34 |
+
<h2><?php _e('Example', 'post-snippets'); ?></h2>
|
35 |
|
36 |
<pre><code>// Use querystring for variables
|
37 |
$mySnippet = PostSnippets::getSnippet('internal-link', 'title=Awesome&url=2011/02/awesome/');
|
views/help/filters.php
CHANGED
@@ -1,14 +1,14 @@
|
|
1 |
-
<h2><?php _e('Filters',
|
2 |
|
3 |
-
<p><?php _e('The following filters are available for hooking into the plugin:',
|
4 |
|
5 |
<ul>
|
6 |
-
<li><strong>post_snippets_import</strong> <em>serialized array</em> <?php _e('Modify snippets and related data before the imported file populates the snippets.',
|
7 |
-
<li><strong>post_snippets_export</strong> <em>serialized array</em> <?php _e('Modify snippets and related data before the export file is created.',
|
8 |
-
<li><strong>post_snippets_snippets_list</strong> <em>array</em> <?php _e('Modify the array of snippets that are used as the snippet list for the jQuery UI dialog in the edit post screen.',
|
9 |
</ul>
|
10 |
|
11 |
-
<h3><?php _e('Examples',
|
12 |
|
13 |
<strong>post_snippets_export</strong>
|
14 |
<pre><code>// Filter Exported Snippets
|
1 |
+
<h2><?php _e('Filters', 'post-snippets'); ?> (<em><?php _e('for developers', 'post-snippets'); ?></em>)</h2>
|
2 |
|
3 |
+
<p><?php _e('The following filters are available for hooking into the plugin:', 'post-snippets'); ?></p>
|
4 |
|
5 |
<ul>
|
6 |
+
<li><strong>post_snippets_import</strong> <em>serialized array</em> <?php _e('Modify snippets and related data before the imported file populates the snippets.', 'post-snippets'); ?></li>
|
7 |
+
<li><strong>post_snippets_export</strong> <em>serialized array</em> <?php _e('Modify snippets and related data before the export file is created.', 'post-snippets'); ?></li>
|
8 |
+
<li><strong>post_snippets_snippets_list</strong> <em>array</em> <?php _e('Modify the array of snippets that are used as the snippet list for the jQuery UI dialog in the edit post screen.', 'post-snippets'); ?></li>
|
9 |
</ul>
|
10 |
|
11 |
+
<h3><?php _e('Examples', 'post-snippets'); ?></h3>
|
12 |
|
13 |
<strong>post_snippets_export</strong>
|
14 |
<pre><code>// Filter Exported Snippets
|
views/help/php.php
CHANGED
@@ -1,25 +1,25 @@
|
|
1 |
<h2>PHP Code</h2>
|
2 |
|
3 |
<p>
|
4 |
-
<?php _e('Snippets defined as shortcodes can optionally also be evaluated as PHP Code by enabling the PHP checkbox. PHP snippets is only available when treating the snippet as a shortcode.',
|
5 |
</p>
|
6 |
|
7 |
<p>
|
8 |
-
<?php _e('Check this image for an example PHP snippet:',
|
9 |
</p>
|
10 |
|
11 |
<img src="<?php echo plugins_url('assets/img/help/php-snippet.jpg', PostSnippets::FILE); ?>" />
|
12 |
|
13 |
<p>
|
14 |
-
<?php _e('With a snippet defined like the one above, you can call it with its shortcode definition in a post. Let\'s pretend that the example snippet is named phpcode and have one variable defined loop_me, then it would be called like this from a post:',
|
15 |
</p>
|
16 |
|
17 |
<code>[phpcode loop_me="post snippet with PHP!"]</code>
|
18 |
|
19 |
<p>
|
20 |
-
<?php _e('When the shortcode is executed the loop_me variable will be replaced with the string supplied in the shortcode and then the PHP code will be evaluated. (Outputting the string five times in this case. Wow!)',
|
21 |
</p>
|
22 |
|
23 |
<p>
|
24 |
-
<?php _e('Note the evaluation order, any snippet variables will be replaced before the snippet is evaluated as PHP code. Also note that a PHP snippet don\'t need to be wrapped in <?php #code; ?>.',
|
25 |
</p>
|
1 |
<h2>PHP Code</h2>
|
2 |
|
3 |
<p>
|
4 |
+
<?php _e('Snippets defined as shortcodes can optionally also be evaluated as PHP Code by enabling the PHP checkbox. PHP snippets is only available when treating the snippet as a shortcode.', 'post-snippets'); ?>
|
5 |
</p>
|
6 |
|
7 |
<p>
|
8 |
+
<?php _e('Check this image for an example PHP snippet:', 'post-snippets'); ?>
|
9 |
</p>
|
10 |
|
11 |
<img src="<?php echo plugins_url('assets/img/help/php-snippet.jpg', PostSnippets::FILE); ?>" />
|
12 |
|
13 |
<p>
|
14 |
+
<?php _e('With a snippet defined like the one above, you can call it with its shortcode definition in a post. Let\'s pretend that the example snippet is named phpcode and have one variable defined loop_me, then it would be called like this from a post:', 'post-snippets'); ?>
|
15 |
</p>
|
16 |
|
17 |
<code>[phpcode loop_me="post snippet with PHP!"]</code>
|
18 |
|
19 |
<p>
|
20 |
+
<?php _e('When the shortcode is executed the loop_me variable will be replaced with the string supplied in the shortcode and then the PHP code will be evaluated. (Outputting the string five times in this case. Wow!)', 'post-snippets'); ?>
|
21 |
</p>
|
22 |
|
23 |
<p>
|
24 |
+
<?php _e('Note the evaluation order, any snippet variables will be replaced before the snippet is evaluated as PHP code. Also note that a PHP snippet don\'t need to be wrapped in <?php #code; ?>.', 'post-snippets'); ?>
|
25 |
</p>
|
views/help/post.php
CHANGED
@@ -1,13 +1,13 @@
|
|
1 |
-
<h2><?php _e('The Post Editor',
|
2 |
|
3 |
<img src="<?php echo plugins_url('assets/img/help/post-snippets-editor.jpg', PostSnippets::FILE); ?>" />
|
4 |
|
5 |
<p>
|
6 |
-
<?php _e('With your snippets set up, you\'ll find a new button in your post editor (circled in the image above), which you can click to open the Post Snippet window to insert one of your snippets in your post.',
|
7 |
</p>
|
8 |
|
9 |
<img src="<?php echo plugins_url('assets/img/help/post-snippets-window.jpg', PostSnippets::FILE); ?>" />
|
10 |
|
11 |
<p>
|
12 |
-
<?php _e('When you click this button, you get a window with all your available snippets. Each snippet has its own tab in the Post Snippet window, so you can select which snippet to insert. If you have set up custom variables for the snippet, you can now enter the values for these variables before clicking insert and they will be inserted in the correct places in the snippet string.',
|
13 |
</p>
|
1 |
+
<h2><?php _e('The Post Editor', 'post-snippets'); ?></h2>
|
2 |
|
3 |
<img src="<?php echo plugins_url('assets/img/help/post-snippets-editor.jpg', PostSnippets::FILE); ?>" />
|
4 |
|
5 |
<p>
|
6 |
+
<?php _e('With your snippets set up, you\'ll find a new button in your post editor (circled in the image above), which you can click to open the Post Snippet window to insert one of your snippets in your post.', 'post-snippets'); ?>
|
7 |
</p>
|
8 |
|
9 |
<img src="<?php echo plugins_url('assets/img/help/post-snippets-window.jpg', PostSnippets::FILE); ?>" />
|
10 |
|
11 |
<p>
|
12 |
+
<?php _e('When you click this button, you get a window with all your available snippets. Each snippet has its own tab in the Post Snippet window, so you can select which snippet to insert. If you have set up custom variables for the snippet, you can now enter the values for these variables before clicking insert and they will be inserted in the correct places in the snippet string.', 'post-snippets'); ?>
|
13 |
</p>
|
views/help/sidebar.php
CHANGED
@@ -1,15 +1,15 @@
|
|
1 |
<p><strong>
|
2 |
-
<?php _e('Related:',
|
3 |
</strong></p>
|
4 |
|
5 |
<p><a href="http://wordpress.org/support/plugin/post-snippets" target="_blank"><?php
|
6 |
-
_e('Support Forums',
|
7 |
?></a></p>
|
8 |
|
9 |
<p><a href="https://github.com/artstorm/post-snippets" target="_blank"><?php
|
10 |
-
_e('GitHub Repository',
|
11 |
?></a></p>
|
12 |
|
13 |
<p><a href="http://johansteen.se/donate/" target="_blank"><?php
|
14 |
-
_e('Donate',
|
15 |
?></a></p>
|
1 |
<p><strong>
|
2 |
+
<?php _e('Related:', 'post-snippets'); ?>
|
3 |
</strong></p>
|
4 |
|
5 |
<p><a href="http://wordpress.org/support/plugin/post-snippets" target="_blank"><?php
|
6 |
+
_e('Support Forums', 'post-snippets');
|
7 |
?></a></p>
|
8 |
|
9 |
<p><a href="https://github.com/artstorm/post-snippets" target="_blank"><?php
|
10 |
+
_e('GitHub Repository', 'post-snippets');
|
11 |
?></a></p>
|
12 |
|
13 |
<p><a href="http://johansteen.se/donate/" target="_blank"><?php
|
14 |
+
_e('Donate', 'post-snippets');
|
15 |
?></a></p>
|
views/help/translators.php
DELETED
@@ -1,36 +0,0 @@
|
|
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,62 +1,62 @@
|
|
1 |
-
<h2><?php _e('Usage',
|
2 |
|
3 |
|
4 |
-
<h3><?php _e('Title',
|
5 |
<p>
|
6 |
-
<?php _e('Give the snippet a title that helps you identify it in the post editor. This also becomes the name of the shortcode if you enable that option.',
|
7 |
</p>
|
8 |
|
9 |
|
10 |
-
<h3><?php _e('Variables',
|
11 |
<p>
|
12 |
-
<?php _e('A comma separated list of custom variables you can reference in your snippet. A variable can also be assigned a default value that will be used in the insert window by using the equal sign, variable=default.',
|
13 |
</p>
|
14 |
|
15 |
<p>
|
16 |
-
<strong><?php _e('Example',
|
17 |
<pre><code>url,name,role=user,title</code></pre>
|
18 |
</p>
|
19 |
|
20 |
|
21 |
-
<h3><?php _e('Snippet',
|
22 |
<p>
|
23 |
-
<?php _e('This is the block of text, HTML or PHP to insert in the post or as a shortcode. If you have entered predefined variables you can reference them from the snippet by enclosing them in {} brackets.',
|
24 |
</p>
|
25 |
|
26 |
-
<p><strong><?php _e('Example',
|
27 |
-
<p><?php _e('To reference the variables in the example above, you would enter {url} and {name}. So if you enter this snippet:',
|
28 |
-
<p><?php _e('So if you enter this snippet:',
|
29 |
|
30 |
<pre><code>This is the website of <a href="{url}">{name}</a></code></pre>
|
31 |
|
32 |
-
<p><?php _e('You will get the option to replace url and name on insert if they are defined as variables.',
|
33 |
|
34 |
|
35 |
-
<h3><?php _e('Description',
|
36 |
<p>
|
37 |
-
<?php _e('An optional description for the Snippet. If filled out, the description will be displayed in the snippets insert window in the post editor.',
|
38 |
</p>
|
39 |
|
40 |
|
41 |
-
<h3><?php _e('Shortcode',
|
42 |
<p>
|
43 |
-
<?php _e('When enabling the shortcode checkbox, the snippet is no longer inserted directly but instead inserted as a shortcode. The obvious advantage of this is of course that you can insert a block of text or code in many places on the site, and update the content from one single place.',
|
44 |
</p>
|
45 |
|
46 |
<p>
|
47 |
-
<?php _e('The name to use the shortcode is the same as the title of the snippet (spaces are not allowed). When inserting a shortcode snippet, the shortcode and not the content will be inserted in the post.',
|
48 |
</p>
|
49 |
|
50 |
<p>
|
51 |
-
<?php _e('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.',
|
52 |
</p>
|
53 |
|
54 |
-
<h3><?php _e('PHP Code',
|
55 |
<p>
|
56 |
-
<?php _e('See the dedicated help section for information about PHP shortcodes.',
|
57 |
</p>
|
58 |
|
59 |
<h3>wptexturize</h3>
|
60 |
<p>
|
61 |
-
<?php printf(__('Before the shortcode is outputted, it can optionally be formatted with %s, to transform quotes to smart quotes, apostrophes, dashes, ellipses, the trademark symbol, and the multiplication symbol.',
|
62 |
</p>
|
1 |
+
<h2><?php _e('Usage', 'post-snippets'); ?></h2>
|
2 |
|
3 |
|
4 |
+
<h3><?php _e('Title', 'post-snippets'); ?></h3>
|
5 |
<p>
|
6 |
+
<?php _e('Give the snippet a title that helps you identify it in the post editor. This also becomes the name of the shortcode if you enable that option.', 'post-snippets'); ?>
|
7 |
</p>
|
8 |
|
9 |
|
10 |
+
<h3><?php _e('Variables', 'post-snippets'); ?></h3>
|
11 |
<p>
|
12 |
+
<?php _e('A comma separated list of custom variables you can reference in your snippet. A variable can also be assigned a default value that will be used in the insert window by using the equal sign, variable=default.', 'post-snippets'); ?>
|
13 |
</p>
|
14 |
|
15 |
<p>
|
16 |
+
<strong><?php _e('Example', 'post-snippets'); ?></strong>
|
17 |
<pre><code>url,name,role=user,title</code></pre>
|
18 |
</p>
|
19 |
|
20 |
|
21 |
+
<h3><?php _e('Snippet', 'post-snippets'); ?></h3>
|
22 |
<p>
|
23 |
+
<?php _e('This is the block of text, HTML or PHP to insert in the post or as a shortcode. If you have entered predefined variables you can reference them from the snippet by enclosing them in {} brackets.', 'post-snippets'); ?>
|
24 |
</p>
|
25 |
|
26 |
+
<p><strong><?php _e('Example', 'post-snippets'); ?></strong></p>
|
27 |
+
<p><?php _e('To reference the variables in the example above, you would enter {url} and {name}. So if you enter this snippet:', 'post-snippets'); ?></p>
|
28 |
+
<p><?php _e('So if you enter this snippet:', 'post-snippets'); ?></p>
|
29 |
|
30 |
<pre><code>This is the website of <a href="{url}">{name}</a></code></pre>
|
31 |
|
32 |
+
<p><?php _e('You will get the option to replace url and name on insert if they are defined as variables.', 'post-snippets'); ?></p>
|
33 |
|
34 |
|
35 |
+
<h3><?php _e('Description', 'post-snippets'); ?></h3>
|
36 |
<p>
|
37 |
+
<?php _e('An optional description for the Snippet. If filled out, the description will be displayed in the snippets insert window in the post editor.', 'post-snippets'); ?>
|
38 |
</p>
|
39 |
|
40 |
|
41 |
+
<h3><?php _e('Shortcode', 'post-snippets'); ?></h3>
|
42 |
<p>
|
43 |
+
<?php _e('When enabling the shortcode checkbox, the snippet is no longer inserted directly but instead inserted as a shortcode. The obvious advantage of this is of course that you can insert a block of text or code in many places on the site, and update the content from one single place.', 'post-snippets'); ?>
|
44 |
</p>
|
45 |
|
46 |
<p>
|
47 |
+
<?php _e('The name to use the shortcode is the same as the title of the snippet (spaces are not allowed). When inserting a shortcode snippet, the shortcode and not the content will be inserted in the post.', 'post-snippets'); ?>
|
48 |
</p>
|
49 |
|
50 |
<p>
|
51 |
+
<?php _e('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'); ?>
|
52 |
</p>
|
53 |
|
54 |
+
<h3><?php _e('PHP Code', 'post-snippets'); ?></h3>
|
55 |
<p>
|
56 |
+
<?php _e('See the dedicated help section for information about PHP shortcodes.', 'post-snippets'); ?>
|
57 |
</p>
|
58 |
|
59 |
<h3>wptexturize</h3>
|
60 |
<p>
|
61 |
+
<?php printf(__('Before the shortcode is outputted, it can optionally be formatted with %s, to transform quotes to smart quotes, apostrophes, dashes, ellipses, the trademark symbol, and the multiplication symbol.', 'post-snippets'), '<a href="http://codex.wordpress.org/Function_Reference/wptexturize">wptexturize</a>'); ?>
|
62 |
</p>
|
views/jquery-ui-dialog.php
CHANGED
@@ -12,7 +12,8 @@
|
|
12 |
<li><a href="#ps-tabs-<?php echo $key;
|
13 |
?>"><?php echo $snippet['title'];
|
14 |
?></a></li>
|
15 |
-
<?php
|
|
|
16 |
} ?>
|
17 |
</ul>
|
18 |
|
@@ -28,7 +29,8 @@
|
|
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
|
@@ -54,22 +56,25 @@
|
|
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.',
|
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 -->
|
12 |
<li><a href="#ps-tabs-<?php echo $key;
|
13 |
?>"><?php echo $snippet['title'];
|
14 |
?></a></li>
|
15 |
+
<?php
|
16 |
+
|
17 |
} ?>
|
18 |
</ul>
|
19 |
|
29 |
?>
|
30 |
<p class="howto"><?php echo $snippet['description'];
|
31 |
?></p>
|
32 |
+
<?php
|
33 |
+
|
34 |
}
|
35 |
|
36 |
// Get all variables defined for the snippet and output them as
|
56 |
?>" value="<?php echo $def;
|
57 |
?>" style="width: 190px" />
|
58 |
<br/>
|
59 |
+
<?php
|
60 |
+
|
61 |
}
|
62 |
} else {
|
63 |
// If no variables and no description available, output a text
|
64 |
// to inform the user that it's an insert snippet only.
|
65 |
if (empty($snippet['description'])) {
|
66 |
?>
|
67 |
+
<p class="howto"><?php _e('This snippet is insert only, no variables defined.', 'post-snippets');
|
68 |
?></p>
|
69 |
+
<?php
|
70 |
+
|
71 |
}
|
72 |
}
|
73 |
?>
|
74 |
</div><!-- #ps-tabs-<?php echo $key;
|
75 |
?> -->
|
76 |
+
<?php
|
77 |
+
|
78 |
}
|
79 |
// Close the tabs and dialog divs ?>
|
80 |
</div><!-- #post-snippets-tabs -->
|