Raw HTML - Version 1.0.2

Version Description

Download this release

Release Info

Developer whiteshadow
Plugin Icon wp plugin Raw HTML
Version 1.0.2
Comparing to
See all releases

Version 1.0.2

Files changed (2) hide show
  1. raw_html.php +44 -0
  2. readme.txt +39 -0
raw_html.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Plugin Name: Raw HTML capability
4
+ Plugin URI: http://w-shadow.com/blog/2007/12/13/raw-html-in-wordpress/
5
+ Description: Lets you enter raw HTML in your posts. See website for details.
6
+ Version: 1.0.2
7
+ Author: Janis Elsts
8
+ Author URI: http://w-shadow.com/blog/
9
+ */
10
+
11
+ /*
12
+ Created by Janis Elsts (email : whiteshadow@w-shadow.com)
13
+ It's GPL.
14
+ */
15
+
16
+ global $wsh_raw_parts;
17
+ $wsh_raw_parts=array();
18
+
19
+ function wsh_extraction_callback($matches){
20
+ global $wsh_raw_parts;
21
+ $wsh_raw_parts[]=$matches[2];
22
+ return "!RAWBLOCK".(count($wsh_raw_parts)-1)."!";
23
+ }
24
+
25
+ function wsh_extract_exclusions($text){
26
+ global $wsh_raw_parts;
27
+ return preg_replace_callback("/(<!--\s*start_raw\s*-->|\[RAW\])(.*)(<!\s*--end_raw\s*-->|\[\/RAW\])/Uis",
28
+ "wsh_extraction_callback", $text);
29
+ }
30
+
31
+ function wsh_insertion_callback($matches){
32
+ global $wsh_raw_parts;
33
+ return $wsh_raw_parts[intval($matches[1])];
34
+ }
35
+
36
+ function wsh_insert_exclusions($text){
37
+ global $wsh_raw_parts;
38
+ if(!isset($wsh_raw_parts)) return $text;
39
+ return preg_replace_callback("/!RAWBLOCK(\d+)!/Uis", "wsh_insertion_callback", $text);
40
+ }
41
+
42
+ add_filter('the_content', 'wsh_extract_exclusions', 0);
43
+ add_filter('the_content', 'wsh_insert_exclusions', 1001);
44
+ ?>
readme.txt ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === Raw HTML ===
2
+ Contributors: whiteshadow
3
+ Tags: posts, formatting, javascript, html, css, code
4
+ Requires at least: 2.2
5
+ Tested up to: 2.3.2
6
+ Stable tag: 1.0.2
7
+
8
+ Lets you use raw HTML or any other code in your posts.
9
+
10
+ == Description ==
11
+
12
+ This plugin lets you use raw HTML or any other code in your posts. Wrap a part of your post in special tags (below) to prevent WordPress from converting newlines to HTML paragraphs, escaping apostrophes and so on. Very useful if you need to add a CSS block or JavaScript to your post.
13
+
14
+ **Using the plugin**
15
+
16
+ To prevent a part of your post or page from being filtered by WordPress, wrap it in `<!--start_raw-->...<!--end_raw-->` or `[RAW]...[/RAW]` tags. These two versions work exactly the same, but the latter may be handy if you're using the visual editor (not recommended).
17
+
18
+ *Example :*
19
+ `<!--start_raw-->
20
+ This
21
+
22
+ is
23
+
24
+ a 'test'!
25
+ <!--end_raw-->`
26
+
27
+ **Notes**
28
+
29
+ * I strongly recommend to turn off the visual editor when you want to edit a post that contains raw HTML/JS/CSS.
30
+ * Personally, I prefer the `<!--start_raw-->...<!--end_raw-->` syntax. These tags are formed as HTML comments, which means they won't be visible to your visitors even if you deactivate the Raw HTML plugin. On the other hand. the `[RAW]...[/RAW]` tags would show up.
31
+
32
+ == Installation ==
33
+
34
+ To install the plugin follow these steps :
35
+
36
+ 1. Download the raw-html.zip file to your local machine.
37
+ 1. Unzip the file.
38
+ 1. Upload the "raw-html" folder to your "/wp-content/plugins/" directory.
39
+ 1. Activate the plugin through the 'Plugins' menu in WordPress