Version Description
The function get_post_snippet()
used to retrieve snippets was deprecated
in version 2.1. In this update it is now completely removed. Please update any
code you might have that uses this function to use PostSnippets::getSnippet()
instead, which replaces the deprecated function.
Most users are not affected by this change.
Download this release
Release Info
Developer | artstorm |
Plugin | Post Snippets |
Version | 2.3 |
Comparing to | |
See all releases |
Code changes from version 2.2.3 to 2.3
- lang/post-snippets.pot +1 -1
- lib/PostSnippets/Admin.php +1 -1
- lib/PostSnippets/Help.php +1 -1
- lib/PostSnippets/Shortcode.php +103 -0
- post-snippets.php +45 -141
- readme.txt +28 -6
- views/admin_snippets.php +1 -1
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: 2013-
|
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"
|
8 |
msgstr ""
|
9 |
"Project-Id-Version: PACKAGE VERSION\n"
|
10 |
"Report-Msgid-Bugs-To: \n"
|
11 |
+
"POT-Creation-Date: 2013-06-01 22:33+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"
|
lib/PostSnippets/Admin.php
CHANGED
@@ -169,7 +169,7 @@ class PostSnippets_Admin
|
|
169 |
$new_snippets[$key]['vars'] = str_replace(' ', '', trim($_POST[$key.'_vars']));
|
170 |
$new_snippets[$key]['shortcode'] = isset($_POST[$key.'_shortcode']) ? true : false;
|
171 |
|
172 |
-
if (
|
173 |
$new_snippets[$key]['php'] = isset($_POST[$key.'_php']) ? true : false;
|
174 |
} else {
|
175 |
$new_snippets[$key]['php'] = isset($snippets[$key]['php']) ? $snippets[$key]['php'] : false;
|
169 |
$new_snippets[$key]['vars'] = str_replace(' ', '', trim($_POST[$key.'_vars']));
|
170 |
$new_snippets[$key]['shortcode'] = isset($_POST[$key.'_shortcode']) ? true : false;
|
171 |
|
172 |
+
if (!defined('POST_SNIPPETS_DISABLE_PHP')) {
|
173 |
$new_snippets[$key]['php'] = isset($_POST[$key.'_php']) ? true : false;
|
174 |
} else {
|
175 |
$new_snippets[$key]['php'] = isset($snippets[$key]['php']) ? $snippets[$key]['php'] : false;
|
lib/PostSnippets/Help.php
CHANGED
@@ -41,7 +41,7 @@ class PostSnippets_Help
|
|
41 |
'content' => $this->helpShortcode()
|
42 |
)
|
43 |
);
|
44 |
-
if (
|
45 |
$screen->add_help_tab(
|
46 |
array(
|
47 |
'id' => 'php-plugin-help',
|
41 |
'content' => $this->helpShortcode()
|
42 |
)
|
43 |
);
|
44 |
+
if (!defined('POST_SNIPPETS_DISABLE_PHP')) {
|
45 |
$screen->add_help_tab(
|
46 |
array(
|
47 |
'id' => 'php-plugin-help',
|
lib/PostSnippets/Shortcode.php
ADDED
@@ -0,0 +1,103 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Shortcode Handling.
|
4 |
+
*
|
5 |
+
* @author Johan Steen <artstorm at gmail dot com>
|
6 |
+
* @link http://johansteen.se/
|
7 |
+
*/
|
8 |
+
class PostSnippets_Shortcode
|
9 |
+
{
|
10 |
+
public function __construct()
|
11 |
+
{
|
12 |
+
$this->create();
|
13 |
+
}
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Create the functions for shortcodes dynamically and register them
|
17 |
+
*/
|
18 |
+
public function create()
|
19 |
+
{
|
20 |
+
$snippets = get_option(PostSnippets::OPTION_KEY);
|
21 |
+
if (!empty($snippets)) {
|
22 |
+
foreach ($snippets as $snippet) {
|
23 |
+
// If shortcode is enabled for the snippet, and a snippet has been entered, register it as a shortcode.
|
24 |
+
if ($snippet['shortcode'] && !empty($snippet['snippet'])) {
|
25 |
+
|
26 |
+
$vars = explode(",", $snippet['vars']);
|
27 |
+
$vars_str = "";
|
28 |
+
foreach ($vars as $var) {
|
29 |
+
$attribute = explode('=', $var);
|
30 |
+
$default_value = (count($attribute) > 1) ? $attribute[1] : '';
|
31 |
+
$vars_str .= "\"{$attribute[0]}\" => \"{$default_value}\",";
|
32 |
+
}
|
33 |
+
|
34 |
+
// Get the wptexturize setting
|
35 |
+
$texturize = isset( $snippet["wptexturize"] ) ? $snippet["wptexturize"] : false;
|
36 |
+
|
37 |
+
add_shortcode(
|
38 |
+
$snippet['title'],
|
39 |
+
create_function(
|
40 |
+
'$atts,$content=null',
|
41 |
+
'$shortcode_symbols = array('.$vars_str.');
|
42 |
+
extract(shortcode_atts($shortcode_symbols, $atts));
|
43 |
+
|
44 |
+
$attributes = compact( array_keys($shortcode_symbols) );
|
45 |
+
|
46 |
+
// Add enclosed content if available to the attributes array
|
47 |
+
if ( $content != null )
|
48 |
+
$attributes["content"] = $content;
|
49 |
+
|
50 |
+
|
51 |
+
$snippet = \''. addslashes($snippet["snippet"]) .'\';
|
52 |
+
// Disables auto conversion from & to & as that should be done in snippet, not code (destroys php etc).
|
53 |
+
// $snippet = str_replace("&", "&", $snippet);
|
54 |
+
|
55 |
+
foreach ($attributes as $key => $val) {
|
56 |
+
$snippet = str_replace("{".$key."}", $val, $snippet);
|
57 |
+
}
|
58 |
+
|
59 |
+
// Handle PHP shortcodes
|
60 |
+
$php = "'. $snippet["php"] .'";
|
61 |
+
if ($php == true) {
|
62 |
+
$snippet = PostSnippets_Shortcode::phpEval( $snippet );
|
63 |
+
}
|
64 |
+
|
65 |
+
// Strip escaping and execute nested shortcodes
|
66 |
+
$snippet = do_shortcode(stripslashes($snippet));
|
67 |
+
|
68 |
+
// WPTexturize the Snippet
|
69 |
+
$texturize = "'. $texturize .'";
|
70 |
+
if ($texturize == true) {
|
71 |
+
$snippet = wptexturize( $snippet );
|
72 |
+
}
|
73 |
+
|
74 |
+
return $snippet;'
|
75 |
+
)
|
76 |
+
);
|
77 |
+
}
|
78 |
+
}
|
79 |
+
}
|
80 |
+
}
|
81 |
+
|
82 |
+
/**
|
83 |
+
* Evaluate a snippet as PHP code.
|
84 |
+
*
|
85 |
+
* @since Post Snippets 1.9
|
86 |
+
* @param string $content The snippet to evaluate
|
87 |
+
* @return string The result of the evaluation
|
88 |
+
*/
|
89 |
+
public static function phpEval($content)
|
90 |
+
{
|
91 |
+
if (defined('POST_SNIPPETS_DISABLE_PHP')) {
|
92 |
+
return $content;
|
93 |
+
}
|
94 |
+
|
95 |
+
$content = stripslashes($content);
|
96 |
+
|
97 |
+
ob_start();
|
98 |
+
eval ($content);
|
99 |
+
$content = ob_get_clean();
|
100 |
+
|
101 |
+
return addslashes($content);
|
102 |
+
}
|
103 |
+
}
|
post-snippets.php
CHANGED
@@ -5,7 +5,7 @@ Plugin URI: http://johansteen.se/code/post-snippets/
|
|
5 |
Description: Build a library with snippets of HTML, PHP code or reoccurring text that you often use in your posts. Variables to replace parts of the snippet on insert can be used. The snippets can be inserted as-is or as shortcodes.
|
6 |
Author: Johan Steen
|
7 |
Author URI: http://johansteen.se/
|
8 |
-
Version: 2.
|
9 |
License: GPLv2 or later
|
10 |
Text Domain: post-snippets
|
11 |
|
@@ -69,9 +69,10 @@ class PostSnippets
|
|
69 |
add_action('init', array($this, 'textDomain'));
|
70 |
register_uninstall_hook(__FILE__, array(__CLASS__, 'uninstall'));
|
71 |
|
72 |
-
|
73 |
new PostSnippets_Admin;
|
74 |
new PostSnippets_WPEditor;
|
|
|
75 |
}
|
76 |
|
77 |
/**
|
@@ -138,99 +139,6 @@ class PostSnippets
|
|
138 |
}
|
139 |
|
140 |
|
141 |
-
// -------------------------------------------------------------------------
|
142 |
-
// Shortcode
|
143 |
-
// -------------------------------------------------------------------------
|
144 |
-
|
145 |
-
/**
|
146 |
-
* Create the functions for shortcodes dynamically and register them
|
147 |
-
*/
|
148 |
-
public function createShortcodes()
|
149 |
-
{
|
150 |
-
$snippets = get_option(self::OPTION_KEY);
|
151 |
-
if (!empty($snippets)) {
|
152 |
-
foreach ($snippets as $snippet) {
|
153 |
-
// If shortcode is enabled for the snippet, and a snippet has been entered, register it as a shortcode.
|
154 |
-
if ($snippet['shortcode'] && !empty($snippet['snippet'])) {
|
155 |
-
|
156 |
-
$vars = explode(",", $snippet['vars']);
|
157 |
-
$vars_str = "";
|
158 |
-
foreach ($vars as $var) {
|
159 |
-
$attribute = explode('=', $var);
|
160 |
-
$default_value = (count($attribute) > 1) ? $attribute[1] : '';
|
161 |
-
$vars_str .= "\"{$attribute[0]}\" => \"{$default_value}\",";
|
162 |
-
}
|
163 |
-
|
164 |
-
// Get the wptexturize setting
|
165 |
-
$texturize = isset( $snippet["wptexturize"] ) ? $snippet["wptexturize"] : false;
|
166 |
-
|
167 |
-
add_shortcode(
|
168 |
-
$snippet['title'],
|
169 |
-
create_function(
|
170 |
-
'$atts,$content=null',
|
171 |
-
'$shortcode_symbols = array('.$vars_str.');
|
172 |
-
extract(shortcode_atts($shortcode_symbols, $atts));
|
173 |
-
|
174 |
-
$attributes = compact( array_keys($shortcode_symbols) );
|
175 |
-
|
176 |
-
// Add enclosed content if available to the attributes array
|
177 |
-
if ( $content != null )
|
178 |
-
$attributes["content"] = $content;
|
179 |
-
|
180 |
-
|
181 |
-
$snippet = \''. addslashes($snippet["snippet"]) .'\';
|
182 |
-
// Disables auto conversion from & to & as that should be done in snippet, not code (destroys php etc).
|
183 |
-
// $snippet = str_replace("&", "&", $snippet);
|
184 |
-
|
185 |
-
foreach ($attributes as $key => $val) {
|
186 |
-
$snippet = str_replace("{".$key."}", $val, $snippet);
|
187 |
-
}
|
188 |
-
|
189 |
-
// Handle PHP shortcodes
|
190 |
-
$php = "'. $snippet["php"] .'";
|
191 |
-
if ($php == true) {
|
192 |
-
$snippet = PostSnippets::phpEval( $snippet );
|
193 |
-
}
|
194 |
-
|
195 |
-
// Strip escaping and execute nested shortcodes
|
196 |
-
$snippet = do_shortcode(stripslashes($snippet));
|
197 |
-
|
198 |
-
// WPTexturize the Snippet
|
199 |
-
$texturize = "'. $texturize .'";
|
200 |
-
if ($texturize == true) {
|
201 |
-
$snippet = wptexturize( $snippet );
|
202 |
-
}
|
203 |
-
|
204 |
-
return $snippet;'
|
205 |
-
)
|
206 |
-
);
|
207 |
-
}
|
208 |
-
}
|
209 |
-
}
|
210 |
-
}
|
211 |
-
|
212 |
-
/**
|
213 |
-
* Evaluate a snippet as PHP code.
|
214 |
-
*
|
215 |
-
* @since Post Snippets 1.9
|
216 |
-
* @param string $content The snippet to evaluate
|
217 |
-
* @return string The result of the evaluation
|
218 |
-
*/
|
219 |
-
public static function phpEval($content)
|
220 |
-
{
|
221 |
-
if (!self::canExecutePHP()) {
|
222 |
-
return $content;
|
223 |
-
}
|
224 |
-
|
225 |
-
$content = stripslashes($content);
|
226 |
-
|
227 |
-
ob_start();
|
228 |
-
eval ($content);
|
229 |
-
$content = ob_get_clean();
|
230 |
-
|
231 |
-
return addslashes($content);
|
232 |
-
}
|
233 |
-
|
234 |
// -------------------------------------------------------------------------
|
235 |
// Helpers
|
236 |
// -------------------------------------------------------------------------
|
@@ -240,44 +148,39 @@ class PostSnippets
|
|
240 |
*
|
241 |
* @since Post Snippets 1.8.9.1
|
242 |
*
|
243 |
-
* @param
|
244 |
-
*
|
245 |
-
*
|
246 |
-
*
|
247 |
-
* @return
|
248 |
-
* The Snippet
|
249 |
*/
|
250 |
-
public static function getSnippet($
|
251 |
{
|
252 |
$snippets = get_option(self::OPTION_KEY, array());
|
253 |
for ($i = 0; $i < count($snippets); $i++) {
|
254 |
-
if ($snippets[$i]['title'] == $
|
255 |
-
|
|
|
|
|
|
|
256 |
$snippet = $snippets[$i]['snippet'];
|
257 |
$var_arr = explode(",", $snippets[$i]['vars']);
|
258 |
|
259 |
if (!empty($var_arr[0])) {
|
260 |
for ($j = 0; $j < count($var_arr); $j++) {
|
261 |
-
$snippet = str_replace(
|
|
|
|
|
|
|
|
|
262 |
}
|
263 |
}
|
|
|
264 |
}
|
265 |
}
|
266 |
return do_shortcode($snippet);
|
267 |
}
|
268 |
|
269 |
-
/**
|
270 |
-
* Allow other plugins to disable the PHP Code execution feature.
|
271 |
-
*
|
272 |
-
* @see http://wordpress.org/extend/plugins/post-snippets/faq/
|
273 |
-
* @since 2.1
|
274 |
-
*/
|
275 |
-
public static function canExecutePHP()
|
276 |
-
{
|
277 |
-
return apply_filters('post_snippets_php_execution_enabled', true);
|
278 |
-
}
|
279 |
-
|
280 |
-
|
281 |
// -------------------------------------------------------------------------
|
282 |
// Environment Checks
|
283 |
// -------------------------------------------------------------------------
|
@@ -343,30 +246,31 @@ class PostSnippets
|
|
343 |
$data = get_plugin_data(self::FILE);
|
344 |
return $data['Name'];
|
345 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
346 |
}
|
347 |
|
348 |
add_action('plugins_loaded', array('PostSnippets', 'getInstance'));
|
349 |
-
|
350 |
-
// -----------------------------------------------------------------------------
|
351 |
-
// Helper functions
|
352 |
-
// -----------------------------------------------------------------------------
|
353 |
-
|
354 |
-
/**
|
355 |
-
* Allow snippets to be retrieved directly from PHP.
|
356 |
-
* This function is a wrapper for Post_Snippets::get_snippet().
|
357 |
-
*
|
358 |
-
* @since Post Snippets 1.6
|
359 |
-
* @deprecated Post Snippets 2.1
|
360 |
-
*
|
361 |
-
* @param string $snippet_name
|
362 |
-
* The name of the snippet to retrieve
|
363 |
-
* @param string $snippet_vars
|
364 |
-
* The variables to pass to the snippet, formatted as a query string.
|
365 |
-
* @return string
|
366 |
-
* The Snippet
|
367 |
-
*/
|
368 |
-
function get_post_snippet($snippet_name, $snippet_vars = '')
|
369 |
-
{
|
370 |
-
_deprecated_function(__FUNCTION__, '2.1', 'PostSnippets::getSnippet()');
|
371 |
-
return PostSnippets::getSnippet($snippet_name, $snippet_vars);
|
372 |
-
}
|
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 |
|
69 |
add_action('init', array($this, 'textDomain'));
|
70 |
register_uninstall_hook(__FILE__, array(__CLASS__, 'uninstall'));
|
71 |
|
72 |
+
add_action('after_setup_theme', array(&$this, 'phpExecState'));
|
73 |
new PostSnippets_Admin;
|
74 |
new PostSnippets_WPEditor;
|
75 |
+
new PostSnippets_Shortcode;
|
76 |
}
|
77 |
|
78 |
/**
|
139 |
}
|
140 |
|
141 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
142 |
// -------------------------------------------------------------------------
|
143 |
// Helpers
|
144 |
// -------------------------------------------------------------------------
|
148 |
*
|
149 |
* @since Post Snippets 1.8.9.1
|
150 |
*
|
151 |
+
* @param string $name The name of the snippet to retrieve
|
152 |
+
* @param string|array $variables The variables to pass to the snippet,
|
153 |
+
* formatted as a query string or an associative array.
|
154 |
+
* @param bool $isArray Use an associative array for variables.
|
155 |
+
* @return string The Snippet
|
|
|
156 |
*/
|
157 |
+
public static function getSnippet($name, $variables = '', $isArray = false)
|
158 |
{
|
159 |
$snippets = get_option(self::OPTION_KEY, array());
|
160 |
for ($i = 0; $i < count($snippets); $i++) {
|
161 |
+
if ($snippets[$i]['title'] == $name) {
|
162 |
+
if (!$isArray) {
|
163 |
+
parse_str(htmlspecialchars_decode($variables), $variables);
|
164 |
+
}
|
165 |
+
|
166 |
$snippet = $snippets[$i]['snippet'];
|
167 |
$var_arr = explode(",", $snippets[$i]['vars']);
|
168 |
|
169 |
if (!empty($var_arr[0])) {
|
170 |
for ($j = 0; $j < count($var_arr); $j++) {
|
171 |
+
$snippet = str_replace(
|
172 |
+
"{".$var_arr[$j]."}",
|
173 |
+
$variables[$var_arr[$j]],
|
174 |
+
$snippet
|
175 |
+
);
|
176 |
}
|
177 |
}
|
178 |
+
break;
|
179 |
}
|
180 |
}
|
181 |
return do_shortcode($snippet);
|
182 |
}
|
183 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
184 |
// -------------------------------------------------------------------------
|
185 |
// Environment Checks
|
186 |
// -------------------------------------------------------------------------
|
246 |
$data = get_plugin_data(self::FILE);
|
247 |
return $data['Name'];
|
248 |
}
|
249 |
+
|
250 |
+
// -------------------------------------------------------------------------
|
251 |
+
// Deprecated methods
|
252 |
+
// -------------------------------------------------------------------------
|
253 |
+
/**
|
254 |
+
* Allow plugins to disable the PHP Code execution feature with a filter.
|
255 |
+
* Deprecated: Use the POST_SNIPPETS_DISABLE_PHP global constant to disable
|
256 |
+
* PHP instead.
|
257 |
+
*
|
258 |
+
* @see http://wordpress.org/extend/plugins/post-snippets/faq/
|
259 |
+
* @since 2.1
|
260 |
+
* @deprecated 2.3
|
261 |
+
*/
|
262 |
+
public function phpExecState()
|
263 |
+
{
|
264 |
+
$filter = apply_filters('post_snippets_php_execution_enabled', true);
|
265 |
+
if ($filter == false and !defined('POST_SNIPPETS_DISABLE_PHP')) {
|
266 |
+
_deprecated_function(
|
267 |
+
'post_snippets_php_execution_enabled',
|
268 |
+
'2.3',
|
269 |
+
'define(\'POST_SNIPPETS_DISABLE_PHP\', true);'
|
270 |
+
);
|
271 |
+
define('POST_SNIPPETS_DISABLE_PHP', true);
|
272 |
+
}
|
273 |
+
}
|
274 |
}
|
275 |
|
276 |
add_action('plugins_loaded', array('PostSnippets', 'getInstance'));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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: 3.5.1
|
7 |
-
Stable tag: 2.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -83,9 +83,11 @@ enter 'content' in the variable field, it's automatically assigned.
|
|
83 |
|
84 |
= Where can I send bug reports? =
|
85 |
|
86 |
-
Please visit the GitHub repository for
|
|
|
87 |
and open an [issue](https://github.com/artstorm/post-snippets/issues).
|
88 |
-
Please create an issue that conforms with
|
|
|
89 |
|
90 |
= Where can I get support? =
|
91 |
|
@@ -94,10 +96,12 @@ for questions, answers, support and feature requests.
|
|
94 |
|
95 |
= How can I disable the PHP Code Execution feature? =
|
96 |
|
97 |
-
To disable the "PHP Code" execution feature in this plugin, add the following
|
98 |
-
|
|
|
99 |
|
100 |
-
This is useful if you are using this plugin for client sites, and don't want
|
|
|
101 |
|
102 |
= How can I contribute to the plugin? =
|
103 |
|
@@ -117,6 +121,17 @@ Contributions are appreciated and encouraged.
|
|
117 |
|
118 |
== Changelog ==
|
119 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
120 |
= Version 2.2.3 - 11 May 2013 =
|
121 |
* Fixes issue with the QuickTag button not being displayed in Firefox.
|
122 |
|
@@ -423,3 +438,10 @@ Most users are not affected by this change.
|
|
423 |
|
424 |
= 2.2 =
|
425 |
Note that at least WordPress v3.3 are required for Post Snippets v2.2.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
Tags: post, admin, snippet, shortcode, html, custom, page, dynamic, editor, php, code
|
5 |
Requires at least: 3.3
|
6 |
Tested up to: 3.5.1
|
7 |
+
Stable tag: 2.3
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
83 |
|
84 |
= Where can I send bug reports? =
|
85 |
|
86 |
+
Please visit the GitHub repository for
|
87 |
+
[Post Snippet](https://github.com/artstorm/post-snippets)
|
88 |
and open an [issue](https://github.com/artstorm/post-snippets/issues).
|
89 |
+
Please create an issue that conforms with
|
90 |
+
[necolas's guidelines](https://github.com/necolas/issue-guidelines).
|
91 |
|
92 |
= Where can I get support? =
|
93 |
|
96 |
|
97 |
= How can I disable the PHP Code Execution feature? =
|
98 |
|
99 |
+
To disable the "PHP Code" execution feature in this plugin, add the following
|
100 |
+
code your theme's functions.php or to wp-config.php:
|
101 |
+
`define('POST_SNIPPETS_DISABLE_PHP', true);`
|
102 |
|
103 |
+
This is useful if you are using this plugin for client sites, and don't want
|
104 |
+
your clients to be able to use PHP code in a post snippet.
|
105 |
|
106 |
= How can I contribute to the plugin? =
|
107 |
|
121 |
|
122 |
== Changelog ==
|
123 |
|
124 |
+
= Version 2.3 - 1 Jun 2013 =
|
125 |
+
* Updates `PostSnippets::getSnippet($name, $variables, $isArray)` to be able
|
126 |
+
to accept an array with variables and not only a querystring. Fixes
|
127 |
+
[issue #22](https://github.com/artstorm/post-snippets/issues/22).
|
128 |
+
* Removes `get_post_snippet()` which was deprecated in version 2.1.
|
129 |
+
* Adds POST_SNIPPETS_DISABLE_PHP constant for easy disabling the PHP
|
130 |
+
code execution in snippets. Add
|
131 |
+
`define('POST_SNIPPETS_DISABLE_PHP', true);`
|
132 |
+
to wp-config.php or the theme's functions.php to disable PHP execution in the
|
133 |
+
plugin.
|
134 |
+
|
135 |
= Version 2.2.3 - 11 May 2013 =
|
136 |
* Fixes issue with the QuickTag button not being displayed in Firefox.
|
137 |
|
438 |
|
439 |
= 2.2 =
|
440 |
Note that at least WordPress v3.3 are required for Post Snippets v2.2.
|
441 |
+
|
442 |
+
= 2.3 =
|
443 |
+
The function `get_post_snippet()` used to retrieve snippets was deprecated
|
444 |
+
in version 2.1. In this update it is now completely removed. Please update any
|
445 |
+
code you might have that uses this function to use `PostSnippets::getSnippet()` instead, which replaces the deprecated function.
|
446 |
+
|
447 |
+
Most users are not affected by this change.
|
views/admin_snippets.php
CHANGED
@@ -41,7 +41,7 @@ if (!empty($snippets)) {
|
|
41 |
|
42 |
echo '<br/><strong>Shortcode Options:</strong><br/>';
|
43 |
|
44 |
-
if (
|
45 |
PostSnippets_Admin::checkbox(
|
46 |
__('PHP Code', PostSnippets::TEXT_DOMAIN),
|
47 |
$key.'_php',
|
41 |
|
42 |
echo '<br/><strong>Shortcode Options:</strong><br/>';
|
43 |
|
44 |
+
if (!defined('POST_SNIPPETS_DISABLE_PHP')) {
|
45 |
PostSnippets_Admin::checkbox(
|
46 |
__('PHP Code', PostSnippets::TEXT_DOMAIN),
|
47 |
$key.'_php',
|