Version Description
Download this release
Release Info
Developer | whiteshadow |
Plugin | Raw HTML |
Version | 1.2.3 |
Comparing to | |
See all releases |
Code changes from version 1.2.2 to 1.2.3
- raw_html.php +41 -3
- readme.txt +1 -1
raw_html.php
CHANGED
@@ -3,7 +3,7 @@
|
|
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. You can also enable/disable smart quotes and other automatic formatting on a per-post basis.
|
6 |
-
Version: 1.2.
|
7 |
Author: Janis Elsts
|
8 |
Author URI: http://w-shadow.com/blog/
|
9 |
*/
|
@@ -21,14 +21,52 @@ $wsh_raw_parts=array();
|
|
21 |
|
22 |
function wsh_extraction_callback($matches){
|
23 |
global $wsh_raw_parts;
|
24 |
-
$wsh_raw_parts[]=$matches[
|
25 |
return "!RAWBLOCK".(count($wsh_raw_parts)-1)."!";
|
26 |
}
|
27 |
|
28 |
function wsh_extract_exclusions($text){
|
29 |
global $wsh_raw_parts;
|
30 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
"wsh_extraction_callback", $text);
|
|
|
32 |
}
|
33 |
|
34 |
function wsh_insertion_callback($matches){
|
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. You can also enable/disable smart quotes and other automatic formatting on a per-post basis.
|
6 |
+
Version: 1.2.3
|
7 |
Author: Janis Elsts
|
8 |
Author URI: http://w-shadow.com/blog/
|
9 |
*/
|
21 |
|
22 |
function wsh_extraction_callback($matches){
|
23 |
global $wsh_raw_parts;
|
24 |
+
$wsh_raw_parts[]=$matches[1];
|
25 |
return "!RAWBLOCK".(count($wsh_raw_parts)-1)."!";
|
26 |
}
|
27 |
|
28 |
function wsh_extract_exclusions($text){
|
29 |
global $wsh_raw_parts;
|
30 |
+
|
31 |
+
$tags = array(array('<!--start_raw-->', '<!--end_raw-->'), array('[RAW]', '[/RAW]'));
|
32 |
+
|
33 |
+
foreach ($tags as $tag_pair){
|
34 |
+
list($start_tag, $end_tag) = $tag_pair;
|
35 |
+
|
36 |
+
//Find the start tag
|
37 |
+
$start = stripos($text, $start_tag, 0);
|
38 |
+
while($start !== false){
|
39 |
+
$content_start = $start + strlen($start_tag);
|
40 |
+
|
41 |
+
//find the end tag
|
42 |
+
$fin = stripos($text, $end_tag, $content_start);
|
43 |
+
|
44 |
+
//break if there's no end tag
|
45 |
+
if ($fin == false) break;
|
46 |
+
|
47 |
+
//extract the content between the tags
|
48 |
+
$content = substr($text, $content_start,$fin-$content_start);
|
49 |
+
|
50 |
+
//Store the content and replace it with a marker
|
51 |
+
$wsh_raw_parts[]=$content;
|
52 |
+
$replacement = "!RAWBLOCK".(count($wsh_raw_parts)-1)."!";
|
53 |
+
$text = substr_replace($text, $replacement, $start,
|
54 |
+
$fin+strlen($end_tag)-$start
|
55 |
+
);
|
56 |
+
|
57 |
+
//Have we reached the end of the string yet?
|
58 |
+
if ($start + strlen($replacement) > strlen($text)) break;
|
59 |
+
|
60 |
+
//Find the next start tag
|
61 |
+
$start = stripos($text, $start_tag, $start + strlen($replacement));
|
62 |
+
}
|
63 |
+
}
|
64 |
+
return $text;
|
65 |
+
/*
|
66 |
+
//The regexp version is much shorter, but it has problems with big posts :
|
67 |
+
return preg_replace_callback("/(?:<!--\s*start_raw\s*-->|\[RAW\])(.*?)(?:<!--\s*end_raw\s*-->|\[\/RAW\])/is",
|
68 |
"wsh_extraction_callback", $text);
|
69 |
+
// */
|
70 |
}
|
71 |
|
72 |
function wsh_insertion_callback($matches){
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: whiteshadow
|
|
3 |
Tags: posts, formatting, javascript, html, css, code
|
4 |
Requires at least: 2.2
|
5 |
Tested up to: 2.7.1
|
6 |
-
Stable tag: 1.2.
|
7 |
|
8 |
Lets you use raw HTML or any other code in your posts. You can also disable smart quotes and other automatic formatting on a per-post basis.
|
9 |
|
3 |
Tags: posts, formatting, javascript, html, css, code
|
4 |
Requires at least: 2.2
|
5 |
Tested up to: 2.7.1
|
6 |
+
Stable tag: 1.2.3
|
7 |
|
8 |
Lets you use raw HTML or any other code in your posts. You can also disable smart quotes and other automatic formatting on a per-post basis.
|
9 |
|