Version Description
Download this release
Release Info
Developer | artstorm |
Plugin | Post Snippets |
Version | 2.3.5 |
Comparing to | |
See all releases |
Code changes from version 2.3.4 to 2.3.5
- assets/img/help/php-snippet.jpg +0 -0
- assets/img/help/post-snippets-editor.jpg +0 -0
- assets/img/help/post-snippets-window.jpg +0 -0
- lang/post-snippets.pot +135 -78
- post-snippets.php +2 -2
- readme.txt +7 -2
- src/PostSnippets/Help.php +60 -54
- src/PostSnippets/View.php +6 -6
- src/PostSnippets/WPEditor.php +14 -5
- views/help/advanced.php +42 -0
- views/help/filters.php +37 -0
- views/{help_php.php → help/php.php} +11 -10
- views/help/post.php +13 -0
- views/{help_sidebar.php → help/sidebar.php} +6 -6
- views/help/usage.php +62 -0
- views/help_advanced.php +0 -26
- views/help_basic.php +0 -32
- views/help_shortcode.php +0 -19
assets/img/help/php-snippet.jpg
ADDED
Binary file
|
assets/img/help/post-snippets-editor.jpg
ADDED
Binary file
|
assets/img/help/post-snippets-window.jpg
ADDED
Binary file
|
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:
|
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"
|
@@ -18,29 +18,29 @@ msgstr ""
|
|
18 |
"Content-Transfer-Encoding: 8bit\n"
|
19 |
|
20 |
#: views/admin_snippets.php:8 views/admin_snippets.php:17
|
21 |
-
#: views/
|
22 |
msgid "Title"
|
23 |
msgstr ""
|
24 |
|
25 |
#: views/admin_snippets.php:9 views/admin_snippets.php:18
|
26 |
-
#: views/
|
27 |
msgid "Variables"
|
28 |
msgstr ""
|
29 |
|
30 |
#: views/admin_snippets.php:10 views/admin_snippets.php:19
|
31 |
-
#: views/
|
32 |
msgid "Snippet"
|
33 |
msgstr ""
|
34 |
|
35 |
-
#: views/admin_snippets.php:39
|
36 |
msgid "Shortcode"
|
37 |
msgstr ""
|
38 |
|
39 |
-
#: views/admin_snippets.php:46
|
40 |
msgid "PHP Code"
|
41 |
msgstr ""
|
42 |
|
43 |
-
#: views/admin_snippets.php:58 views/
|
44 |
msgid "Description"
|
45 |
msgstr ""
|
46 |
|
@@ -56,83 +56,85 @@ msgstr ""
|
|
56 |
msgid "Delete Selected"
|
57 |
msgstr ""
|
58 |
|
59 |
-
#: views/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
msgid ""
|
61 |
"You can retrieve a Post Snippet directly from PHP, in a theme for instance, "
|
62 |
"by using the PostSnippets::getSnippet() method."
|
63 |
msgstr ""
|
64 |
|
65 |
-
#: views/
|
66 |
msgid "Usage"
|
67 |
msgstr ""
|
68 |
|
69 |
-
#: views/
|
70 |
msgid "Parameters"
|
71 |
msgstr ""
|
72 |
|
73 |
-
#: views/
|
74 |
msgid "(string) (required) The name of the snippet to retrieve."
|
75 |
msgstr ""
|
76 |
|
77 |
-
#: views/
|
78 |
msgid ""
|
79 |
"(string) The variables to pass to the snippet, formatted as a query string."
|
80 |
msgstr ""
|
81 |
|
82 |
-
#: views/
|
83 |
msgid "Example"
|
84 |
msgstr ""
|
85 |
|
86 |
-
#: views/
|
87 |
-
msgid ""
|
88 |
-
"Give the snippet a title that helps you identify it in the post editor. This "
|
89 |
-
"also becomes the name of the shortcode if you enable that option"
|
90 |
msgstr ""
|
91 |
|
92 |
-
#: views/
|
93 |
-
msgid ""
|
94 |
-
"A comma separated list of custom variables you can reference in your "
|
95 |
-
"snippet. A variable can also be assigned a default value that will be used "
|
96 |
-
"in the insert window by using the equal sign, variable=default."
|
97 |
msgstr ""
|
98 |
|
99 |
-
#: views/
|
100 |
msgid ""
|
101 |
-
"
|
102 |
-
"
|
103 |
-
"from the snippet by enclosing them in {} brackets."
|
104 |
msgstr ""
|
105 |
|
106 |
-
#: views/
|
107 |
-
msgid ""
|
108 |
-
"To reference the variables in the example above, you would enter {url} and "
|
109 |
-
"{name}. So if you enter this snippet:"
|
110 |
msgstr ""
|
111 |
|
112 |
-
#: views/
|
113 |
msgid ""
|
114 |
-
"
|
115 |
-
"
|
116 |
msgstr ""
|
117 |
|
118 |
-
#: views/
|
119 |
-
msgid ""
|
120 |
-
"An optional description for the Snippet. If filled out, the description will "
|
121 |
-
"be displayed in the snippets insert window in the post editor."
|
122 |
msgstr ""
|
123 |
|
124 |
-
#: views/
|
125 |
msgid ""
|
126 |
"Snippets defined as shortcodes can optionally also be evaluated as PHP Code "
|
127 |
"by enabling the PHP checkbox. PHP snippets is only available when treating "
|
128 |
"the snippet as a shortcode."
|
129 |
msgstr ""
|
130 |
|
131 |
-
#: views/
|
132 |
-
msgid "
|
133 |
msgstr ""
|
134 |
|
135 |
-
#: views/
|
136 |
msgid ""
|
137 |
"With a snippet defined like the one above, you can call it with its "
|
138 |
"shortcode definition in a post. Let's pretend that the example snippet is "
|
@@ -140,21 +142,100 @@ msgid ""
|
|
140 |
"like this from a post:"
|
141 |
msgstr ""
|
142 |
|
143 |
-
#: views/
|
144 |
msgid ""
|
145 |
"When the shortcode is executed the loop_me variable will be replaced with "
|
146 |
"the string supplied in the shortcode and then the PHP code will be "
|
147 |
"evaluated. (Outputting the string five times in this case. Wow!)"
|
148 |
msgstr ""
|
149 |
|
150 |
-
#: views/
|
151 |
msgid ""
|
152 |
"Note the evaluation order, any snippet variables will be replaced before the "
|
153 |
"snippet is evaluated as PHP code. Also note that a PHP snippet don't need to "
|
154 |
"be wrapped in <?php #code; ?>."
|
155 |
msgstr ""
|
156 |
|
157 |
-
#: views/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
158 |
msgid ""
|
159 |
"When enabling the shortcode checkbox, the snippet is no longer inserted "
|
160 |
"directly but instead inserted as a shortcode. The obvious advantage of this "
|
@@ -162,29 +243,25 @@ msgid ""
|
|
162 |
"the site, and update the content from one single place."
|
163 |
msgstr ""
|
164 |
|
165 |
-
#: views/
|
166 |
msgid ""
|
167 |
"The name to use the shortcode is the same as the title of the snippet "
|
168 |
"(spaces are not allowed). When inserting a shortcode snippet, the shortcode "
|
169 |
"and not the content will be inserted in the post."
|
170 |
msgstr ""
|
171 |
|
172 |
-
#: views/
|
173 |
msgid ""
|
174 |
"If you enclose the shortcode in your posts, you can access the enclosed "
|
175 |
"content by using the variable {content} in your snippet. The {content} "
|
176 |
"variable is reserved, so don't use it in the variables field."
|
177 |
msgstr ""
|
178 |
|
179 |
-
#: views/
|
180 |
-
msgid "Options"
|
181 |
-
msgstr ""
|
182 |
-
|
183 |
-
#: views/help_shortcode.php:15
|
184 |
msgid "See the dedicated help section for information about PHP shortcodes."
|
185 |
msgstr ""
|
186 |
|
187 |
-
#: views/
|
188 |
#, php-format
|
189 |
msgid ""
|
190 |
"Before the shortcode is outputted, it can optionally be formatted with %s, "
|
@@ -192,26 +269,6 @@ msgid ""
|
|
192 |
"trademark symbol, and the multiplication symbol."
|
193 |
msgstr ""
|
194 |
|
195 |
-
#: views/help_sidebar.php:2
|
196 |
-
msgid "For more information:"
|
197 |
-
msgstr ""
|
198 |
-
|
199 |
-
#: views/help_sidebar.php:6
|
200 |
-
msgid "Documentation"
|
201 |
-
msgstr ""
|
202 |
-
|
203 |
-
#: views/help_sidebar.php:10
|
204 |
-
msgid "Support Forums"
|
205 |
-
msgstr ""
|
206 |
-
|
207 |
-
#: views/help_sidebar.php:14
|
208 |
-
msgid "GitHub Contribution"
|
209 |
-
msgstr ""
|
210 |
-
|
211 |
-
#: views/jquery-ui-dialog.php:47
|
212 |
-
msgid "This snippet is insert only, no variables defined."
|
213 |
-
msgstr ""
|
214 |
-
|
215 |
#: src/PostSnippets/Admin.php:40
|
216 |
msgid "Settings"
|
217 |
msgstr ""
|
@@ -275,16 +332,16 @@ msgstr ""
|
|
275 |
msgid "Update"
|
276 |
msgstr ""
|
277 |
|
278 |
-
#: src/PostSnippets/
|
279 |
-
msgid "
|
280 |
msgstr ""
|
281 |
|
282 |
-
#: src/PostSnippets/Help.php:
|
283 |
-
msgid "
|
284 |
msgstr ""
|
285 |
|
286 |
-
#: src/PostSnippets/Help.php:
|
287 |
-
msgid "
|
288 |
msgstr ""
|
289 |
|
290 |
#: src/PostSnippets/ImportExport.php:38
|
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"
|
18 |
"Content-Transfer-Encoding: 8bit\n"
|
19 |
|
20 |
#: views/admin_snippets.php:8 views/admin_snippets.php:17
|
21 |
+
#: views/help/usage.php:4
|
22 |
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 |
|
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 |
+
|
63 |
+
#: views/help/advanced.php:1 src/PostSnippets/Help.php:73
|
64 |
+
msgid "Advanced"
|
65 |
+
msgstr ""
|
66 |
+
|
67 |
+
#: views/help/advanced.php:1 views/help/filters.php:1
|
68 |
+
msgid "for developers"
|
69 |
+
msgstr ""
|
70 |
+
|
71 |
+
#: views/help/advanced.php:15
|
72 |
msgid ""
|
73 |
"You can retrieve a Post Snippet directly from PHP, in a theme for instance, "
|
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 |
|
81 |
+
#: views/help/advanced.php:24
|
82 |
msgid "Parameters"
|
83 |
msgstr ""
|
84 |
|
85 |
+
#: views/help/advanced.php:27
|
86 |
msgid "(string) (required) The name of the snippet to retrieve."
|
87 |
msgstr ""
|
88 |
|
89 |
+
#: views/help/advanced.php:30
|
90 |
msgid ""
|
91 |
"(string) The variables to pass to the snippet, formatted as a query string."
|
92 |
msgstr ""
|
93 |
|
94 |
+
#: views/help/advanced.php:34 views/help/usage.php:16 views/help/usage.php:26
|
95 |
msgid "Example"
|
96 |
msgstr ""
|
97 |
|
98 |
+
#: views/help/filters.php:1 src/PostSnippets/Help.php:80
|
99 |
+
msgid "Filters"
|
|
|
|
|
100 |
msgstr ""
|
101 |
|
102 |
+
#: views/help/filters.php:3
|
103 |
+
msgid "The following filters are available for hooking into the plugin:"
|
|
|
|
|
|
|
104 |
msgstr ""
|
105 |
|
106 |
+
#: views/help/filters.php:6
|
107 |
msgid ""
|
108 |
+
"Modify snippets and related data before the imported file populates the "
|
109 |
+
"snippets."
|
|
|
110 |
msgstr ""
|
111 |
|
112 |
+
#: views/help/filters.php:7
|
113 |
+
msgid "Modify snippets and related data before the export file is created."
|
|
|
|
|
114 |
msgstr ""
|
115 |
|
116 |
+
#: views/help/filters.php:8
|
117 |
msgid ""
|
118 |
+
"Modify the array of snippets that are used as the snippet list for the "
|
119 |
+
"jQuery UI dialog in the edit post screen."
|
120 |
msgstr ""
|
121 |
|
122 |
+
#: views/help/filters.php:11
|
123 |
+
msgid "Examples"
|
|
|
|
|
124 |
msgstr ""
|
125 |
|
126 |
+
#: views/help/php.php:4
|
127 |
msgid ""
|
128 |
"Snippets defined as shortcodes can optionally also be evaluated as PHP Code "
|
129 |
"by enabling the PHP checkbox. PHP snippets is only available when treating "
|
130 |
"the snippet as a shortcode."
|
131 |
msgstr ""
|
132 |
|
133 |
+
#: views/help/php.php:8
|
134 |
+
msgid "Check this image for an example PHP snippet:"
|
135 |
msgstr ""
|
136 |
|
137 |
+
#: views/help/php.php:14
|
138 |
msgid ""
|
139 |
"With a snippet defined like the one above, you can call it with its "
|
140 |
"shortcode definition in a post. Let's pretend that the example snippet is "
|
142 |
"like this from a post:"
|
143 |
msgstr ""
|
144 |
|
145 |
+
#: views/help/php.php:20
|
146 |
msgid ""
|
147 |
"When the shortcode is executed the loop_me variable will be replaced with "
|
148 |
"the string supplied in the shortcode and then the PHP code will be "
|
149 |
"evaluated. (Outputting the string five times in this case. Wow!)"
|
150 |
msgstr ""
|
151 |
|
152 |
+
#: views/help/php.php:24
|
153 |
msgid ""
|
154 |
"Note the evaluation order, any snippet variables will be replaced before the "
|
155 |
"snippet is evaluated as PHP code. Also note that a PHP snippet don't need to "
|
156 |
"be wrapped in <?php #code; ?>."
|
157 |
msgstr ""
|
158 |
|
159 |
+
#: views/help/post.php:1 views/help/usage.php:1
|
160 |
+
msgid "The Post Editor"
|
161 |
+
msgstr ""
|
162 |
+
|
163 |
+
#: views/help/post.php:6
|
164 |
+
msgid ""
|
165 |
+
"With your snippets set up, you'll find a new button in your post editor "
|
166 |
+
"(circled in the image above), which you can click to open the Post Snippet "
|
167 |
+
"window to insert one of your snippets in your post."
|
168 |
+
msgstr ""
|
169 |
+
|
170 |
+
#: views/help/post.php:12
|
171 |
+
msgid ""
|
172 |
+
"When you click this button, you get a window with all your available "
|
173 |
+
"snippets. Each snippet has its own tab in the Post Snippet window, so you "
|
174 |
+
"can select which snippet to insert. If you have set up custom variables for "
|
175 |
+
"the snippet, you can now enter the values for these variables before "
|
176 |
+
"clicking insert and they will be inserted in the correct places in the "
|
177 |
+
"snippet string."
|
178 |
+
msgstr ""
|
179 |
+
|
180 |
+
#: views/help/sidebar.php:2
|
181 |
+
msgid "Related:"
|
182 |
+
msgstr ""
|
183 |
+
|
184 |
+
#: views/help/sidebar.php:6
|
185 |
+
msgid "Support Forums"
|
186 |
+
msgstr ""
|
187 |
+
|
188 |
+
#: views/help/sidebar.php:10
|
189 |
+
msgid "GitHub Repository"
|
190 |
+
msgstr ""
|
191 |
+
|
192 |
+
#: views/help/sidebar.php:14
|
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 "
|
199 |
+
"also becomes the name of the shortcode if you enable that option."
|
200 |
+
msgstr ""
|
201 |
+
|
202 |
+
#: views/help/usage.php:12
|
203 |
+
msgid ""
|
204 |
+
"A comma separated list of custom variables you can reference in your "
|
205 |
+
"snippet. A variable can also be assigned a default value that will be used "
|
206 |
+
"in the insert window by using the equal sign, variable=default."
|
207 |
+
msgstr ""
|
208 |
+
|
209 |
+
#: views/help/usage.php:23
|
210 |
+
msgid ""
|
211 |
+
"This is the block of text, HTML or PHP to insert in the post or as a "
|
212 |
+
"shortcode. If you have entered predefined variables you can reference them "
|
213 |
+
"from the snippet by enclosing them in {} brackets."
|
214 |
+
msgstr ""
|
215 |
+
|
216 |
+
#: views/help/usage.php:27
|
217 |
+
msgid ""
|
218 |
+
"To reference the variables in the example above, you would enter {url} and "
|
219 |
+
"{name}. So if you enter this snippet:"
|
220 |
+
msgstr ""
|
221 |
+
|
222 |
+
#: views/help/usage.php:28
|
223 |
+
msgid "So if you enter this snippet:"
|
224 |
+
msgstr ""
|
225 |
+
|
226 |
+
#: views/help/usage.php:32
|
227 |
+
msgid ""
|
228 |
+
"You will get the option to replace url and name on insert if they are "
|
229 |
+
"defined as variables."
|
230 |
+
msgstr ""
|
231 |
+
|
232 |
+
#: views/help/usage.php:37
|
233 |
+
msgid ""
|
234 |
+
"An optional description for the Snippet. If filled out, the description will "
|
235 |
+
"be displayed in the snippets insert window in the post editor."
|
236 |
+
msgstr ""
|
237 |
+
|
238 |
+
#: views/help/usage.php:43
|
239 |
msgid ""
|
240 |
"When enabling the shortcode checkbox, the snippet is no longer inserted "
|
241 |
"directly but instead inserted as a shortcode. The obvious advantage of this "
|
243 |
"the site, and update the content from one single place."
|
244 |
msgstr ""
|
245 |
|
246 |
+
#: views/help/usage.php:47
|
247 |
msgid ""
|
248 |
"The name to use the shortcode is the same as the title of the snippet "
|
249 |
"(spaces are not allowed). When inserting a shortcode snippet, the shortcode "
|
250 |
"and not the content will be inserted in the post."
|
251 |
msgstr ""
|
252 |
|
253 |
+
#: views/help/usage.php:51
|
254 |
msgid ""
|
255 |
"If you enclose the shortcode in your posts, you can access the enclosed "
|
256 |
"content by using the variable {content} in your snippet. The {content} "
|
257 |
"variable is reserved, so don't use it in the variables field."
|
258 |
msgstr ""
|
259 |
|
260 |
+
#: views/help/usage.php:56
|
|
|
|
|
|
|
|
|
261 |
msgid "See the dedicated help section for information about PHP shortcodes."
|
262 |
msgstr ""
|
263 |
|
264 |
+
#: views/help/usage.php:61
|
265 |
#, php-format
|
266 |
msgid ""
|
267 |
"Before the shortcode is outputted, it can optionally be formatted with %s, "
|
269 |
"trademark symbol, and the multiplication symbol."
|
270 |
msgstr ""
|
271 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
272 |
#: src/PostSnippets/Admin.php:40
|
273 |
msgid "Settings"
|
274 |
msgstr ""
|
332 |
msgid "Update"
|
333 |
msgstr ""
|
334 |
|
335 |
+
#: src/PostSnippets/Admin.php:395
|
336 |
+
msgid "Options"
|
337 |
msgstr ""
|
338 |
|
339 |
+
#: src/PostSnippets/Help.php:57
|
340 |
+
msgid "Post Editor"
|
341 |
msgstr ""
|
342 |
|
343 |
+
#: src/PostSnippets/Help.php:65
|
344 |
+
msgid "PHP"
|
345 |
msgstr ""
|
346 |
|
347 |
#: src/PostSnippets/ImportExport.php:38
|
post-snippets.php
CHANGED
@@ -5,11 +5,11 @@ 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-
|
13 |
|
14 |
This program is free software; you can redistribute it and/or modify
|
15 |
it under the terms of the GNU General Public License as published by
|
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 |
|
12 |
+
Copyright 2009-2015 Johan Steen (email : artstorm [at] gmail [dot] com)
|
13 |
|
14 |
This program is free software; you can redistribute it and/or modify
|
15 |
it under the terms of the GNU General Public License as published by
|
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.
|
7 |
-
Stable tag: 2.3.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -121,6 +121,11 @@ Contributions are appreciated and encouraged.
|
|
121 |
|
122 |
== Changelog ==
|
123 |
|
|
|
|
|
|
|
|
|
|
|
124 |
= Version 2.3.4 - 20 Sep 2014 =
|
125 |
* Tested up to WordPress v4.0.
|
126 |
* Update Swedish translation.
|
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 |
|
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.
|
127 |
+
* Adds complete plugin usage documentation to the settings help tab.
|
128 |
+
|
129 |
= Version 2.3.4 - 20 Sep 2014 =
|
130 |
* Tested up to WordPress v4.0.
|
131 |
* Update Swedish translation.
|
src/PostSnippets/Help.php
CHANGED
@@ -8,37 +8,54 @@
|
|
8 |
class PostSnippets_Help
|
9 |
{
|
10 |
/**
|
11 |
-
*
|
12 |
*
|
13 |
-
* @
|
14 |
-
* @
|
15 |
*/
|
16 |
public function __construct($optionPage)
|
17 |
{
|
18 |
-
add_action('load-'.$optionPage, array(&$this,'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
}
|
20 |
|
21 |
/**
|
22 |
* Setup the help tabs and sidebar.
|
23 |
*
|
24 |
-
* @
|
25 |
*/
|
26 |
-
public function
|
27 |
{
|
28 |
$screen = get_current_screen();
|
29 |
-
$screen->set_help_sidebar($this->
|
30 |
$screen->add_help_tab(
|
31 |
array(
|
32 |
-
'id' => '
|
33 |
-
'title' => __('
|
34 |
-
'content' => $this->
|
35 |
)
|
36 |
);
|
37 |
$screen->add_help_tab(
|
38 |
array(
|
39 |
-
'id' => '
|
40 |
-
'title' => __('
|
41 |
-
'content' => $this->
|
42 |
)
|
43 |
);
|
44 |
if (!defined('POST_SNIPPETS_DISABLE_PHP')) {
|
@@ -46,7 +63,7 @@ class PostSnippets_Help
|
|
46 |
array(
|
47 |
'id' => 'php-plugin-help',
|
48 |
'title' => __('PHP', PostSnippets::TEXT_DOMAIN),
|
49 |
-
'content' => $this->
|
50 |
)
|
51 |
);
|
52 |
}
|
@@ -54,58 +71,47 @@ class PostSnippets_Help
|
|
54 |
array(
|
55 |
'id' => 'advanced-plugin-help',
|
56 |
'title' => __('Advanced', PostSnippets::TEXT_DOMAIN),
|
57 |
-
'content' => $this->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
)
|
59 |
);
|
60 |
}
|
61 |
|
62 |
/**
|
63 |
-
*
|
64 |
-
*
|
65 |
-
* @return
|
66 |
-
*/
|
67 |
-
public function helpSidebar()
|
68 |
-
{
|
69 |
-
return PostSnippets_View::render('help_sidebar');
|
70 |
-
}
|
71 |
-
|
72 |
-
/**
|
73 |
-
* The basic help tab.
|
74 |
-
*
|
75 |
-
* @return string The help text
|
76 |
-
*/
|
77 |
-
public function helpBasic()
|
78 |
-
{
|
79 |
-
return PostSnippets_View::render('help_basic');
|
80 |
-
}
|
81 |
-
|
82 |
-
/**
|
83 |
-
* The shortcode help tab.
|
84 |
-
*
|
85 |
-
* @return string The help text
|
86 |
*/
|
87 |
-
public function
|
88 |
{
|
89 |
-
|
90 |
-
}
|
91 |
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
return PostSnippets_View::render('help_php');
|
100 |
}
|
101 |
|
102 |
/**
|
103 |
-
*
|
104 |
-
*
|
105 |
-
* @
|
|
|
106 |
*/
|
107 |
-
|
108 |
{
|
109 |
-
return PostSnippets_View::render(
|
|
|
|
|
|
|
110 |
}
|
111 |
}
|
8 |
class PostSnippets_Help
|
9 |
{
|
10 |
/**
|
11 |
+
* Define actions.
|
12 |
*
|
13 |
+
* @param string
|
14 |
+
* @return void
|
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 |
+
/**
|
25 |
+
* Load the post editor tab in the admin_head filter.
|
26 |
+
*
|
27 |
+
* We load the tab that will integrate in the post editor help menu via the
|
28 |
+
* admin_head hook, as we are not otherwise able to make it get ordered
|
29 |
+
* below the native help tabs.
|
30 |
+
*
|
31 |
+
* @return void.
|
32 |
+
*/
|
33 |
+
public function postEditor()
|
34 |
+
{
|
35 |
+
add_action('admin_head', array(&$this,'postEditorTabs'));
|
36 |
}
|
37 |
|
38 |
/**
|
39 |
* Setup the help tabs and sidebar.
|
40 |
*
|
41 |
+
* @return void
|
42 |
*/
|
43 |
+
public function tabs()
|
44 |
{
|
45 |
$screen = get_current_screen();
|
46 |
+
$screen->set_help_sidebar($this->content('help/sidebar'));
|
47 |
$screen->add_help_tab(
|
48 |
array(
|
49 |
+
'id' => 'usage-plugin-help',
|
50 |
+
'title' => __('Usage', PostSnippets::TEXT_DOMAIN),
|
51 |
+
'content' => $this->content('help/usage')
|
52 |
)
|
53 |
);
|
54 |
$screen->add_help_tab(
|
55 |
array(
|
56 |
+
'id' => 'post-plugin-help',
|
57 |
+
'title' => __('Post Editor', PostSnippets::TEXT_DOMAIN),
|
58 |
+
'content' => $this->content('help/post')
|
59 |
)
|
60 |
);
|
61 |
if (!defined('POST_SNIPPETS_DISABLE_PHP')) {
|
63 |
array(
|
64 |
'id' => 'php-plugin-help',
|
65 |
'title' => __('PHP', PostSnippets::TEXT_DOMAIN),
|
66 |
+
'content' => $this->content('help/php')
|
67 |
)
|
68 |
);
|
69 |
}
|
71 |
array(
|
72 |
'id' => 'advanced-plugin-help',
|
73 |
'title' => __('Advanced', PostSnippets::TEXT_DOMAIN),
|
74 |
+
'content' => $this->content('help/advanced')
|
75 |
+
)
|
76 |
+
);
|
77 |
+
$screen->add_help_tab(
|
78 |
+
array(
|
79 |
+
'id' => 'filters-plugin-help',
|
80 |
+
'title' => __('Filters', PostSnippets::TEXT_DOMAIN),
|
81 |
+
'content' => $this->content('help/filters')
|
82 |
)
|
83 |
);
|
84 |
}
|
85 |
|
86 |
/**
|
87 |
+
* Setup the help tab for the post editor.
|
88 |
+
*
|
89 |
+
* @return void
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
90 |
*/
|
91 |
+
public function postEditorTabs()
|
92 |
{
|
93 |
+
$screen = get_current_screen();
|
|
|
94 |
|
95 |
+
$screen->add_help_tab(
|
96 |
+
array(
|
97 |
+
'id' => 'postsnippets-plugin-help',
|
98 |
+
'title' => 'Post Snippets',
|
99 |
+
'content' => $this->content('help/post')
|
100 |
+
)
|
101 |
+
);
|
|
|
102 |
}
|
103 |
|
104 |
/**
|
105 |
+
* Get the content for a help tab
|
106 |
+
*
|
107 |
+
* @param string $tab
|
108 |
+
* @return string
|
109 |
*/
|
110 |
+
private function content($tab)
|
111 |
{
|
112 |
+
return PostSnippets_View::render(
|
113 |
+
$tab,
|
114 |
+
array('td' => PostSnippets::TEXT_DOMAIN)
|
115 |
+
);
|
116 |
}
|
117 |
}
|
src/PostSnippets/View.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
4 |
*
|
5 |
* @author Johan Steen <artstorm at gmail dot com>
|
6 |
* @link http://johansteen.se/
|
@@ -9,16 +9,16 @@ class PostSnippets_View
|
|
9 |
{
|
10 |
/**
|
11 |
* Render a View.
|
12 |
-
*
|
13 |
-
* @param string $view
|
14 |
-
* @param array $data
|
15 |
-
* @return string
|
16 |
*/
|
17 |
public static function render($view, $data = null)
|
18 |
{
|
19 |
// Handle data
|
20 |
($data) ? extract($data) : null;
|
21 |
-
|
22 |
ob_start();
|
23 |
include(plugin_dir_path(__FILE__).'../../views/'.$view.'.php');
|
24 |
$view = ob_get_contents();
|
1 |
<?php
|
2 |
/**
|
3 |
+
* View Handling.
|
4 |
*
|
5 |
* @author Johan Steen <artstorm at gmail dot com>
|
6 |
* @link http://johansteen.se/
|
9 |
{
|
10 |
/**
|
11 |
* Render a View.
|
12 |
+
*
|
13 |
+
* @param string $view
|
14 |
+
* @param array $data
|
15 |
+
* @return string
|
16 |
*/
|
17 |
public static function render($view, $data = null)
|
18 |
{
|
19 |
// Handle data
|
20 |
($data) ? extract($data) : null;
|
21 |
+
|
22 |
ob_start();
|
23 |
include(plugin_dir_path(__FILE__).'../../views/'.$view.'.php');
|
24 |
$view = ob_get_contents();
|
src/PostSnippets/WPEditor.php
CHANGED
@@ -161,11 +161,15 @@ class PostSnippets_WPEditor
|
|
161 |
{
|
162 |
echo "\n<!-- START: Post Snippets jQuery UI and related functions -->\n";
|
163 |
echo "<script type='text/javascript'>\n";
|
164 |
-
|
165 |
# Prepare the snippets and shortcodes into javascript variables
|
166 |
# so they can be inserted into the editor, and get the variables replaced
|
167 |
# with user defined strings.
|
168 |
$snippets = get_option(PostSnippets::OPTION_KEY, array());
|
|
|
|
|
|
|
|
|
169 |
foreach ($snippets as $key => $snippet) {
|
170 |
if ($snippet['shortcode']) {
|
171 |
# Build a long string of the variables, ie: varname1={varname1} varname2={varname2}
|
@@ -198,7 +202,7 @@ class PostSnippets_WPEditor
|
|
198 |
}
|
199 |
}
|
200 |
?>
|
201 |
-
|
202 |
jQuery(document).ready(function($){
|
203 |
<?php
|
204 |
# Create js variables for all form fields
|
@@ -212,7 +216,7 @@ class PostSnippets_WPEditor
|
|
212 |
}
|
213 |
}
|
214 |
?>
|
215 |
-
|
216 |
var tabs = $("#post-snippets-tabs").tabs();
|
217 |
|
218 |
$(function() {
|
@@ -298,14 +302,19 @@ class PostSnippets_WPEditor
|
|
298 |
*/
|
299 |
public function addJqueryUiDialog()
|
300 |
{
|
301 |
-
$
|
|
|
|
|
|
|
|
|
|
|
302 |
echo PostSnippets_View::render('jquery-ui-dialog', $data);
|
303 |
}
|
304 |
|
305 |
/**
|
306 |
* Strip Default Value.
|
307 |
*
|
308 |
-
* Checks if a variable string contains a default value, and if it does it
|
309 |
* will strip it away and return the string with only the variable name
|
310 |
* kept.
|
311 |
*
|
161 |
{
|
162 |
echo "\n<!-- START: Post Snippets jQuery UI and related functions -->\n";
|
163 |
echo "<script type='text/javascript'>\n";
|
164 |
+
|
165 |
# Prepare the snippets and shortcodes into javascript variables
|
166 |
# so they can be inserted into the editor, and get the variables replaced
|
167 |
# with user defined strings.
|
168 |
$snippets = get_option(PostSnippets::OPTION_KEY, array());
|
169 |
+
|
170 |
+
//Let other plugins change the snippets array
|
171 |
+
$snippets = apply_filters('post_snippets_snippets_list', $snippets);
|
172 |
+
|
173 |
foreach ($snippets as $key => $snippet) {
|
174 |
if ($snippet['shortcode']) {
|
175 |
# Build a long string of the variables, ie: varname1={varname1} varname2={varname2}
|
202 |
}
|
203 |
}
|
204 |
?>
|
205 |
+
|
206 |
jQuery(document).ready(function($){
|
207 |
<?php
|
208 |
# Create js variables for all form fields
|
216 |
}
|
217 |
}
|
218 |
?>
|
219 |
+
|
220 |
var tabs = $("#post-snippets-tabs").tabs();
|
221 |
|
222 |
$(function() {
|
302 |
*/
|
303 |
public function addJqueryUiDialog()
|
304 |
{
|
305 |
+
$snippets = get_option(PostSnippets::OPTION_KEY, array());
|
306 |
+
|
307 |
+
//Let other plugins change the snippets array
|
308 |
+
$snippets = apply_filters('post_snippets_snippets_list', $snippets);
|
309 |
+
$data = array('snippets' => $snippets);
|
310 |
+
|
311 |
echo PostSnippets_View::render('jquery-ui-dialog', $data);
|
312 |
}
|
313 |
|
314 |
/**
|
315 |
* Strip Default Value.
|
316 |
*
|
317 |
+
* Checks if a variable string contains a default value, and if it does it
|
318 |
* will strip it away and return the string with only the variable name
|
319 |
* kept.
|
320 |
*
|
views/help/advanced.php
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<h2><?php _e('Advanced', $td); ?> (<em><?php _e('for developers', $td); ?></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:
|
5 |
+
</p>
|
6 |
+
|
7 |
+
<pre><code>// Allow users with edit_posts capability access to the Post Snippets admin.
|
8 |
+
define('POST_SNIPPETS_ALLOW_EDIT_POSTS', true);
|
9 |
+
|
10 |
+
// Disable PHP Execution in snippets, and removes the options from admin.
|
11 |
+
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.', PostSnippets::TEXT_DOMAIN); ?>
|
16 |
+
</p>
|
17 |
+
|
18 |
+
<h2><?php _e('Usage', PostSnippets::TEXT_DOMAIN); ?></h2>
|
19 |
+
<p>
|
20 |
+
<code>
|
21 |
+
<?php $my_snippet = PostSnippets::getSnippet( $snippet_name, $snippet_vars ); ?>
|
22 |
+
</code></p>
|
23 |
+
|
24 |
+
<h2><?php _e('Parameters', PostSnippets::TEXT_DOMAIN); ?></h2>
|
25 |
+
<p>
|
26 |
+
<strong>$snippet_name</strong><br/>
|
27 |
+
<?php _e('(string) (required) The name of the snippet to retrieve.', PostSnippets::TEXT_DOMAIN); ?>
|
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.', PostSnippets::TEXT_DOMAIN); ?>
|
31 |
+
</p>
|
32 |
+
|
33 |
+
|
34 |
+
<h2><?php _e('Example', PostSnippets::TEXT_DOMAIN); ?></h2>
|
35 |
+
|
36 |
+
<pre><code>// Use querystring for variables
|
37 |
+
$mySnippet = PostSnippets::getSnippet('internal-link', 'title=Awesome&url=2011/02/awesome/');
|
38 |
+
echo $mySnippet;
|
39 |
+
|
40 |
+
// Use array for variables
|
41 |
+
$mySnippet = PostSnippets::getSnippet('internal-link', array('title' => 'Awesome', 'url' => '2011/02/awesome/');
|
42 |
+
echo $mySnippet;</code></pre>
|
views/help/filters.php
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<h2><?php _e('Filters', $td); ?> (<em><?php _e('for developers', $td); ?></em>)</h2>
|
2 |
+
|
3 |
+
<p><?php _e('The following filters are available for hooking into the plugin:', $td); ?></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.', $td); ?></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.', $td); ?></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.', $td); ?></li>
|
9 |
+
</ul>
|
10 |
+
|
11 |
+
<h3><?php _e('Examples', $td); ?></h3>
|
12 |
+
|
13 |
+
<strong>post_snippets_export</strong>
|
14 |
+
<pre><code>// Filter Exported Snippets
|
15 |
+
function ps_export( $snippets )
|
16 |
+
{
|
17 |
+
$snippets = unserialize( $snippets );
|
18 |
+
foreach ( $snippets as &$snippet ) {
|
19 |
+
// Do something here. Example below search and replaces in snippets
|
20 |
+
$snippet['snippet'] = str_replace('search','replace', $snippet['snippet']);
|
21 |
+
}
|
22 |
+
return serialize( $snippets );
|
23 |
+
}
|
24 |
+
add_filter( 'post_snippets_export', 'ps_export' );</code></pre>
|
25 |
+
|
26 |
+
<strong>post_snippets_import</strong>
|
27 |
+
<pre><code>// Filter Imported Snippets
|
28 |
+
function ps_import( $snippets )
|
29 |
+
{
|
30 |
+
$snippets = unserialize( $snippets );
|
31 |
+
foreach ( $snippets as &$snippet ) {
|
32 |
+
// Do something here. Example below search and replaces in variables
|
33 |
+
$snippet['vars'] = str_replace('search', 'replace', $snippet['vars']);
|
34 |
+
}
|
35 |
+
return serialize( $snippets );
|
36 |
+
}
|
37 |
+
add_filter( 'post_snippets_import', 'ps_import' );</code></pre>
|
views/{help_php.php → help/php.php}
RENAMED
@@ -1,24 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
<p>
|
2 |
-
<?php _e('
|
3 |
</p>
|
4 |
|
5 |
-
<
|
6 |
-
<code>
|
7 |
-
for ($i=1; $i<5; $i++) {<br/>
|
8 |
-
echo "{loop_me}<br/>";<br/>
|
9 |
-
};
|
10 |
-
</code></p>
|
11 |
|
12 |
<p>
|
13 |
-
<?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:',
|
14 |
</p>
|
15 |
|
16 |
<code>[phpcode loop_me="post snippet with PHP!"]</code>
|
17 |
|
18 |
<p>
|
19 |
-
<?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!)',
|
20 |
</p>
|
21 |
|
22 |
<p>
|
23 |
-
<?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; ?>.',
|
24 |
</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.', $td); ?>
|
5 |
+
</p>
|
6 |
+
|
7 |
<p>
|
8 |
+
<?php _e('Check this image for an example PHP snippet:', $td); ?>
|
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:', $td); ?>
|
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!)', $td); ?>
|
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; ?>.', $td); ?>
|
25 |
</p>
|
views/help/post.php
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<h2><?php _e('The Post Editor', $td); ?></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.', $td); ?>
|
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.', $td); ?>
|
13 |
+
</p>
|
views/{help_sidebar.php → help/sidebar.php}
RENAMED
@@ -1,15 +1,15 @@
|
|
1 |
<p><strong>
|
2 |
-
<?php _e('
|
3 |
</strong></p>
|
4 |
|
5 |
-
<p><a href="http://johansteen.se/code/post-snippets/" target="_blank"><?php
|
6 |
-
_e('Documentation', PostSnippets::TEXT_DOMAIN);
|
7 |
-
?></a></p>
|
8 |
-
|
9 |
<p><a href="http://wordpress.org/support/plugin/post-snippets" target="_blank"><?php
|
10 |
_e('Support Forums', PostSnippets::TEXT_DOMAIN);
|
11 |
?></a></p>
|
12 |
|
13 |
<p><a href="https://github.com/artstorm/post-snippets" target="_blank"><?php
|
14 |
-
_e('GitHub
|
|
|
|
|
|
|
|
|
15 |
?></a></p>
|
1 |
<p><strong>
|
2 |
+
<?php _e('Related:', PostSnippets::TEXT_DOMAIN); ?>
|
3 |
</strong></p>
|
4 |
|
|
|
|
|
|
|
|
|
5 |
<p><a href="http://wordpress.org/support/plugin/post-snippets" target="_blank"><?php
|
6 |
_e('Support Forums', PostSnippets::TEXT_DOMAIN);
|
7 |
?></a></p>
|
8 |
|
9 |
<p><a href="https://github.com/artstorm/post-snippets" target="_blank"><?php
|
10 |
+
_e('GitHub Repository', PostSnippets::TEXT_DOMAIN);
|
11 |
+
?></a></p>
|
12 |
+
|
13 |
+
<p><a href="http://johansteen.se/donate/" target="_blank"><?php
|
14 |
+
_e('Donate', PostSnippets::TEXT_DOMAIN);
|
15 |
?></a></p>
|
views/help/usage.php
ADDED
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<h2><?php _e('The Post Editor', $td); ?></h2>
|
2 |
+
|
3 |
+
|
4 |
+
<h3><?php _e('Title', $td); ?></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.', $td); ?>
|
7 |
+
</p>
|
8 |
+
|
9 |
+
|
10 |
+
<h3><?php _e('Variables', $td); ?></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.', $td); ?>
|
13 |
+
</p>
|
14 |
+
|
15 |
+
<p>
|
16 |
+
<strong><?php _e('Example', $td); ?></strong>
|
17 |
+
<pre><code>url,name,role=user,title</code></pre>
|
18 |
+
</p>
|
19 |
+
|
20 |
+
|
21 |
+
<h3><?php _e('Snippet', $td); ?></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.', $td); ?>
|
24 |
+
</p>
|
25 |
+
|
26 |
+
<p><strong><?php _e('Example', $td); ?></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:', $td); ?></p>
|
28 |
+
<p><?php _e('So if you enter this snippet:', $td); ?></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.', $td); ?></p>
|
33 |
+
|
34 |
+
|
35 |
+
<h3><?php _e('Description', $td); ?></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.', $td); ?>
|
38 |
+
</p>
|
39 |
+
|
40 |
+
|
41 |
+
<h3><?php _e('Shortcode', $td); ?></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.', $td); ?>
|
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.', $td); ?>
|
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.', $td); ?>
|
52 |
+
</p>
|
53 |
+
|
54 |
+
<h3><?php _e('PHP Code', $td); ?></h3>
|
55 |
+
<p>
|
56 |
+
<?php _e('See the dedicated help section for information about PHP shortcodes.', $td); ?>
|
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.', $td), '<a href="http://codex.wordpress.org/Function_Reference/wptexturize">wptexturize</a>'); ?>
|
62 |
+
</p>
|
views/help_advanced.php
DELETED
@@ -1,26 +0,0 @@
|
|
1 |
-
<p>
|
2 |
-
<?php _e('You can retrieve a Post Snippet directly from PHP, in a theme for instance, by using the PostSnippets::getSnippet() method.', PostSnippets::TEXT_DOMAIN); ?>
|
3 |
-
</p>
|
4 |
-
|
5 |
-
<h2><?php _e('Usage', PostSnippets::TEXT_DOMAIN); ?></h2>
|
6 |
-
<p>
|
7 |
-
<code>
|
8 |
-
<?php $my_snippet = PostSnippets::getSnippet( $snippet_name, $snippet_vars ); ?>
|
9 |
-
</code></p>
|
10 |
-
|
11 |
-
<h2><?php _e('Parameters', PostSnippets::TEXT_DOMAIN); ?></h2>
|
12 |
-
<p>
|
13 |
-
<code>$snippet_name</code><br/>
|
14 |
-
<?php _e('(string) (required) The name of the snippet to retrieve.', PostSnippets::TEXT_DOMAIN); ?>
|
15 |
-
<br/><br/>
|
16 |
-
<code>$snippet_vars</code><br/>
|
17 |
-
<?php _e('(string) The variables to pass to the snippet, formatted as a query string.', PostSnippets::TEXT_DOMAIN); ?>
|
18 |
-
</p>
|
19 |
-
|
20 |
-
<h2><?php _e('Example', PostSnippets::TEXT_DOMAIN); ?></h2>
|
21 |
-
<p><code>
|
22 |
-
<?php<br/>
|
23 |
-
$my_snippet = PostSnippets::getSnippet( 'internal-link', 'title=Awesome&url=2011/02/awesome/' );<br/>
|
24 |
-
echo $my_snippet;<br/>
|
25 |
-
?>
|
26 |
-
</code></p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
views/help_basic.php
DELETED
@@ -1,32 +0,0 @@
|
|
1 |
-
<h2><?php _e('Title', PostSnippets::TEXT_DOMAIN); ?></h2>
|
2 |
-
<p>
|
3 |
-
<?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', PostSnippets::TEXT_DOMAIN); ?>
|
4 |
-
</p>
|
5 |
-
|
6 |
-
<h2><?php _e('Variables', PostSnippets::TEXT_DOMAIN); ?></h2>
|
7 |
-
<p>
|
8 |
-
<?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.', PostSnippets::TEXT_DOMAIN); ?>
|
9 |
-
</p>
|
10 |
-
|
11 |
-
<p>
|
12 |
-
<strong><?php _e('Example', PostSnippets::TEXT_DOMAIN); ?></strong><br/>
|
13 |
-
<code>url,name,role=user,title</code>
|
14 |
-
</p>
|
15 |
-
|
16 |
-
<h2><?php _e('Snippet', PostSnippets::TEXT_DOMAIN); ?></h2>
|
17 |
-
<p>
|
18 |
-
<?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.', PostSnippets::TEXT_DOMAIN); ?>
|
19 |
-
</p>
|
20 |
-
|
21 |
-
<p><strong><?php _e('Example', PostSnippets::TEXT_DOMAIN); ?></strong><br/>
|
22 |
-
<?php _e('To reference the variables in the example above, you would enter {url} and {name}. So if you enter this snippet:', PostSnippets::TEXT_DOMAIN); ?>
|
23 |
-
<br/>
|
24 |
-
<code>This is the website of <a href="{url}">{name}</a></code>
|
25 |
-
<br/>
|
26 |
-
<?php _e('You will get the option to replace url and name on insert if they are defined as variables.', PostSnippets::TEXT_DOMAIN); ?>
|
27 |
-
</p>
|
28 |
-
|
29 |
-
<h2><?php _e('Description', PostSnippets::TEXT_DOMAIN); ?></h2>
|
30 |
-
<p>
|
31 |
-
<?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.', PostSnippets::TEXT_DOMAIN); ?>
|
32 |
-
</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
views/help_shortcode.php
DELETED
@@ -1,19 +0,0 @@
|
|
1 |
-
<p>
|
2 |
-
<?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.', PostSnippets::TEXT_DOMAIN); ?>
|
3 |
-
</p>
|
4 |
-
|
5 |
-
<p>
|
6 |
-
<?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.', PostSnippets::TEXT_DOMAIN); ?>
|
7 |
-
</p>
|
8 |
-
|
9 |
-
<p>
|
10 |
-
<?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.', PostSnippets::TEXT_DOMAIN); ?>
|
11 |
-
</p>
|
12 |
-
|
13 |
-
<h2><?php _e('Options', PostSnippets::TEXT_DOMAIN); ?></h2>
|
14 |
-
<p><strong>PHP</strong><br/>
|
15 |
-
<?php _e('See the dedicated help section for information about PHP shortcodes.', PostSnippets::TEXT_DOMAIN); ?>
|
16 |
-
</p>
|
17 |
-
<p><strong>wptexturize</strong><br/>
|
18 |
-
<?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.', PostSnippets::TEXT_DOMAIN), '<a href="http://codex.wordpress.org/Function_Reference/wptexturize">wptexturize</a>'); ?>
|
19 |
-
</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|