Version Description
Download this release
Release Info
Developer | artstorm |
Plugin | Post Snippets |
Version | 1.7.3 |
Comparing to | |
See all releases |
Code changes from version 1.7.2 to 1.7.3
- post-snippets.php +27 -149
- readme.txt +9 -3
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.7.
|
7 |
Author: Johan Steen
|
8 |
Author URI: http://wpstorm.net/
|
9 |
Text Domain: post-snippets
|
@@ -62,11 +62,6 @@ class post_snippets {
|
|
62 |
# Options Page
|
63 |
add_action( 'admin_menu', array(&$this,'wp_admin') );
|
64 |
|
65 |
-
// This old methos is no longer used, DELETE when the new method is tried by users.
|
66 |
-
// Add Quicktags to header (used to be in footer!)
|
67 |
-
// add_action('admin_head', array(&$this,'quicktags'));
|
68 |
-
// add_action('admin_footer', array(&$this,'quicktags'));
|
69 |
-
|
70 |
$this->create_shortcodes();
|
71 |
|
72 |
# Adds the JS and HTML code in the header and footer for the jQuery insert UI dialog in the editor
|
@@ -98,7 +93,7 @@ class post_snippets {
|
|
98 |
* @returns Nothing
|
99 |
*/
|
100 |
function version_warning() {
|
101 |
-
echo '<div class="updated fade"><p><strong>'.__('Post Snippets requires WordPress version
|
102 |
}
|
103 |
|
104 |
/**
|
@@ -111,11 +106,12 @@ class post_snippets {
|
|
111 |
function enqueue_assets() {
|
112 |
wp_enqueue_script( 'jquery-ui-dialog' );
|
113 |
wp_enqueue_script( 'jquery-ui-tabs' );
|
|
|
114 |
|
115 |
# Adds the CSS stylesheet for the jQuery UI dialog
|
116 |
$style_url = plugins_url( '/assets/post-snippets.css', __FILE__);
|
117 |
-
wp_register_style('post-snippets
|
118 |
-
wp_enqueue_style( 'post-snippets
|
119 |
}
|
120 |
|
121 |
/**
|
@@ -147,10 +143,16 @@ class post_snippets {
|
|
147 |
$shortcode = $snippets[$i]['title'] . $variables;
|
148 |
echo "var postsnippet_{$i} = '[" . $shortcode . "]';\n";
|
149 |
} else {
|
150 |
-
$
|
151 |
-
|
152 |
-
|
153 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
154 |
}
|
155 |
}
|
156 |
?>
|
@@ -229,7 +231,7 @@ function edOpenPostSnippets(myField) {
|
|
229 |
|
230 |
|
231 |
/**
|
232 |
-
* jQuery
|
233 |
*
|
234 |
* @since Post Snippets 1.7
|
235 |
*
|
@@ -258,7 +260,7 @@ function edOpenPostSnippets(myField) {
|
|
258 |
<?php
|
259 |
// Print a snippet description is available
|
260 |
if ( isset($snippets[$i]['description']) )
|
261 |
-
echo
|
262 |
|
263 |
// Get all variables defined for the snippet and output them as input fields
|
264 |
$var_arr = explode(",",$snippets[$i]['vars']);
|
@@ -272,7 +274,7 @@ function edOpenPostSnippets(myField) {
|
|
272 |
} else {
|
273 |
// If no variables and no description available, output a text to inform the user that it's an insert snippet only
|
274 |
if ( empty($snippets[$i]['description']) )
|
275 |
-
echo
|
276 |
}
|
277 |
?>
|
278 |
</div><!-- #ps-tabs-## -->
|
@@ -282,7 +284,7 @@ function edOpenPostSnippets(myField) {
|
|
282 |
</div><!-- #post-snippets-tabs -->
|
283 |
</div><!-- #post-snippets-dialog -->
|
284 |
</div><!-- .hidden -->
|
285 |
-
<?
|
286 |
echo "\n<!-- END: Post Snippets UI Dialog -->\n";
|
287 |
}
|
288 |
|
@@ -353,138 +355,6 @@ function edOpenPostSnippets(myField) {
|
|
353 |
}
|
354 |
}
|
355 |
|
356 |
-
/**
|
357 |
-
* Handling of QuickTags in the HTML editor
|
358 |
-
*
|
359 |
-
* DELETE THIS PART WHEN THE NEW QUICKTAGS FUNCTION HAVE BEEN TRIED BY USERS.
|
360 |
-
*/
|
361 |
-
function quicktags() {
|
362 |
-
$snippets = get_option($this->plugin_options);
|
363 |
-
if (!empty($snippets)) { ?>
|
364 |
-
<script type="text/javascript">
|
365 |
-
if(typeof(edButtons)!='undefined') {
|
366 |
-
var postSnippetsNr, postSnippetsButton; <?php
|
367 |
-
for ($i = 0; $i < count($snippets); $i++) {
|
368 |
-
if ($snippets[$i]['quicktag']) {
|
369 |
-
// Make it js safe
|
370 |
-
$theSnippet = $snippets[$i]['snippet'];
|
371 |
-
$theSnippet = str_replace('"','\"',str_replace(Chr(13), '', str_replace(Chr(10), '', $theSnippet)));
|
372 |
-
//$theSnippet = str_replace('<', '\x3C', str_replace('>', '\x3E', $theSnippet));
|
373 |
-
$var_arr = explode(",",$snippets[$i]['vars']);
|
374 |
-
$theVariables = "";
|
375 |
-
if (!empty($var_arr[0])) {
|
376 |
-
for ($j = 0; $j < count($var_arr); $j++) {
|
377 |
-
$theVariables = $theVariables . "'" . $var_arr[$j] . "'";
|
378 |
-
if ( $j < (count($var_arr) -1) )
|
379 |
-
$theVariables = $theVariables . ", ";
|
380 |
-
}
|
381 |
-
}
|
382 |
-
|
383 |
-
if ($snippets[$i]['shortcode']) {
|
384 |
-
echo "var variables" . $i ." = new Array(".$theVariables.");";
|
385 |
-
echo "var insertString" . $i ." = createShortcode('".$snippets[$i]['title']."', variables".$i.");";
|
386 |
-
}else{
|
387 |
-
//echo "var insertString" . $i ." = '" . addslashes(stripslashes($theSnippet)). "';";
|
388 |
-
echo "var insertString" . $i ." = '" . str_replace('<', '\x3C', str_replace('>', '\x3E', addslashes(stripslashes($theSnippet)) )). "';";
|
389 |
-
}
|
390 |
-
|
391 |
-
echo '
|
392 |
-
postSnippetsNr = edButtons.length;
|
393 |
-
edButtons[postSnippetsNr] = new edButton(\'ed_psnip'. $i . '\', \'' . $snippets[$i]['title'] . '\', insertString'. $i .', \'\', \'\', -1);
|
394 |
-
|
395 |
-
';
|
396 |
-
/* postSnippetsNr = edButtons.length;
|
397 |
-
edButtons[postSnippetsNr] = new edButton(\'ed_ps'. $i . '\', \'' . $snippets[$i]['title'] . '\', insertString'. $i .', \'\', \'\', -1);
|
398 |
-
var postSnippetsButton = postSnippetsToolbar.lastChild;
|
399 |
-
|
400 |
-
while (postSnippetsButton.nodeType != 1) {
|
401 |
-
postSnippetsButton = postSnippetsButton.previousSibling;
|
402 |
-
}
|
403 |
-
|
404 |
-
postSnippetsButton = postSnippetsButton.cloneNode(true);
|
405 |
-
postSnippetsToolbar.appendChild(postSnippetsButton);
|
406 |
-
postSnippetsButton.value = \'' . $snippets[$i]['title'] . '\';
|
407 |
-
postSnippetsButton.title = postSnippetsNr;
|
408 |
-
var variables' . $i .' = new Array('.$theVariables.');
|
409 |
-
postSnippetsButton.onclick = function () {edInsertSnippet(edCanvas, insertString' . $i .', variables' . $i .', parseInt(this.title));}
|
410 |
-
postSnippetsButton.id = "ed_ps' . $i .'"; */
|
411 |
-
} // end if
|
412 |
-
} //next ?>
|
413 |
-
};
|
414 |
-
window.onload = ps_quicktags;
|
415 |
-
function ps_quicktags() { <?php
|
416 |
-
for ($i = 0; $i < count($snippets); $i++) {
|
417 |
-
if ($snippets[$i]['quicktag']) {
|
418 |
-
// Make it js safe
|
419 |
-
$theSnippet = $snippets[$i]['snippet'];
|
420 |
-
$theSnippet = str_replace('"','\"',str_replace(chr(13), '', str_replace(chr(10), '%%LF%%', $theSnippet)));
|
421 |
-
//$theSnippet = str_replace('<', '\x3C', str_replace('>', '\x3E', $theSnippet));
|
422 |
-
$var_arr = explode(",",$snippets[$i]['vars']);
|
423 |
-
$theVariables = "";
|
424 |
-
if (!empty($var_arr[0])) {
|
425 |
-
for ($j = 0; $j < count($var_arr); $j++) {
|
426 |
-
$theVariables = $theVariables . "'" . $var_arr[$j] . "'";
|
427 |
-
if ( $j < (count($var_arr) -1) )
|
428 |
-
$theVariables = $theVariables . ", ";
|
429 |
-
}
|
430 |
-
}
|
431 |
-
if ($snippets[$i]['shortcode']) {
|
432 |
-
echo "var variables" . $i ." = new Array(".$theVariables.");";
|
433 |
-
echo "var insertString" . $i ." = createShortcode('".$snippets[$i]['title']."', variables".$i.");";
|
434 |
-
}else{
|
435 |
-
//echo "var insertString" . $i ." = '" . addslashes(stripslashes($theSnippet)). "';";
|
436 |
-
$theSnippet = str_replace('<', '\x3C', str_replace('>', '\x3E', addslashes(stripslashes($theSnippet)) ));
|
437 |
-
$theSnippet = str_replace('%%LF%%', '\n', $theSnippet);
|
438 |
-
echo "var insertString" . $i ." = '" . $theSnippet . "';";
|
439 |
-
}
|
440 |
-
?>
|
441 |
-
var postSnippetsButton = document.getElementById('ed_psnip<?php echo $i; ?>');
|
442 |
-
var variables<?php echo $i; ?> = new Array(<?php echo $theVariables; ?>);
|
443 |
-
postSnippetsButton.onclick = function () {edInsertSnippet(edCanvas, insertString<?php echo $i; ?>, variables<?php echo $i; ?>, parseInt(this.title));}
|
444 |
-
<?php
|
445 |
-
} // end if
|
446 |
-
} // next ?>
|
447 |
-
}
|
448 |
-
|
449 |
-
|
450 |
-
<?php
|
451 |
-
/*
|
452 |
-
echo <<<JAVASCRIPT
|
453 |
-
function createShortcode(shortcodeTag, shortcodeAtts) {
|
454 |
-
theSnippet = '[' + shortcodeTag;
|
455 |
-
for (x in shortcodeAtts)
|
456 |
-
{
|
457 |
-
theSnippet += ' ' + shortcodeAtts[x] + '="{' + shortcodeAtts[x] + '}"';
|
458 |
-
}
|
459 |
-
theSnippet += ']';
|
460 |
-
return theSnippet;
|
461 |
-
}
|
462 |
-
|
463 |
-
function edInsertSnippet(myField,theSnippet,theVariables) {
|
464 |
-
var myValue;
|
465 |
-
var insertString;
|
466 |
-
insertString = theSnippet;
|
467 |
-
for (x in theVariables)
|
468 |
-
{
|
469 |
-
myValue = prompt(theVariables[x]);
|
470 |
-
var searchfor = '{' + theVariables[x] + '}';
|
471 |
-
var re = new RegExp(searchfor, 'g');
|
472 |
-
insertString = insertString.replace(re, myValue);
|
473 |
-
|
474 |
-
}
|
475 |
-
//theSnippet = str_replace('\x3C', '<', str_replace('\x3E', '>', insertString));
|
476 |
-
theSnippet = insertString;
|
477 |
-
if (theSnippet) {
|
478 |
-
edInsertContent( myField, theSnippet );
|
479 |
-
}
|
480 |
-
}
|
481 |
-
//-->
|
482 |
-
</script>
|
483 |
-
JAVASCRIPT;
|
484 |
-
*/
|
485 |
-
}
|
486 |
-
}
|
487 |
-
|
488 |
|
489 |
/**
|
490 |
* The Admin Page and all it's functions
|
@@ -523,6 +393,9 @@ JAVASCRIPT;
|
|
523 |
'<p><strong>' . __('Snippet', 'post-snippets') . '</strong></p>' .
|
524 |
'<p>' . __('This is the block of text or HTML to insert in the post when you select the snippet from the insert button in the TinyMCE panel in the post editor. If you have entered predefined variables you can reference them from the snippet by enclosing them in {} brackets.<br/><br/>Example:<br/>To reference the variables in the example above, you would enter {url} and {name}.<br/><br/>So if you enter this snippet:<br/><i>This is the website of <a href="{url}">{name}</a></i><br/>You will get the option to replace url and name on insert if they are defined as variables.', 'post-snippets') . '</p>' .
|
525 |
|
|
|
|
|
|
|
526 |
'<p><strong>' . __('SC', 'post-snippets') . '</strong></p>' .
|
527 |
'<p>' . __('Treats the snippet as a shortcode. The name for the shortcode is the same as the title of the snippet (spaces not allowed) and will be used on insert.', 'post-snippets') . '</p>' .
|
528 |
|
@@ -544,6 +417,7 @@ JAVASCRIPT;
|
|
544 |
array_push($snippets, array (
|
545 |
'title' => "Untitled",
|
546 |
'vars' => "",
|
|
|
547 |
'shortcode' => false,
|
548 |
'quicktag' => false,
|
549 |
'snippet' => ""));
|
@@ -558,6 +432,7 @@ JAVASCRIPT;
|
|
558 |
for ($i=0; $i < count($snippets); $i++) {
|
559 |
$snippets[$i]['title'] = trim($_POST[$i.'_title']);
|
560 |
$snippets[$i]['vars'] = str_replace(" ", "", trim($_POST[$i.'_vars']) );
|
|
|
561 |
$snippets[$i]['shortcode'] = isset($_POST[$i.'_shortcode']) ? true : false;
|
562 |
$snippets[$i]['quicktag'] = isset($_POST[$i.'_quicktag']) ? true : false;
|
563 |
/* Check if the plugin runs on PHP below version 5.1.0
|
@@ -615,6 +490,7 @@ JAVASCRIPT;
|
|
615 |
<th scope="col" style="width: 180px;"><?php _e( 'Title', 'post-snippets' ) ?></th>
|
616 |
<th scope="col" style="width: 180px;"><?php _e( 'Variables', 'post-snippets' ) ?></th>
|
617 |
<th scope="col"><?php _e( 'Snippet', 'post-snippets' ) ?></th>
|
|
|
618 |
<th scope="col" style="width: 20px;"><?php _e( 'SC', 'post-snippets' ) ?></th>
|
619 |
<th scope="col" style="width: 20px;"><?php _e( 'QT', 'post-snippets' ) ?></th>
|
620 |
</tr>
|
@@ -626,6 +502,7 @@ JAVASCRIPT;
|
|
626 |
<th scope="col"><?php _e( 'Title', 'post-snippets' ) ?></th>
|
627 |
<th scope="col"><?php _e( 'Variables', 'post-snippets' ) ?></th>
|
628 |
<th scope="col"><?php _e( 'Snippet', 'post-snippets' ) ?></th>
|
|
|
629 |
<th scope="col"><?php _e( 'SC', 'post-snippets' ) ?></th>
|
630 |
<th scope="col"><?php _e( 'QT', 'post-snippets' ) ?></th>
|
631 |
</tr>
|
@@ -641,6 +518,7 @@ JAVASCRIPT;
|
|
641 |
<td class='row-title'><input type='text' name='<?php echo $i; ?>_title' value='<?php echo $snippets[$i]['title']; ?>' /></td>
|
642 |
<td class='name'><input type='text' name='<?php echo $i; ?>_vars' value='<?php echo $snippets[$i]['vars']; ?>' /></td>
|
643 |
<td class='desc'><textarea name="<?php echo $i; ?>_snippet" class="large-text" rows="3"><?php echo htmlspecialchars($snippets[$i]['snippet'], ENT_NOQUOTES); ?></textarea></td>
|
|
|
644 |
<td class='name'><input type='checkbox' name='<?php echo $i; ?>_shortcode' value='true'<?php if ($snippets[$i]['shortcode'] == true) { echo " checked"; }?> /></td>
|
645 |
<td class='name'><input type='checkbox' name='<?php echo $i; ?>_quicktag' value='true'<?php if ($snippets[$i]['quicktag'] == true) { echo " checked"; }?> /></td>
|
646 |
</tr>
|
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.7.3
|
7 |
Author: Johan Steen
|
8 |
Author URI: http://wpstorm.net/
|
9 |
Text Domain: post-snippets
|
62 |
# Options Page
|
63 |
add_action( 'admin_menu', array(&$this,'wp_admin') );
|
64 |
|
|
|
|
|
|
|
|
|
|
|
65 |
$this->create_shortcodes();
|
66 |
|
67 |
# Adds the JS and HTML code in the header and footer for the jQuery insert UI dialog in the editor
|
93 |
* @returns Nothing
|
94 |
*/
|
95 |
function version_warning() {
|
96 |
+
echo '<div class="updated fade"><p><strong>'.__('Post Snippets requires WordPress version 3.0 or higher.', 'post-snippets').'</strong></p></div>';
|
97 |
}
|
98 |
|
99 |
/**
|
106 |
function enqueue_assets() {
|
107 |
wp_enqueue_script( 'jquery-ui-dialog' );
|
108 |
wp_enqueue_script( 'jquery-ui-tabs' );
|
109 |
+
wp_enqueue_style( 'wp-jquery-ui-dialog');
|
110 |
|
111 |
# Adds the CSS stylesheet for the jQuery UI dialog
|
112 |
$style_url = plugins_url( '/assets/post-snippets.css', __FILE__);
|
113 |
+
wp_register_style('post-snippets', $style_url);
|
114 |
+
wp_enqueue_style( 'post-snippets');
|
115 |
}
|
116 |
|
117 |
/**
|
143 |
$shortcode = $snippets[$i]['title'] . $variables;
|
144 |
echo "var postsnippet_{$i} = '[" . $shortcode . "]';\n";
|
145 |
} else {
|
146 |
+
$snippet = $snippets[$i]['snippet'];
|
147 |
+
# Fixes for potential collisions:
|
148 |
+
/* Replace <> with char codes, otherwise </script> in a snippet will break it */
|
149 |
+
$snippet = str_replace( '<', '\x3C', str_replace( '>', '\x3E', $snippet ) );
|
150 |
+
/* Escape " with \" */
|
151 |
+
$snippet = str_replace( '"', '\"', $snippet );
|
152 |
+
/* Remove CR and replace LF with \n to keep formatting */
|
153 |
+
$snippet = str_replace( chr(13), '', str_replace( chr(10), '\n', $snippet ) );
|
154 |
+
# Print out the variable containing the snippet
|
155 |
+
echo "var postsnippet_{$i} = \"" . $snippet . "\";\n";
|
156 |
}
|
157 |
}
|
158 |
?>
|
231 |
|
232 |
|
233 |
/**
|
234 |
+
* Insert Snippet jQuery UI dialog HTML for the post editor
|
235 |
*
|
236 |
* @since Post Snippets 1.7
|
237 |
*
|
260 |
<?php
|
261 |
// Print a snippet description is available
|
262 |
if ( isset($snippets[$i]['description']) )
|
263 |
+
echo '<p class="howto">' . $snippets[$i]['description'] . "</p>\n";
|
264 |
|
265 |
// Get all variables defined for the snippet and output them as input fields
|
266 |
$var_arr = explode(",",$snippets[$i]['vars']);
|
274 |
} else {
|
275 |
// If no variables and no description available, output a text to inform the user that it's an insert snippet only
|
276 |
if ( empty($snippets[$i]['description']) )
|
277 |
+
echo '<p class="howto">' . __('This snippet is insert only, no variables defined.', 'post-snippets') . "</p>";
|
278 |
}
|
279 |
?>
|
280 |
</div><!-- #ps-tabs-## -->
|
284 |
</div><!-- #post-snippets-tabs -->
|
285 |
</div><!-- #post-snippets-dialog -->
|
286 |
</div><!-- .hidden -->
|
287 |
+
<?php
|
288 |
echo "\n<!-- END: Post Snippets UI Dialog -->\n";
|
289 |
}
|
290 |
|
355 |
}
|
356 |
}
|
357 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
358 |
|
359 |
/**
|
360 |
* The Admin Page and all it's functions
|
393 |
'<p><strong>' . __('Snippet', 'post-snippets') . '</strong></p>' .
|
394 |
'<p>' . __('This is the block of text or HTML to insert in the post when you select the snippet from the insert button in the TinyMCE panel in the post editor. If you have entered predefined variables you can reference them from the snippet by enclosing them in {} brackets.<br/><br/>Example:<br/>To reference the variables in the example above, you would enter {url} and {name}.<br/><br/>So if you enter this snippet:<br/><i>This is the website of <a href="{url}">{name}</a></i><br/>You will get the option to replace url and name on insert if they are defined as variables.', 'post-snippets') . '</p>' .
|
395 |
|
396 |
+
'<p><strong>' . __('Description', 'post-snippets') . '</strong></p>' .
|
397 |
+
'<p>' . __('An optional description for the Snippet. If entered it will be displayed in the snippets popup window in the post editor.', 'post-snippets') . '</p>' .
|
398 |
+
|
399 |
'<p><strong>' . __('SC', 'post-snippets') . '</strong></p>' .
|
400 |
'<p>' . __('Treats the snippet as a shortcode. The name for the shortcode is the same as the title of the snippet (spaces not allowed) and will be used on insert.', 'post-snippets') . '</p>' .
|
401 |
|
417 |
array_push($snippets, array (
|
418 |
'title' => "Untitled",
|
419 |
'vars' => "",
|
420 |
+
'description' => "",
|
421 |
'shortcode' => false,
|
422 |
'quicktag' => false,
|
423 |
'snippet' => ""));
|
432 |
for ($i=0; $i < count($snippets); $i++) {
|
433 |
$snippets[$i]['title'] = trim($_POST[$i.'_title']);
|
434 |
$snippets[$i]['vars'] = str_replace(" ", "", trim($_POST[$i.'_vars']) );
|
435 |
+
$snippets[$i]['description'] = esc_html( $_POST[$i.'_description'] );
|
436 |
$snippets[$i]['shortcode'] = isset($_POST[$i.'_shortcode']) ? true : false;
|
437 |
$snippets[$i]['quicktag'] = isset($_POST[$i.'_quicktag']) ? true : false;
|
438 |
/* Check if the plugin runs on PHP below version 5.1.0
|
490 |
<th scope="col" style="width: 180px;"><?php _e( 'Title', 'post-snippets' ) ?></th>
|
491 |
<th scope="col" style="width: 180px;"><?php _e( 'Variables', 'post-snippets' ) ?></th>
|
492 |
<th scope="col"><?php _e( 'Snippet', 'post-snippets' ) ?></th>
|
493 |
+
<th scope="col"><?php _e( 'Description', 'post-snippets' ) ?></th>
|
494 |
<th scope="col" style="width: 20px;"><?php _e( 'SC', 'post-snippets' ) ?></th>
|
495 |
<th scope="col" style="width: 20px;"><?php _e( 'QT', 'post-snippets' ) ?></th>
|
496 |
</tr>
|
502 |
<th scope="col"><?php _e( 'Title', 'post-snippets' ) ?></th>
|
503 |
<th scope="col"><?php _e( 'Variables', 'post-snippets' ) ?></th>
|
504 |
<th scope="col"><?php _e( 'Snippet', 'post-snippets' ) ?></th>
|
505 |
+
<th scope="col"><?php _e( 'Description', 'post-snippets' ) ?></th>
|
506 |
<th scope="col"><?php _e( 'SC', 'post-snippets' ) ?></th>
|
507 |
<th scope="col"><?php _e( 'QT', 'post-snippets' ) ?></th>
|
508 |
</tr>
|
518 |
<td class='row-title'><input type='text' name='<?php echo $i; ?>_title' value='<?php echo $snippets[$i]['title']; ?>' /></td>
|
519 |
<td class='name'><input type='text' name='<?php echo $i; ?>_vars' value='<?php echo $snippets[$i]['vars']; ?>' /></td>
|
520 |
<td class='desc'><textarea name="<?php echo $i; ?>_snippet" class="large-text" rows="3"><?php echo htmlspecialchars($snippets[$i]['snippet'], ENT_NOQUOTES); ?></textarea></td>
|
521 |
+
<td class='desc'><textarea name="<?php echo $i; ?>_description" class="large-text" rows="3"><?php if (isset( $snippets[$i]['description'] ) ) echo htmlspecialchars($snippets[$i]['description'], ENT_NOQUOTES); ?></textarea></td>
|
522 |
<td class='name'><input type='checkbox' name='<?php echo $i; ?>_shortcode' value='true'<?php if ($snippets[$i]['shortcode'] == true) { echo " checked"; }?> /></td>
|
523 |
<td class='name'><input type='checkbox' name='<?php echo $i; ?>_quicktag' value='true'<?php if ($snippets[$i]['quicktag'] == true) { echo " checked"; }?> /></td>
|
524 |
</tr>
|
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.1
|
7 |
-
Stable tag: 1.7.
|
8 |
|
9 |
Store snippets of HTML code or reoccurring text that you often use in your posts. Custom variables can be used.
|
10 |
|
@@ -14,10 +14,9 @@ This admin plugin stores snippets of HTML code or reoccurring text that you ofte
|
|
14 |
|
15 |
Related Links:
|
16 |
|
|
|
17 |
* [Support Forum](http://wordpress.org/tags/post-snippets?forum_id=10 "Use this for support and feature requests")
|
18 |
|
19 |
-
For complete usage instructions see: [Post Snippets](http://wpstorm.net/wordpress-plugins/post-snippets/ "Complete Usage Instructions for Post Snippets")
|
20 |
-
|
21 |
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).
|
22 |
|
23 |
= Features =
|
@@ -56,6 +55,13 @@ Please visit the [Support Forum](http://wordpress.org/tags/post-snippets?forum_i
|
|
56 |
|
57 |
== Changelog ==
|
58 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
= Version 1.7.2 - 28 Feb 2011 =
|
60 |
* Specified text/javascript for the UI dialog script.
|
61 |
* Updated the Spanish translation by [Melvis E. Leon Lopez](http://www.soludata.net/site/).
|
4 |
Tags: post, admin, snippet, html, custom, page, dynamic, editor, quicktag
|
5 |
Requires at least: 3.0
|
6 |
Tested up to: 3.1
|
7 |
+
Stable tag: 1.7.3
|
8 |
|
9 |
Store snippets of HTML code or reoccurring text that you often use in your posts. Custom variables can be used.
|
10 |
|
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 |
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).
|
21 |
|
22 |
= Features =
|
55 |
|
56 |
== Changelog ==
|
57 |
|
58 |
+
= Version 1.7.3 - 3 Mar 2011 =
|
59 |
+
* Added a text area field in the settings panel to enter an optional description for each snippet. This decription is displayed for the editor writing a post in the jQuery Post Snippet dialog.
|
60 |
+
* Fixed the syling of the quicktag jQuery window when the user have disable the visual editor completely.
|
61 |
+
* Fixed problem with line formatting in the new quicktag snippets.
|
62 |
+
* Fixed a problem with JavaScript snippets breaking the admin page.
|
63 |
+
* Various small bugfixes.
|
64 |
+
|
65 |
= Version 1.7.2 - 28 Feb 2011 =
|
66 |
* Specified text/javascript for the UI dialog script.
|
67 |
* Updated the Spanish translation by [Melvis E. Leon Lopez](http://www.soludata.net/site/).
|