Post Snippets - Version 1.4.8

Version Description

Download this release

Release Info

Developer artstorm
Plugin Icon 128x128 Post Snippets
Version 1.4.8
Comparing to
See all releases

Code changes from version 1.4.7 to 1.4.8

Files changed (4) hide show
  1. post-snippets-config.php +0 -34
  2. post-snippets.php +5 -2
  3. readme.txt +16 -7
  4. tinymce/window.php +12 -4
post-snippets-config.php DELETED
@@ -1,34 +0,0 @@
1
- <?php
2
- /**
3
- * Bootstrap file for getting the ABSPATH constant to wp-load.php
4
- * This is requried when a plugin requires access not via the admin screen.
5
- *
6
- * If the wp-load.php file is not found, then an error will be displayed
7
- *
8
- * @package WordPress
9
- * @since Version 2.6
10
- */
11
-
12
- /** Define the server path to the file wp-config here, if you placed WP-CONTENT outside the classic file structure */
13
-
14
- $path = ''; // It should be end with a trailing slash
15
-
16
- /** That's all, stop editing from here **/
17
-
18
- if ( !defined('WP_LOAD_PATH') ) {
19
-
20
- /** classic root path if wp-content and plugins is below wp-config.php */
21
- $classic_root = dirname(dirname(dirname(dirname(__FILE__)))) . '/' ;
22
-
23
- if (file_exists( $classic_root . 'wp-load.php') )
24
- define( 'WP_LOAD_PATH', $classic_root);
25
- else
26
- if (file_exists( $path . 'wp-load.php') )
27
- define( 'WP_LOAD_PATH', $path);
28
- else
29
- exit("Could not find wp-load.php");
30
- }
31
-
32
- // let's load WordPress
33
- require_once( WP_LOAD_PATH . 'wp-load.php');
34
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
post-snippets.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Post Snippets
4
  Plugin URI: http://coding.cglounge.com/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.4.7
7
  Author: Johan Steen
8
  Author URI: http://coding.cglounge.com/
9
  Text Domain: post-snippets
