Version Description
Download this release
Release Info
Developer | artstorm |
Plugin | Post Snippets |
Version | 1.8.8 |
Comparing to | |
See all releases |
Code changes from version 1.8.7 to 1.8.8
- classes/settings.php +117 -0
- languages/post-snippets.pot +218 -222
- post-snippets.php +129 -126
- readme.txt +13 -6
- tests/phpunit.xml +11 -0
- tests/post-snippets-test.php +65 -0
classes/settings.php
ADDED
@@ -0,0 +1,117 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Post Snippets Settings.
|
4 |
+
*
|
5 |
+
* Class that renders out the HTML for the settings screen and contains helpful
|
6 |
+
* methods to simply the maintainance of the admin screen.
|
7 |
+
*
|
8 |
+
* @package Post Snippets
|
9 |
+
* @author Johan Steen <artstorm at gmail dot com>
|
10 |
+
* @since Post Snippets 1.8.8
|
11 |
+
*/
|
12 |
+
class Post_Snippets_Settings
|
13 |
+
{
|
14 |
+
|
15 |
+
private $plugin_options;
|
16 |
+
|
17 |
+
public function set_options( $options )
|
18 |
+
{
|
19 |
+
$this->plugin_options = $options;
|
20 |
+
}
|
21 |
+
|
22 |
+
public function render()
|
23 |
+
{
|
24 |
+
?>
|
25 |
+
<div class=wrap>
|
26 |
+
<h2>Post Snippets</h2>
|
27 |
+
|
28 |
+
<form method="post" action="">
|
29 |
+
<?php wp_nonce_field('update-options'); ?>
|
30 |
+
|
31 |
+
<div class="tablenav">
|
32 |
+
<div class="alignleft actions">
|
33 |
+
<input type="submit" name="add-snippet" value="<?php _e( 'Add New Snippet', 'post-snippets' ) ?>" class="button-secondary" />
|
34 |
+
<input type="submit" name="delete-selected" value="<?php _e( 'Delete Selected', 'post-snippets' ) ?>" class="button-secondary" />
|
35 |
+
<span class="description"><?php _e( '(Use the help dropdown button above for additional information.)', 'post-snippets' ); ?></span>
|
36 |
+
</div>
|
37 |
+
</div>
|
38 |
+
<div class="clear"></div>
|
39 |
+
|
40 |
+
<table class="widefat fixed" cellspacing="0">
|
41 |
+
<thead>
|
42 |
+
<tr>
|
43 |
+
<th scope="col" class="check-column"><input type="checkbox" /></th>
|
44 |
+
<th scope="col" style="width: 180px;"><?php _e( 'Title', 'post-snippets' ) ?></th>
|
45 |
+
<th scope="col" style="width: 180px;"><?php _e( 'Variables', 'post-snippets' ) ?></th>
|
46 |
+
<th scope="col"><?php _e( 'Snippet', 'post-snippets' ) ?></th>
|
47 |
+
</tr>
|
48 |
+
</thead>
|
49 |
+
|
50 |
+
<tfoot>
|
51 |
+
<tr>
|
52 |
+
<th scope="col" class="check-column"><input type="checkbox" /></th>
|
53 |
+
<th scope="col"><?php _e( 'Title', 'post-snippets' ) ?></th>
|
54 |
+
<th scope="col"><?php _e( 'Variables', 'post-snippets' ) ?></th>
|
55 |
+
<th scope="col"><?php _e( 'Snippet', 'post-snippets' ) ?></th>
|
56 |
+
</tr>
|
57 |
+
</tfoot>
|
58 |
+
|
59 |
+
<tbody>
|
60 |
+
<?php
|
61 |
+
// $snippets = get_option($this->plugin_options);
|
62 |
+
$snippets = $this->plugin_options;
|
63 |
+
if (!empty($snippets)) {
|
64 |
+
for ($i=0; $i < count($snippets); $i++) { ?>
|
65 |
+
<tr class='recent'>
|
66 |
+
<th scope='row' class='check-column'><input type='checkbox' name='checked[]' value='<?php echo $i; ?>' /></th>
|
67 |
+
<td class='row-title'>
|
68 |
+
<input type='text' name='<?php echo $i; ?>_title' value='<?php echo $snippets[$i]['title']; ?>' />
|
69 |
+
</td>
|
70 |
+
<td class='name'>
|
71 |
+
<input type='text' name='<?php echo $i; ?>_vars' value='<?php echo $snippets[$i]['vars']; ?>' /><br/>
|
72 |
+
<?php
|
73 |
+
$this->checkbox(__('Shortcode', 'post-snippets'), $i.'_shortcode',
|
74 |
+
$snippets[$i]['shortcode']);
|
75 |
+
?>
|
76 |
+
<!-- <input type='checkbox' name='< ?php echo $i; ? >_php' value='true'< ?php if ($snippets[$i]['php'] == true) { echo " checked"; }? > /> < ?php _e( 'PHP Code', 'post-snippets' ) ? ><br/> -->
|
77 |
+
</td>
|
78 |
+
<td class='desc'>
|
79 |
+
<textarea name="<?php echo $i; ?>_snippet" class="large-text" style='width: 100%;' rows="5"><?php echo htmlspecialchars($snippets[$i]['snippet'], ENT_NOQUOTES); ?></textarea>
|
80 |
+
<?php _e( 'Description', 'post-snippets' ) ?>:
|
81 |
+
<input type='text' style='width: 100%;' name='<?php echo $i; ?>_description' value='<?php if (isset( $snippets[$i]['description'] ) ) echo esc_html($snippets[$i]['description']); ?>' /><br/>
|
82 |
+
</td>
|
83 |
+
</tr>
|
84 |
+
<?php
|
85 |
+
}
|
86 |
+
}
|
87 |
+
?>
|
88 |
+
</tbody>
|
89 |
+
</table>
|
90 |
+
<div class="submit">
|
91 |
+
<input type="submit" name="update-post-snippets" value="<?php _e( 'Update Snippets', 'post-snippets' ) ?>" class="button-primary" /></div>
|
92 |
+
</form>
|
93 |
+
</div>
|
94 |
+
<?php
|
95 |
+
}
|
96 |
+
|
97 |
+
// -------------------------------------------------------------------------
|
98 |
+
// HTML and Form element methods
|
99 |
+
// -------------------------------------------------------------------------
|
100 |
+
|
101 |
+
/**
|
102 |
+
* Checkbox.
|
103 |
+
* Renders the HTML for an input checkbox.
|
104 |
+
*
|
105 |
+
* @param string $label The label rendered to screen
|
106 |
+
* @param string $name The unique name to identify the input
|
107 |
+
* @param boolean $checked If the input is checked or not
|
108 |
+
*/
|
109 |
+
private function checkbox( $label, $name, $checked )
|
110 |
+
{
|
111 |
+
printf( '<input type="checkbox" name="%s" value="true"', $name );
|
112 |
+
if ($checked)
|
113 |
+
echo ' checked';
|
114 |
+
echo ' />';
|
115 |
+
echo ' '.$label.'<br/>';
|
116 |
+
}
|
117 |
+
}
|
languages/post-snippets.pot
CHANGED
@@ -1,222 +1,218 @@
|
|
1 |
-
# Translation Template for Post Snippets.
|
2 |
-
# Copyright (C) 2009-2011 Johan Steen
|
3 |
-
# This file is distributed under the same license as the PACKAGE package.
|
4 |
-
#
|
5 |
-
#, fuzzy
|
6 |
-
msgid ""
|
7 |
-
msgstr ""
|
8 |
-
"Project-Id-Version: Post Snippets\n"
|
9 |
-
"Report-Msgid-Bugs-To: http://wordpress.org/tag/post-snippets\n"
|
10 |
-
"POT-Creation-Date: 2011-
|
11 |
-
"
|
12 |
-
"
|
13 |
-
"
|
14 |
-
"
|
15 |
-
"Content-Type: text/plain; charset=
|
16 |
-
"Content-Transfer-Encoding: 8bit\n"
|
17 |
-
|
18 |
-
#:
|
19 |
-
msgid "
|
20 |
-
msgstr ""
|
21 |
-
|
22 |
-
#:
|
23 |
-
msgid "
|
24 |
-
msgstr ""
|
25 |
-
|
26 |
-
#:
|
27 |
-
msgid "
|
28 |
-
msgstr ""
|
29 |
-
|
30 |
-
#: post-snippets.php:
|
31 |
-
msgid "
|
32 |
-
msgstr ""
|
33 |
-
|
34 |
-
#: post-snippets.php:
|
35 |
-
msgid "
|
36 |
-
msgstr ""
|
37 |
-
|
38 |
-
#: post-snippets.php:
|
39 |
-
msgid "
|
40 |
-
msgstr ""
|
41 |
-
|
42 |
-
#:
|
43 |
-
msgid "
|
44 |
-
msgstr ""
|
45 |
-
|
46 |
-
#: post-snippets.php:
|
47 |
-
msgid ""
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
"
|
60 |
-
msgstr ""
|
61 |
-
|
62 |
-
#: post-snippets.php:
|
63 |
-
msgid "
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
"
|
71 |
-
"
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
msgstr ""
|
91 |
-
|
92 |
-
#: post-snippets.php:
|
93 |
-
msgid ""
|
94 |
-
"Treats the snippet as a shortcode. The name for the shortcode is the same as "
|
95 |
-
"the title of the snippet (spaces not allowed) and will be used on insert. If "
|
96 |
-
"you enclose the shortcode in your posts, you can access the enclosed content "
|
97 |
-
"by using the variable {content} in your snippet. The content variable is "
|
98 |
-
"reserved, so don't use it in the variables field."
|
99 |
-
msgstr ""
|
100 |
-
|
101 |
-
#: post-snippets.php:
|
102 |
-
msgid "Advanced"
|
103 |
-
msgstr ""
|
104 |
-
|
105 |
-
#: post-snippets.php:
|
106 |
-
msgid ""
|
107 |
-
"The snippets can be retrieved directly from PHP, in a theme for instance, "
|
108 |
-
"with the get_post_snippet() function. Visit the Post Snippets link under "
|
109 |
-
"more information for instructions."
|
110 |
-
msgstr ""
|
111 |
-
|
112 |
-
#: post-snippets.php:
|
113 |
-
msgid "For more information:"
|
114 |
-
msgstr ""
|
115 |
-
|
116 |
-
#: post-snippets.php:
|
117 |
-
msgid ""
|
118 |
-
"Visit my <a href=\"http://wpstorm.net/wordpress-plugins/post-snippets/"
|
119 |
-
"\">Post Snippets</a> page for additional information."
|
120 |
-
msgstr ""
|
121 |
-
|
122 |
-
#: post-snippets.php:
|
123 |
-
msgid "A snippet named Untitled has been added."
|
124 |
-
msgstr ""
|
125 |
-
|
126 |
-
#: post-snippets.php:
|
127 |
-
msgid "Snippets have been updated."
|
128 |
-
msgstr ""
|
129 |
-
|
130 |
-
#: post-snippets.php:
|
131 |
-
msgid "Selected snippets have been deleted."
|
132 |
-
msgstr ""
|
133 |
-
|
134 |
-
#: post-snippets.php:
|
135 |
-
msgid "
|
136 |
-
msgstr ""
|
137 |
-
|
138 |
-
#: post-snippets.php:
|
139 |
-
msgid "
|
140 |
-
msgstr ""
|
141 |
-
|
142 |
-
#: post-snippets.php:
|
143 |
-
msgid "
|
144 |
-
msgstr ""
|
145 |
-
|
146 |
-
#: post-snippets.php:
|
147 |
-
msgid "
|
148 |
-
msgstr ""
|
149 |
-
|
150 |
-
#: post-snippets.php:
|
151 |
-
msgid "
|
152 |
-
msgstr ""
|
153 |
-
|
154 |
-
#: post-snippets.php:
|
155 |
-
msgid "
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
"
|
178 |
-
msgstr ""
|
179 |
-
|
180 |
-
#: post-snippets.php:
|
181 |
-
msgid "
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
msgstr ""
|
191 |
-
|
192 |
-
#: post-snippets.php:
|
193 |
-
msgid "
|
194 |
-
msgstr ""
|
195 |
-
|
196 |
-
|
197 |
-
msgid "
|
198 |
-
msgstr ""
|
199 |
-
|
200 |
-
#. Plugin
|
201 |
-
msgid "
|
202 |
-
msgstr ""
|
203 |
-
|
204 |
-
#.
|
205 |
-
msgid "
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
"
|
214 |
-
msgstr ""
|
215 |
-
|
216 |
-
#. Author of the plugin/theme
|
217 |
-
msgid "
|
218 |
-
msgstr ""
|
219 |
-
|
220 |
-
#. Author URI of the plugin/theme
|
221 |
-
msgid "http://wpstorm.net/"
|
222 |
-
msgstr ""
|
1 |
+
# Translation Template for Post Snippets.
|
2 |
+
# Copyright (C) 2009-2011 Johan Steen
|
3 |
+
# This file is distributed under the same license as the PACKAGE package.
|
4 |
+
#
|
5 |
+
#, fuzzy
|
6 |
+
msgid ""
|
7 |
+
msgstr ""
|
8 |
+
"Project-Id-Version: Post Snippets\n"
|
9 |
+
"Report-Msgid-Bugs-To: http://wordpress.org/tag/post-snippets\n"
|
10 |
+
"POT-Creation-Date: 2011-12-28 01:19:09+00:00\n"
|
11 |
+
"MIME-Version: 1.0\n"
|
12 |
+
"PO-Revision-Date: 2010-MO-DA HO:MI+ZONE\n"
|
13 |
+
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
14 |
+
"Language-Team: <artstorm@gmail.com>\n"
|
15 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
16 |
+
"Content-Transfer-Encoding: 8bit\n"
|
17 |
+
|
18 |
+
#: classes/settings.php:33
|
19 |
+
msgid "Add New Snippet"
|
20 |
+
msgstr ""
|
21 |
+
|
22 |
+
#: classes/settings.php:34
|
23 |
+
msgid "Delete Selected"
|
24 |
+
msgstr ""
|
25 |
+
|
26 |
+
#: classes/settings.php:35
|
27 |
+
msgid "(Use the help dropdown button above for additional information.)"
|
28 |
+
msgstr ""
|
29 |
+
|
30 |
+
#: classes/settings.php:44 classes/settings.php:53 post-snippets.php:493
|
31 |
+
msgid "Title"
|
32 |
+
msgstr ""
|
33 |
+
|
34 |
+
#: classes/settings.php:45 classes/settings.php:54 post-snippets.php:496
|
35 |
+
msgid "Variables"
|
36 |
+
msgstr ""
|
37 |
+
|
38 |
+
#: classes/settings.php:46 classes/settings.php:55 post-snippets.php:499
|
39 |
+
msgid "Snippet"
|
40 |
+
msgstr ""
|
41 |
+
|
42 |
+
#: classes/settings.php:73 post-snippets.php:505
|
43 |
+
msgid "Shortcode"
|
44 |
+
msgstr ""
|
45 |
+
|
46 |
+
#: classes/settings.php:80 post-snippets.php:502
|
47 |
+
msgid "Description"
|
48 |
+
msgstr ""
|
49 |
+
|
50 |
+
#: classes/settings.php:91
|
51 |
+
msgid "Update Snippets"
|
52 |
+
msgstr ""
|
53 |
+
|
54 |
+
#: post-snippets.php:89
|
55 |
+
msgid "Settings"
|
56 |
+
msgstr ""
|
57 |
+
|
58 |
+
#: post-snippets.php:352
|
59 |
+
msgid "This snippet is insert only, no variables defined."
|
60 |
+
msgstr ""
|
61 |
+
|
62 |
+
#: post-snippets.php:494
|
63 |
+
msgid ""
|
64 |
+
"Give the snippet a title that helps you identify it in the post editor. If "
|
65 |
+
"you make it into a shortcode, this is the name of the shortcode as well."
|
66 |
+
msgstr ""
|
67 |
+
|
68 |
+
#: post-snippets.php:497
|
69 |
+
msgid ""
|
70 |
+
"A comma separated list of custom variables you can reference in your snippet."
|
71 |
+
"<br/><br/>Example:<br/>url,name"
|
72 |
+
msgstr ""
|
73 |
+
|
74 |
+
#: post-snippets.php:500
|
75 |
+
msgid ""
|
76 |
+
"This is the block of text or HTML to insert in the post when you select the "
|
77 |
+
"snippet from the insert button in the TinyMCE panel in the post editor. If "
|
78 |
+
"you have entered predefined variables you can reference them from the "
|
79 |
+
"snippet by enclosing them in {} brackets.<br/><br/>Example:<br/>To reference "
|
80 |
+
"the variables in the example above, you would enter {url} and {name}.<br/"
|
81 |
+
"><br/>So if you enter this snippet:<br/><i>This is the website of <a href="
|
82 |
+
"\"{url}\">{name}</a></i><br/>You will get the option to replace url "
|
83 |
+
"and name on insert if they are defined as variables."
|
84 |
+
msgstr ""
|
85 |
+
|
86 |
+
#: post-snippets.php:503
|
87 |
+
msgid ""
|
88 |
+
"An optional description for the Snippet. If entered it will be displayed in "
|
89 |
+
"the snippets popup window in the post editor."
|
90 |
+
msgstr ""
|
91 |
+
|
92 |
+
#: post-snippets.php:506
|
93 |
+
msgid ""
|
94 |
+
"Treats the snippet as a shortcode. The name for the shortcode is the same as "
|
95 |
+
"the title of the snippet (spaces not allowed) and will be used on insert. If "
|
96 |
+
"you enclose the shortcode in your posts, you can access the enclosed content "
|
97 |
+
"by using the variable {content} in your snippet. The content variable is "
|
98 |
+
"reserved, so don't use it in the variables field."
|
99 |
+
msgstr ""
|
100 |
+
|
101 |
+
#: post-snippets.php:508
|
102 |
+
msgid "Advanced"
|
103 |
+
msgstr ""
|
104 |
+
|
105 |
+
#: post-snippets.php:509
|
106 |
+
msgid ""
|
107 |
+
"The snippets can be retrieved directly from PHP, in a theme for instance, "
|
108 |
+
"with the get_post_snippet() function. Visit the Post Snippets link under "
|
109 |
+
"more information for instructions."
|
110 |
+
msgstr ""
|
111 |
+
|
112 |
+
#: post-snippets.php:511
|
113 |
+
msgid "For more information:"
|
114 |
+
msgstr ""
|
115 |
+
|
116 |
+
#: post-snippets.php:512
|
117 |
+
msgid ""
|
118 |
+
"Visit my <a href=\"http://wpstorm.net/wordpress-plugins/post-snippets/"
|
119 |
+
"\">Post Snippets</a> page for additional information."
|
120 |
+
msgstr ""
|
121 |
+
|
122 |
+
#: post-snippets.php:531
|
123 |
+
msgid "A snippet named Untitled has been added."
|
124 |
+
msgstr ""
|
125 |
+
|
126 |
+
#: post-snippets.php:558 post-snippets.php:708
|
127 |
+
msgid "Snippets have been updated."
|
128 |
+
msgstr ""
|
129 |
+
|
130 |
+
#: post-snippets.php:574
|
131 |
+
msgid "Selected snippets have been deleted."
|
132 |
+
msgstr ""
|
133 |
+
|
134 |
+
#: post-snippets.php:588
|
135 |
+
msgid "Import/Export"
|
136 |
+
msgstr ""
|
137 |
+
|
138 |
+
#: post-snippets.php:589
|
139 |
+
msgid "Export"
|
140 |
+
msgstr ""
|
141 |
+
|
142 |
+
#: post-snippets.php:591
|
143 |
+
msgid "Export your snippets for backup or to import them on another site."
|
144 |
+
msgstr ""
|
145 |
+
|
146 |
+
#: post-snippets.php:592
|
147 |
+
msgid "Export Snippets"
|
148 |
+
msgstr ""
|
149 |
+
|
150 |
+
#: post-snippets.php:678
|
151 |
+
msgid "Import"
|
152 |
+
msgstr ""
|
153 |
+
|
154 |
+
#: post-snippets.php:680
|
155 |
+
msgid ""
|
156 |
+
"Import snippets from a post-snippets-export.zip file. Importing overwrites "
|
157 |
+
"any existing snippets."
|
158 |
+
msgstr ""
|
159 |
+
|
160 |
+
#: post-snippets.php:684
|
161 |
+
msgid "Import Snippets"
|
162 |
+
msgstr ""
|
163 |
+
|
164 |
+
#: post-snippets.php:710
|
165 |
+
msgid "Snippets successfully imported."
|
166 |
+
msgstr ""
|
167 |
+
|
168 |
+
#: post-snippets.php:712 post-snippets.php:716 post-snippets.php:718
|
169 |
+
msgid "Snippets could not be imported:"
|
170 |
+
msgstr ""
|
171 |
+
|
172 |
+
#: post-snippets.php:712
|
173 |
+
msgid "Unzipping failed."
|
174 |
+
msgstr ""
|
175 |
+
|
176 |
+
#: post-snippets.php:718
|
177 |
+
msgid "Upload failed."
|
178 |
+
msgstr ""
|
179 |
+
|
180 |
+
#: post-snippets.php:798
|
181 |
+
msgid ""
|
182 |
+
"Notice:<br/>\r\n"
|
183 |
+
"\t\t\tWhen Post Snippets v1.9 will be released, the minimum \r\n"
|
184 |
+
"\t\t\trequired PHP Version will be %1$s to be on par with WordPress 3.3.\r\n"
|
185 |
+
"\t\t\t<br/>\r\n"
|
186 |
+
"\t\t\tPlease update your\r\n"
|
187 |
+
"\t\t\tPHP installation before updating Post Snippets to v1.9+, or \r\n"
|
188 |
+
"\t\t\tcontact the plugin author to plead your case.<br/>\r\n"
|
189 |
+
"\t\t\tYour installed PHP version: %2$s"
|
190 |
+
msgstr ""
|
191 |
+
|
192 |
+
#: post-snippets.php:817
|
193 |
+
msgid "Error: Post Snippets requires WordPress Version %s or higher."
|
194 |
+
msgstr ""
|
195 |
+
|
196 |
+
#. Plugin Name of the plugin/theme
|
197 |
+
msgid "Post Snippets"
|
198 |
+
msgstr ""
|
199 |
+
|
200 |
+
#. Plugin URI of the plugin/theme
|
201 |
+
msgid "http://wpstorm.net/wordpress-plugins/post-snippets/"
|
202 |
+
msgstr ""
|
203 |
+
|
204 |
+
#. Description of the plugin/theme
|
205 |
+
msgid ""
|
206 |
+
"Stores snippets of HTML code or reoccurring text that you often use in your "
|
207 |
+
"posts. You can use predefined variables to replace parts of the snippet on "
|
208 |
+
"insert. All snippets are available in the post editor with a TinyMCE button "
|
209 |
+
"or Quicktags."
|
210 |
+
msgstr ""
|
211 |
+
|
212 |
+
#. Author of the plugin/theme
|
213 |
+
msgid "Johan Steen"
|
214 |
+
msgstr ""
|
215 |
+
|
216 |
+
#. Author URI of the plugin/theme
|
217 |
+
msgid "http://johansteen.se/"
|
218 |
+
msgstr ""
|
|
|
|
|
|
|
|
post-snippets.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Post Snippets
|
4 |
Plugin URI: http://wpstorm.net/wordpress-plugins/post-snippets/
|
5 |
Description: Stores snippets of HTML code or reoccurring text that you often use in your posts. You can use predefined variables to replace parts of the snippet on insert. All snippets are available in the post editor with a TinyMCE button or Quicktags.
|
6 |
-
Version: 1.8.
|
7 |
Author: Johan Steen
|
8 |
Author URI: http://johansteen.se/
|
9 |
Text Domain: post-snippets
|
@@ -25,7 +25,7 @@ along with this program; if not, write to the Free Software
|
|
25 |
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
26 |
*/
|
27 |
|
28 |
-
class
|
29 |
private $tinymce_plugin_name = 'post_snippets';
|
30 |
var $plugin_options = "post_snippets_options";
|
31 |
|
@@ -38,20 +38,7 @@ class post_snippets {
|
|
38 |
load_plugin_textdomain( 'post-snippets', false,
|
39 |
dirname(plugin_basename(__FILE__)) . '/languages/');
|
40 |
|
41 |
-
|
42 |
-
// Add a warning if PHP is older than 5.2.4 (WP 3.3 requirements)
|
43 |
-
if (version_compare(PHP_VERSION, '5.2.4', '<')) {
|
44 |
-
add_action( 'admin_notices', array(&$this, 'php_warning') );
|
45 |
-
}
|
46 |
-
|
47 |
-
|
48 |
-
// Check that at least WordPress 3.0 is installed.
|
49 |
-
global $wp_version;
|
50 |
-
if ( version_compare($wp_version, '2.7', '<') ) {
|
51 |
-
add_action( 'admin_notices', array(&$this, 'version_warning') );
|
52 |
-
} else {
|
53 |
-
$this->init_hooks();
|
54 |
-
}
|
55 |
}
|
56 |
|
57 |
/**
|
@@ -105,32 +92,6 @@ class post_snippets {
|
|
105 |
}
|
106 |
|
107 |
|
108 |
-
/**
|
109 |
-
* Displays a warning when installed on an old PHP version
|
110 |
-
*
|
111 |
-
* @returns Nothing
|
112 |
-
*/
|
113 |
-
function php_warning() {
|
114 |
-
echo '<div class="updated fade"><p><strong>'.__(
|
115 |
-
'Notice:<br/>
|
116 |
-
When Post Snippets v1.9 will be released, the minimum
|
117 |
-
required PHP Version will be 5.2.4 to be on par with WordPress 3.3.<br/>Please update your
|
118 |
-
PHP installation before updating Post Snippets to v1.9+, or
|
119 |
-
contact the plugin author to plead your case.<br/>
|
120 |
-
Your installed PHP version: '.PHP_VERSION
|
121 |
-
, 'post-snippets').'</strong></p></div>';
|
122 |
-
}
|
123 |
-
|
124 |
-
|
125 |
-
/**
|
126 |
-
* Displays a warning when installed in an old Wordpress Version
|
127 |
-
*
|
128 |
-
* @returns Nothing
|
129 |
-
*/
|
130 |
-
function version_warning() {
|
131 |
-
echo '<div class="updated fade"><p><strong>'.__('Post Snippets requires WordPress version 3.0 or higher.', 'post-snippets').'</strong></p></div>';
|
132 |
-
}
|
133 |
-
|
134 |
/**
|
135 |
* Enqueues the necessary scripts and styles for the plugins
|
136 |
*
|
@@ -564,7 +525,6 @@ function edOpenPostSnippets(myField) {
|
|
564 |
'vars' => "",
|
565 |
'description' => "",
|
566 |
'shortcode' => false,
|
567 |
-
'quicktag' => false,
|
568 |
'php' => false,
|
569 |
'snippet' => ""));
|
570 |
update_option($this->plugin_options, $snippets);
|
@@ -576,11 +536,10 @@ function edOpenPostSnippets(myField) {
|
|
576 |
$snippets = get_option($this->plugin_options);
|
577 |
if (!empty($snippets)) {
|
578 |
for ($i=0; $i < count($snippets); $i++) {
|
579 |
-
$
|
580 |
-
$
|
581 |
-
$
|
582 |
-
$
|
583 |
-
$snippets[$i]['php'] = isset($_POST[$i.'_php']) ? true : false;
|
584 |
/* Check if the plugin runs on PHP below version 5.1.0
|
585 |
Because of a bug in WP 2.7.x in includes/compat.php the htmlspecialchars_decode
|
586 |
don't revert back to a PHP 4.x compatible version. So this is a workaround to make
|
@@ -588,14 +547,14 @@ function edOpenPostSnippets(myField) {
|
|
588 |
This problem is fixed in WP 2.8.
|
589 |
*/
|
590 |
if (version_compare(PHP_VERSION, '5.1.0', '<')) {
|
591 |
-
$
|
592 |
-
$
|
593 |
} else {
|
594 |
-
$
|
595 |
-
$
|
596 |
}
|
597 |
}
|
598 |
-
update_option($this->plugin_options, $
|
599 |
$this->admin_message( __( 'Snippets have been updated.', 'post-snippets' ) );
|
600 |
}
|
601 |
}
|
@@ -618,74 +577,14 @@ function edOpenPostSnippets(myField) {
|
|
618 |
|
619 |
// Handle import of snippets (Run before the option page is outputted, in case any snippets have been imported, so they are displayed).
|
620 |
$import = $this->import_snippets();
|
621 |
-
?>
|
622 |
-
<div class=wrap>
|
623 |
-
<h2>Post Snippets</h2>
|
624 |
-
|
625 |
-
<form method="post" action="">
|
626 |
-
<?php wp_nonce_field('update-options'); ?>
|
627 |
-
|
628 |
-
<div class="tablenav">
|
629 |
-
<div class="alignleft actions">
|
630 |
-
<input type="submit" name="add-snippet" value="<?php _e( 'Add New Snippet', 'post-snippets' ) ?>" class="button-secondary" />
|
631 |
-
<input type="submit" name="delete-selected" value="<?php _e( 'Delete Selected', 'post-snippets' ) ?>" class="button-secondary" />
|
632 |
-
<span class="description"><?php _e( '(Use the help dropdown button above for additional information.)', 'post-snippets' ); ?></span>
|
633 |
-
</div>
|
634 |
-
</div>
|
635 |
-
<div class="clear"></div>
|
636 |
-
|
637 |
-
<table class="widefat fixed" cellspacing="0">
|
638 |
-
<thead>
|
639 |
-
<tr>
|
640 |
-
<th scope="col" class="check-column"><input type="checkbox" /></th>
|
641 |
-
<th scope="col" style="width: 180px;"><?php _e( 'Title', 'post-snippets' ) ?></th>
|
642 |
-
<th scope="col" style="width: 180px;"><?php _e( 'Variables', 'post-snippets' ) ?></th>
|
643 |
-
<th scope="col"><?php _e( 'Snippet', 'post-snippets' ) ?></th>
|
644 |
-
</tr>
|
645 |
-
</thead>
|
646 |
-
|
647 |
-
<tfoot>
|
648 |
-
<tr>
|
649 |
-
<th scope="col" class="check-column"><input type="checkbox" /></th>
|
650 |
-
<th scope="col"><?php _e( 'Title', 'post-snippets' ) ?></th>
|
651 |
-
<th scope="col"><?php _e( 'Variables', 'post-snippets' ) ?></th>
|
652 |
-
<th scope="col"><?php _e( 'Snippet', 'post-snippets' ) ?></th>
|
653 |
-
</tr>
|
654 |
-
</tfoot>
|
655 |
-
|
656 |
-
<tbody>
|
657 |
-
<?php
|
658 |
-
$snippets = get_option($this->plugin_options);
|
659 |
-
if (!empty($snippets)) {
|
660 |
-
for ($i=0; $i < count($snippets); $i++) { ?>
|
661 |
-
<tr class='recent'>
|
662 |
-
<th scope='row' class='check-column'><input type='checkbox' name='checked[]' value='<?php echo $i; ?>' /></th>
|
663 |
-
<td class='row-title'>
|
664 |
-
<input type='text' name='<?php echo $i; ?>_title' value='<?php echo $snippets[$i]['title']; ?>' />
|
665 |
-
</td>
|
666 |
-
<td class='name'>
|
667 |
-
<input type='text' name='<?php echo $i; ?>_vars' value='<?php echo $snippets[$i]['vars']; ?>' /><br/>
|
668 |
-
<input type='checkbox' name='<?php echo $i; ?>_shortcode' value='true'<?php if ($snippets[$i]['shortcode'] == true) { echo " checked"; }?> /> <?php _e( 'Shortcode', 'post-snippets' ) ?><br/>
|
669 |
-
<input type='checkbox' name='<?php echo $i; ?>_quicktag' value='true'<?php if ($snippets[$i]['quicktag'] == true) { echo " checked"; }?> /> <?php _e( 'Quicktag', 'post-snippets' ) ?><br/>
|
670 |
-
<!-- <input type='checkbox' name='< ?php echo $i; ? >_php' value='true'< ?php if ($snippets[$i]['php'] == true) { echo " checked"; }? > /> < ?php _e( 'PHP Code', 'post-snippets' ) ? ><br/> -->
|
671 |
-
</td>
|
672 |
-
<td class='desc'>
|
673 |
-
<textarea name="<?php echo $i; ?>_snippet" class="large-text" style='width: 100%;' rows="5"><?php echo htmlspecialchars($snippets[$i]['snippet'], ENT_NOQUOTES); ?></textarea>
|
674 |
-
<?php _e( 'Description', 'post-snippets' ) ?>:
|
675 |
-
<input type='text' style='width: 100%;' name='<?php echo $i; ?>_description' value='<?php if (isset( $snippets[$i]['description'] ) ) echo esc_html($snippets[$i]['description']); ?>' /><br/>
|
676 |
-
</td>
|
677 |
-
</tr>
|
678 |
-
<?php
|
679 |
-
}
|
680 |
-
}
|
681 |
-
?>
|
682 |
-
</tbody>
|
683 |
-
</table>
|
684 |
-
<div class="submit">
|
685 |
-
<input type="submit" name="update-post-snippets" value="<?php _e( 'Update Snippets', 'post-snippets' ) ?>" class="button-primary" /></div>
|
686 |
-
</form>
|
687 |
-
</div>
|
688 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
689 |
<h3><?php _e( 'Import/Export', 'post-snippets' ); ?></h3>
|
690 |
<strong><?php _e( 'Export', 'post-snippets' ); ?></strong><br/>
|
691 |
<form method="post">
|
@@ -823,17 +722,122 @@ function edOpenPostSnippets(myField) {
|
|
823 |
}
|
824 |
|
825 |
}
|
826 |
-
add_action( 'plugins_loaded', create_function( '', 'global $post_snippets; $post_snippets = new post_snippets();' ) );
|
827 |
|
828 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
829 |
/**
|
830 |
* Allow snippets to be retrieved directly from PHP
|
831 |
*
|
832 |
-
* @since
|
833 |
*
|
834 |
-
* @param
|
835 |
-
*
|
836 |
-
* @
|
|
|
|
|
|
|
837 |
*/
|
838 |
function get_post_snippet( $snippet_name, $snippet_vars = '' ) {
|
839 |
global $post_snippets;
|
@@ -854,4 +858,3 @@ function get_post_snippet( $snippet_name, $snippet_vars = '' ) {
|
|
854 |
return $snippet;
|
855 |
}
|
856 |
|
857 |
-
?>
|
3 |
Plugin Name: Post Snippets
|
4 |
Plugin URI: http://wpstorm.net/wordpress-plugins/post-snippets/
|
5 |
Description: Stores snippets of HTML code or reoccurring text that you often use in your posts. You can use predefined variables to replace parts of the snippet on insert. All snippets are available in the post editor with a TinyMCE button or Quicktags.
|
6 |
+
Version: 1.8.8
|
7 |
Author: Johan Steen
|
8 |
Author URI: http://johansteen.se/
|
9 |
Text Domain: post-snippets
|
25 |
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
26 |
*/
|
27 |
|
28 |
+
class Post_Snippets {
|
29 |
private $tinymce_plugin_name = 'post_snippets';
|
30 |
var $plugin_options = "post_snippets_options";
|
31 |
|
38 |
load_plugin_textdomain( 'post-snippets', false,
|
39 |
dirname(plugin_basename(__FILE__)) . '/languages/');
|
40 |
|
41 |
+
$this->init_hooks();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
}
|
43 |
|
44 |
/**
|
92 |
}
|
93 |
|
94 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
95 |
/**
|
96 |
* Enqueues the necessary scripts and styles for the plugins
|
97 |
*
|
525 |
'vars' => "",
|
526 |
'description' => "",
|
527 |
'shortcode' => false,
|
|
|
528 |
'php' => false,
|
529 |
'snippet' => ""));
|
530 |
update_option($this->plugin_options, $snippets);
|
536 |
$snippets = get_option($this->plugin_options);
|
537 |
if (!empty($snippets)) {
|
538 |
for ($i=0; $i < count($snippets); $i++) {
|
539 |
+
$new_snippets[$i]['title'] = trim($_POST[$i.'_title']);
|
540 |
+
$new_snippets[$i]['vars'] = str_replace(" ", "", trim($_POST[$i.'_vars']) );
|
541 |
+
$new_snippets[$i]['shortcode'] = isset($_POST[$i.'_shortcode']) ? true : false;
|
542 |
+
$new_snippets[$i]['php'] = isset($_POST[$i.'_php']) ? true : false;
|
|
|
543 |
/* Check if the plugin runs on PHP below version 5.1.0
|
544 |
Because of a bug in WP 2.7.x in includes/compat.php the htmlspecialchars_decode
|
545 |
don't revert back to a PHP 4.x compatible version. So this is a workaround to make
|
547 |
This problem is fixed in WP 2.8.
|
548 |
*/
|
549 |
if (version_compare(PHP_VERSION, '5.1.0', '<')) {
|
550 |
+
$new_snippets[$i]['snippet'] = htmlspecialchars_decode( trim(stripslashes($_POST[$i.'_snippet'])), ENT_NOQUOTES);
|
551 |
+
$new_snippets[$i]['description'] = htmlspecialchars_decode( trim(stripslashes($_POST[$i.'_description'])), ENT_NOQUOTES);
|
552 |
} else {
|
553 |
+
$new_snippets[$i]['snippet'] = wp_specialchars_decode( trim(stripslashes($_POST[$i.'_snippet'])), ENT_NOQUOTES);
|
554 |
+
$new_snippets[$i]['description'] = wp_specialchars_decode( trim(stripslashes($_POST[$i.'_description'])), ENT_NOQUOTES);
|
555 |
}
|
556 |
}
|
557 |
+
update_option($this->plugin_options, $new_snippets);
|
558 |
$this->admin_message( __( 'Snippets have been updated.', 'post-snippets' ) );
|
559 |
}
|
560 |
}
|
577 |
|
578 |
// Handle import of snippets (Run before the option page is outputted, in case any snippets have been imported, so they are displayed).
|
579 |
$import = $this->import_snippets();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
580 |
|
581 |
+
|
582 |
+
// Render the settings screen
|
583 |
+
$settings = new Post_Snippets_Settings();
|
584 |
+
$settings->set_options( get_option($this->plugin_options) );
|
585 |
+
$settings->render();
|
586 |
+
|
587 |
+
?>
|
588 |
<h3><?php _e( 'Import/Export', 'post-snippets' ); ?></h3>
|
589 |
<strong><?php _e( 'Export', 'post-snippets' ); ?></strong><br/>
|
590 |
<form method="post">
|
722 |
}
|
723 |
|
724 |
}
|
|
|
725 |
|
726 |
|
727 |
+
// -----------------------------------------------------------------------------
|
728 |
+
// Start the plugin
|
729 |
+
// -----------------------------------------------------------------------------
|
730 |
+
|
731 |
+
|
732 |
+
// Check the host environment
|
733 |
+
$test_post_snippets_host = new Post_Snippets_Host_Environment();
|
734 |
+
|
735 |
+
// If environment is up to date, start the plugin
|
736 |
+
if($test_post_snippets_host->passed) {
|
737 |
+
// Load external classes
|
738 |
+
if (is_admin()) {
|
739 |
+
require plugin_dir_path(__FILE__).'classes/settings.php';
|
740 |
+
}
|
741 |
+
|
742 |
+
add_action(
|
743 |
+
'plugins_loaded',
|
744 |
+
create_function(
|
745 |
+
'',
|
746 |
+
'global $post_snippets; $post_snippets = new Post_Snippets();'
|
747 |
+
)
|
748 |
+
);
|
749 |
+
}
|
750 |
+
|
751 |
+
|
752 |
+
/**
|
753 |
+
* Post Snippets Host Environment.
|
754 |
+
*
|
755 |
+
* Checks that the host environment fulfils the requirements of Post Snippets.
|
756 |
+
* This class is designed to work with PHP versions below 5, to make sure it's
|
757 |
+
* always executed.
|
758 |
+
*
|
759 |
+
* - PHP Version 5.2.4 is on par with the requirements for WordPress 3.3.
|
760 |
+
*
|
761 |
+
* @since Post Snippets 1.8.8
|
762 |
+
*/
|
763 |
+
class Post_Snippets_Host_Environment
|
764 |
+
{
|
765 |
+
// Minimum versions required
|
766 |
+
var $MIN_PHP_VERSION = '5.2.4';
|
767 |
+
var $MIN_WP_VERSION = '3.0';
|
768 |
+
var $passed = true;
|
769 |
+
|
770 |
+
/**
|
771 |
+
* Constructor.
|
772 |
+
*
|
773 |
+
* Checks PHP and WordPress versions. If any check failes, a system notice
|
774 |
+
* is added and $passed is set to fail, which can be checked before trying
|
775 |
+
* to create the main class.
|
776 |
+
*/
|
777 |
+
function Post_Snippets_Host_Environment()
|
778 |
+
{
|
779 |
+
// Check if PHP is too old
|
780 |
+
if (version_compare(PHP_VERSION, $this->MIN_PHP_VERSION, '<')) {
|
781 |
+
// Display notice
|
782 |
+
add_action( 'admin_notices', array(&$this, 'php_version_error') );
|
783 |
+
}
|
784 |
+
|
785 |
+
// Check if WordPress is too old
|
786 |
+
global $wp_version;
|
787 |
+
if ( version_compare($wp_version, $this->MIN_WP_VERSION, '<') ) {
|
788 |
+
add_action( 'admin_notices', array(&$this, 'wp_version_error') );
|
789 |
+
$this->passed = false;
|
790 |
+
}
|
791 |
+
}
|
792 |
+
|
793 |
+
/**
|
794 |
+
* Displays a warning when installed on an old PHP version.
|
795 |
+
*/
|
796 |
+
function php_version_error() {
|
797 |
+
echo '<div class="error"><p><strong>';
|
798 |
+
printf( __(
|
799 |
+
'Notice:<br/>
|
800 |
+
When Post Snippets v1.9 will be released, the minimum
|
801 |
+
required PHP Version will be %1$s to be on par with WordPress 3.3.
|
802 |
+
<br/>
|
803 |
+
Please update your
|
804 |
+
PHP installation before updating Post Snippets to v1.9+, or
|
805 |
+
contact the plugin author to plead your case.<br/>
|
806 |
+
Your installed PHP version: %2$s',
|
807 |
+
'post-snippets'),
|
808 |
+
$this->MIN_PHP_VERSION, PHP_VERSION);
|
809 |
+
echo '</strong></p></div>';
|
810 |
+
}
|
811 |
+
|
812 |
+
/**
|
813 |
+
* Displays a warning when installed in an old Wordpress version.
|
814 |
+
*/
|
815 |
+
function wp_version_error() {
|
816 |
+
echo '<div class="error"><p><strong>';
|
817 |
+
printf( __(
|
818 |
+
'Error: Post Snippets requires WordPress Version %s or higher.',
|
819 |
+
'post-snippets'),
|
820 |
+
$this->MIN_WP_VERSION );
|
821 |
+
echo '</strong></p></div>';
|
822 |
+
}
|
823 |
+
}
|
824 |
+
|
825 |
+
|
826 |
+
// -----------------------------------------------------------------------------
|
827 |
+
// Helper functions
|
828 |
+
// -----------------------------------------------------------------------------
|
829 |
+
|
830 |
/**
|
831 |
* Allow snippets to be retrieved directly from PHP
|
832 |
*
|
833 |
+
* @since Post Snippets 1.6
|
834 |
*
|
835 |
+
* @param string $snippet_name
|
836 |
+
* The name of the snippet to retrieve
|
837 |
+
* @param string $snippet_vars
|
838 |
+
* The variables to pass to the snippet, formatted as a query string.
|
839 |
+
* @return string
|
840 |
+
* The Snippet
|
841 |
*/
|
842 |
function get_post_snippet( $snippet_name, $snippet_vars = '' ) {
|
843 |
global $post_snippets;
|
858 |
return $snippet;
|
859 |
}
|
860 |
|
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: http://wpstorm.net/wordpress-plugins/post-snippets/#donation
|
|
4 |
Tags: post, admin, snippet, html, custom, page, dynamic, editor, quicktag
|
5 |
Requires at least: 3.0
|
6 |
Tested up to: 3.3
|
7 |
-
Stable tag: 1.8.
|
8 |
|
9 |
Store snippets of HTML code or reoccurring text that you often use in your posts. Custom variables can be used.
|
10 |
|
@@ -12,11 +12,6 @@ Store snippets of HTML code or reoccurring text that you often use in your posts
|
|
12 |
|
13 |
This admin plugin stores snippets of HTML code or reoccurring text that you often use in your posts. You can use predefined variables to replace parts of the snippet on insert. All snippets are available in the post editor with a TinyMCE button. The snippet can be inserted as defined, or as a shortcode to keep flexibility for updating the snippet.
|
14 |
|
15 |
-
Related Links:
|
16 |
-
|
17 |
-
* [Documentation](http://wpstorm.net/wordpress-plugins/post-snippets/ "Complete usage instructions")
|
18 |
-
* [Support Forum](http://wordpress.org/tags/post-snippets?forum_id=10 "Use this for support and feature requests")
|
19 |
-
|
20 |
= Features =
|
21 |
|
22 |
* **Insert** All defined snippets is inserted from a button directly in the post editor.
|
@@ -27,6 +22,13 @@ Related Links:
|
|
27 |
* **Import/Export** Snippets can be imported and exported between sites.
|
28 |
* **Uninstall** If you delete the plugin from your plugins panel it cleans up all data it has created in the Wordpress database.
|
29 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
See the [Changelog](http://wordpress.org/extend/plugins/post-snippets/changelog/) for what's new. Available [Translations](http://wpstorm.net/wordpress-plugins/post-snippets/#translations).
|
31 |
|
32 |
|
@@ -66,6 +68,11 @@ Please visit the [Support Forum](http://wordpress.org/tags/post-snippets?forum_i
|
|
66 |
|
67 |
== Changelog ==
|
68 |
|
|
|
|
|
|
|
|
|
|
|
69 |
= Version 1.8.7 - 25 Dec 2011 =
|
70 |
* Updated the TinyMCE plugin for the Post Snippets button in WordPress Visual
|
71 |
Editor to use the same jQuery UI Dialog window that the HTML button have had
|
4 |
Tags: post, admin, snippet, html, custom, page, dynamic, editor, quicktag
|
5 |
Requires at least: 3.0
|
6 |
Tested up to: 3.3
|
7 |
+
Stable tag: 1.8.8
|
8 |
|
9 |
Store snippets of HTML code or reoccurring text that you often use in your posts. Custom variables can be used.
|
10 |
|
12 |
|
13 |
This admin plugin stores snippets of HTML code or reoccurring text that you often use in your posts. You can use predefined variables to replace parts of the snippet on insert. All snippets are available in the post editor with a TinyMCE button. The snippet can be inserted as defined, or as a shortcode to keep flexibility for updating the snippet.
|
14 |
|
|
|
|
|
|
|
|
|
|
|
15 |
= Features =
|
16 |
|
17 |
* **Insert** All defined snippets is inserted from a button directly in the post editor.
|
22 |
* **Import/Export** Snippets can be imported and exported between sites.
|
23 |
* **Uninstall** If you delete the plugin from your plugins panel it cleans up all data it has created in the Wordpress database.
|
24 |
|
25 |
+
Related Links:
|
26 |
+
|
27 |
+
* [Documentation](http://wpstorm.net/wordpress-plugins/post-snippets/
|
28 |
+
"Complete usage instructions")
|
29 |
+
* [Support Forum](http://wordpress.org/tags/post-snippets?forum_id=10
|
30 |
+
"Use this for support and feature requests")
|
31 |
+
|
32 |
See the [Changelog](http://wordpress.org/extend/plugins/post-snippets/changelog/) for what's new. Available [Translations](http://wpstorm.net/wordpress-plugins/post-snippets/#translations).
|
33 |
|
34 |
|
68 |
|
69 |
== Changelog ==
|
70 |
|
71 |
+
= Version 1.8.8 - 28 Dec 2011 =
|
72 |
+
* Removed the unneeded QuickTag checkbox from the settings screen for snippets,
|
73 |
+
as all snippets are now always available from the HTML editor's QuickTag
|
74 |
+
button.
|
75 |
+
|
76 |
= Version 1.8.7 - 25 Dec 2011 =
|
77 |
* Updated the TinyMCE plugin for the Post Snippets button in WordPress Visual
|
78 |
Editor to use the same jQuery UI Dialog window that the HTML button have had
|
tests/phpunit.xml
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<phpunit
|
3 |
+
colors="true"
|
4 |
+
stopOnFailure="false"
|
5 |
+
bootstrap="/../../../../wordpress-tests/init.php">
|
6 |
+
<testsuites>
|
7 |
+
<testsuite name="PostSnippets">
|
8 |
+
<file>post-snippets-test.php</file>
|
9 |
+
</testsuite>
|
10 |
+
</testsuites>
|
11 |
+
</phpunit>
|
tests/post-snippets-test.php
ADDED
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Post Snippets PHPUnit Tests.
|
4 |
+
*
|
5 |
+
* Unit testing for the Post Snippets WordPress plugin. The test class extends
|
6 |
+
* WP_UnitTestCase from Nikolay Bachiyski's WordPress-Tests package.
|
7 |
+
*
|
8 |
+
* @package Post Snippets
|
9 |
+
* @author Johan Steen <artstorm at gmail dot com>
|
10 |
+
* @since Post Snippets 1.8.8
|
11 |
+
* @see https://github.com/nb/wordpress-tests
|
12 |
+
*/
|
13 |
+
class Post_Snippets_Test extends WP_UnitTestCase {
|
14 |
+
|
15 |
+
protected $post_snippets;
|
16 |
+
|
17 |
+
/**
|
18 |
+
* setUp runs before each test to create a Fixture.
|
19 |
+
*
|
20 |
+
* The method should have protected access, but because WP_UnitTestCase
|
21 |
+
* doesn't define it that way we'll stick with public.
|
22 |
+
*/
|
23 |
+
public function setUp() {
|
24 |
+
parent::setUp();
|
25 |
+
$this->post_snippets = new Post_Snippets();
|
26 |
+
}
|
27 |
+
|
28 |
+
|
29 |
+
// -------------------------------------------------------------------------
|
30 |
+
// Tests
|
31 |
+
// -------------------------------------------------------------------------
|
32 |
+
|
33 |
+
public function test_Yo()
|
34 |
+
{
|
35 |
+
$this->assertTrue(true);
|
36 |
+
}
|
37 |
+
|
38 |
+
public function test_Yos()
|
39 |
+
{
|
40 |
+
$this->assertTrue(true);
|
41 |
+
}
|
42 |
+
|
43 |
+
/**
|
44 |
+
* @dataProvider provider
|
45 |
+
*/
|
46 |
+
public function test_data_inline($a, $b, $c)
|
47 |
+
{
|
48 |
+
// var_dump($c);
|
49 |
+
}
|
50 |
+
public function provider()
|
51 |
+
{
|
52 |
+
return array(
|
53 |
+
array(0, 0, 0),
|
54 |
+
array(0, 1, 1),
|
55 |
+
array(1, 0, 1),
|
56 |
+
array(1, 1, 3)
|
57 |
+
);
|
58 |
+
}
|
59 |
+
|
60 |
+
public function test_get_post_snippet()
|
61 |
+
{
|
62 |
+
$test = get_post_snippet('Test', 'var1=a&var2=b');
|
63 |
+
$this->assertTrue(is_string($test));
|
64 |
+
}
|
65 |
+
}
|