@@ -126,6 +126,7 @@ class post_snippets {
126
  if ($snippets[$i]['quicktag']) {
127
  // Make it js safe
128
  $theSnippet = str_replace('"','\"',str_replace(Chr(13), '', str_replace(Chr(10), '', $snippets[$i]['snippet'])));
 
129
  $var_arr = explode(",",$snippets[$i]['vars']);
130
  $theVariables = "";
131
  if (!empty($var_arr[0])) {
@@ -141,7 +142,8 @@ class post_snippets {
141
  echo "var variables" . $i ." = new Array(".$theVariables.");";
142
  echo "var insertString" . $i ." = createShortcode('".$snippets[$i]['title']."', variables".$i.");";
143
  }else{
144
- echo "var insertString" . $i ." = '" . addslashes(stripslashes($theSnippet)). "';";
 
145
  }
146
  echo '
147
  postSnippetsNr = edButtons.length;
@@ -187,6 +189,7 @@ echo <<<JAVASCRIPT
187
  insertString = insertString.replace(re, myValue);
188
 
189
  }
 
190
  theSnippet = insertString;
191
  if (theSnippet) {
192
  edInsertContent( myField, theSnippet );
3
  Plugin Name: Post Snippets
4
  Plugin URI: http://coding.cglounge.com/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.4.8
7
  Author: Johan Steen
8
  Author URI: http://coding.cglounge.com/
9
  Text Domain: post-snippets
126
  if ($snippets[$i]['quicktag']) {
127
  // Make it js safe
128
  $theSnippet = str_replace('"','\"',str_replace(Chr(13), '', str_replace(Chr(10), '', $snippets[$i]['snippet'])));
129
+ //$theSnippet = str_replace('<', '\x3C', str_replace('>', '\x3E', $theSnippet));
130
  $var_arr = explode(",",$snippets[$i]['vars']);
131
  $theVariables = "";
132
  if (!empty($var_arr[0])) {
142
  echo "var variables" . $i ." = new Array(".$theVariables.");";
143
  echo "var insertString" . $i ." = createShortcode('".$snippets[$i]['title']."', variables".$i.");";
144
  }else{
145
+ //echo "var insertString" . $i ." = '" . addslashes(stripslashes($theSnippet)). "';";
146
+ echo "var insertString" . $i ." = '" . str_replace('<', '\x3C', str_replace('>', '\x3E', addslashes(stripslashes($theSnippet)) )). "';";
147
  }
148
  echo '
149
  postSnippetsNr = edButtons.length;
189
  insertString = insertString.replace(re, myValue);
190
 
191
  }
192
+ //theSnippet = str_replace('\x3C', '<', str_replace('\x3E', '>', insertString));
193
  theSnippet = insertString;
194
  if (theSnippet) {
195
  edInsertContent( myField, theSnippet );
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://coding.cglounge.com/wordpress-plugins/post-snippets/#pintwar
4
  Tags: post, admin, snippet, html, custom, page, dynamic, editor, quicktag
5
  Requires at least: 2.7
6
  Tested up to: 2.7.1
7
- Stable tag: 1.4.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,9 +14,9 @@ This admin plugin stores snippets of HTML code or reoccurring text that you ofte
14
 
15
  For complete usage instructions see: [Post Snippets](http://coding.cglounge.com/wordpress-plugins/post-snippets/ "Complete Usage Instructions for Post Snippets")
16
 
17
- See the [Changelog](http://wordpress.org/extend/plugins/post-snippets/other_notes/) for what's new.
18
 
19
- Some features:
20
 
21
  * **Insert** All defined snippets is inserted from a button directly in the post editor.
22
  * **Shortcodes** You can use this plugin to create your own shortcodes.
@@ -28,16 +28,21 @@ Some features:
28
 
29
  == Installation ==
30
 
 
 
31
  1. Upload the 'post-snippets' folder to the '/wp-content/plugins/' directory.
32
  2. Activate the plugin through the 'Plugins' menu in WordPress.
33
  3. Go to Settings -> Post Snippets and start entering your snippets.
34
 
 
35
 
36
- == Frequently Asked Questions ==
 
 
37
 
38
- = Guru? =
39
 
40
- Meditation.
41
 
42
  == Screenshots ==
43
 
@@ -47,6 +52,10 @@ Meditation.
47
 
48
  == Changelog ==
49
 
 
 
 
 
50
  = Version 1.4.7 - 27 Apr 2009 =
51
  * Added a workaround for a bug in WordPress 2.7.x wp-includes/compat.php that prevented the plugin to work correctly on webservers running with PHP below version 5.1.0 together with WP 2.7.x. This bug is patched in WordPress 2.8.
52
 
@@ -94,4 +103,4 @@ Meditation.
94
  * Added TextDomain functionality for I18n.
95
 
96
  = Version 1.0 - 23 Mar 2009 =
97
- * Initial Release
4
  Tags: post, admin, snippet, html, custom, page, dynamic, editor, quicktag
5
  Requires at least: 2.7
6
  Tested up to: 2.7.1
7
+ Stable tag: 1.4.8
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
  For complete usage instructions see: [Post Snippets](http://coding.cglounge.com/wordpress-plugins/post-snippets/ "Complete Usage Instructions for Post Snippets")
16
 
17
+ See the [Changelog](http://wordpress.org/extend/plugins/post-snippets/changelog/) for what's new.
18
 
19
+ = Features =
20
 
21
  * **Insert** All defined snippets is inserted from a button directly in the post editor.
22
  * **Shortcodes** You can use this plugin to create your own shortcodes.
28
 
29
  == Installation ==
30
 
31
+ = Install =
32
+
33
  1. Upload the 'post-snippets' folder to the '/wp-content/plugins/' directory.
34
  2. Activate the plugin through the 'Plugins' menu in WordPress.
35
  3. Go to Settings -> Post Snippets and start entering your snippets.
36
 
37
+ = Uninstall =
38
 
39
+ 1. Deactivate Post Snippets in the 'Plugins' menu in Wordpress.
40
+ 2. Select Post Snippets in the 'Recently Active Plugins' section and select 'Delete' from the 'Bulk Actions' drop down menu.
41
+ 3. This will delete all the plugin files from the server as well as erasing all options the plugin has stored in the database.
42
 
43
+ == Frequently Asked Questions ==
44
 
45
+ Please visit [Post Snippets' Comments](http://coding.cglounge.com/wordpress-plugins/post-snippets/#comments) for questions and answers.
46
 
47
  == Screenshots ==
48
 
52
 
53
  == Changelog ==
54
 
55
+ = Version 1.4.8 - 9 May 2009 =
56
+ * Changed the handling of the TinyMCE button as some server configurations had problems finding the correct path.
57
+ * Fixed a problem that didn't let a snippet contain a </script> tag.
58
+
59
  = Version 1.4.7 - 27 Apr 2009 =
60
  * Added a workaround for a bug in WordPress 2.7.x wp-includes/compat.php that prevented the plugin to work correctly on webservers running with PHP below version 5.1.0 together with WP 2.7.x. This bug is patched in WordPress 2.8.
61
 
103
  * Added TextDomain functionality for I18n.
104
 
105
  = Version 1.0 - 23 Mar 2009 =
106
+ * Initial Release
tinymce/window.php CHANGED
@@ -1,8 +1,15 @@
1
  <?php
2
- // look up for the path
3
- require_once( dirname( dirname(__FILE__) ) .'/post-snippets-config.php');
 
 
 
 
 
 
 
 
4
 
5
- global $wpdb;
6
 
7
  // check for rights
8
  if ( !is_user_logged_in() || !current_user_can('edit_posts') )
@@ -51,7 +58,8 @@ if ( !is_user_logged_in() || !current_user_can('edit_posts') )
51
  $snippets = get_option($post_snippets->plugin_options);
52
  for ($i = 0; $i < count($snippets); $i++) {
53
  // Make it js safe
54
- $theString = str_replace('"','\"',str_replace(Chr(13), '', str_replace(Chr(10), '', $snippets[$i]['snippet'])))
 
55
  ?>
56
 
57
  if (panel<?php echo $i; ?>.className.indexOf('current') != -1) {
1
  <?php
2
+ /* Finding the path to the wp-admin folder */
3
+ $iswin = preg_match('/:\\\/', dirname(__file__));
4
+ $slash = ($iswin) ? "\\" : "/";
5
+
6
+ $wp_path = preg_split('/(?=((\\\|\/)wp-content)).*/', dirname(__file__));
7
+ $wp_path = (isset($wp_path[0]) && $wp_path[0] != "") ? $wp_path[0] : $_SERVER["DOCUMENT_ROOT"];
8
+
9
+ /** Load WordPress Administration Bootstrap */
10
+ require_once($wp_path . $slash . 'wp-load.php');
11
+ require_once($wp_path . $slash . 'wp-admin' . $slash . 'admin.php');
12
 
 
13
 
14
  // check for rights
15
  if ( !is_user_logged_in() || !current_user_can('edit_posts') )
58
  $snippets = get_option($post_snippets->plugin_options);
59
  for ($i = 0; $i < count($snippets); $i++) {
60
  // Make it js safe
61
+ $theString = str_replace('"','\"',str_replace(Chr(13), '', str_replace(Chr(10), '', str_replace('<', '\x3C', str_replace('>', '\x3E', $snippets[$i]['snippet'])))));
62
+ // \x3C and \x3E
63
  ?>
64
 
65
  if (panel<?php echo $i; ?>.className.indexOf('current') != -1) {