\s*(?' . $allblocks . '[^>]*>)\s*
!', "$1", $pee); // don't pee all over a tag
- $pee = preg_replace("||", "$1", $pee); // problem with nested lists
- $pee = preg_replace('|]*)>|i', "", $pee);
- $pee = str_replace('
', '
', $pee);
- $pee = preg_replace('!\s*(?' . $allblocks . '[^>]*>)!', "$1", $pee);
- $pee = preg_replace('!(?' . $allblocks . '[^>]*>)\s*
!', "$1", $pee);
- if ($br) {
- $pee = preg_replace_callback('/<(script|style).*?<\/\\1>/s', create_function('$matches', 'return str_replace("\n", "", $matches[0]);'), $pee);
- $pee = preg_replace('|(?)\s*\n|', "
\n", $pee); // optionally make line breaks
- $pee = str_replace('', "\n", $pee);
- }
- $pee = preg_replace('!(?' . $allblocks . '[^>]*>)\s*
!', "$1", $pee);
- $pee = preg_replace('!
(\s*?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)[^>]*>)!', '$1', $pee);
- //if (strpos($pee, '. Only there because of the comment.
- // $pee = preg_replace_callback('!()(.*?)
!is', 'clean_pre', $pee );
- //}
- $pee = preg_replace("|\n$|", '', $pee);
-
- return $pee;
+function autop($pee) {
+ return elgg_autop($pee);
+}
+
+/**
+ * Create paragraphs from text with line spacing
+ *
+ * @param string $pee The string
+ *
+ * @return string
+ **/
+function elgg_autop($pee) {
+ return ElggAutop::getInstance()->process($pee);
}
/**
@@ -398,3 +372,32 @@ function elgg_strip_tags($string) {
return $string;
}
+
+/**
+ * Unit tests for Output
+ *
+ * @param sting $hook unit_test
+ * @param string $type system
+ * @param mixed $value Array of tests
+ * @param mixed $params Params
+ *
+ * @return array
+ * @access private
+ */
+function output_unit_test($hook, $type, $value, $params) {
+ global $CONFIG;
+ $value[] = $CONFIG->path . 'engine/tests/api/output.php';
+ return $value;
+}
+
+/**
+ * Initialise the Output subsystem.
+ *
+ * @return void
+ * @access private
+ */
+function output_init() {
+ elgg_register_plugin_hook_handler('unit_test', 'system', 'output_unit_test');
+}
+
+elgg_register_event_handler('init', 'system', 'output_init');
diff --git a/engine/tests/api/output.php b/engine/tests/api/output.php
new file mode 100644
index 000000000..eb1a66b29
--- /dev/null
+++ b/engine/tests/api/output.php
@@ -0,0 +1,64 @@
+
+ */
+class ElggCoreOutputAutoPTest extends ElggCoreUnitTest {
+
+ /**
+ * @var ElggAutop
+ */
+ protected $_autop;
+
+ public function setUp() {
+ $this->_autop = new ElggAutop();
+ }
+
+ public function testDomRoundtrip()
+ {
+ $d = dir(dirname(__DIR__) . '/test_files/output/autop');
+ $in = file_get_contents($d->path . "/domdoc_in.html");
+ $exp = file_get_contents($d->path . "/domdoc_exp.html");
+
+ $doc = new DOMDocument();
+ libxml_use_internal_errors(true);
+ $doc->loadHTML(""
+ . $in . '');
+ $serialized = $doc->saveHTML();
+ list(,$out) = explode('', $serialized, 2);
+ list($out) = explode('', $out, 2);
+
+ $this->assertEqual($exp, $out, "DOMDocument's parsing/serialization roundtrip");
+ }
+
+ public function testProcess()
+ {
+ $data = $this->provider();
+ foreach ($data as $row) {
+ list($test, $in, $exp) = $row;
+ $out = $this->_autop->process($in);
+ $this->assertEqual($exp, $out, "Equality case {$test}");
+ }
+ }
+
+ public function provider()
+ {
+ $d = dir(dirname(__DIR__) . '/test_files/output/autop');
+ $tests = array();
+ while (false !== ($entry = $d->read())) {
+ if (preg_match('/^([a-z\\-]+)\.in\.html$/i', $entry, $m)) {
+ $tests[] = $m[1];
+ }
+ }
+
+ $data = array();
+ foreach ($tests as $test) {
+ $data[] = array(
+ $test,
+ file_get_contents($d->path . '/' . "{$test}.in.html"),
+ file_get_contents($d->path . '/' . "{$test}.exp.html"),
+ );
+ }
+ return $data;
+ }
+}
diff --git a/engine/tests/test_files/output/autop/block-a.exp.norun.html b/engine/tests/test_files/output/autop/block-a.exp.norun.html
new file mode 100644
index 000000000..addf29dec
--- /dev/null
+++ b/engine/tests/test_files/output/autop/block-a.exp.norun.html
@@ -0,0 +1,6 @@
+
+HTML5 allows A to contain block-level content
+A treated as block
+Read more
+
+A treated as
inline
diff --git a/engine/tests/test_files/output/autop/block-a.in.norun.html b/engine/tests/test_files/output/autop/block-a.in.norun.html
new file mode 100644
index 000000000..fc2dac43a
--- /dev/null
+++ b/engine/tests/test_files/output/autop/block-a.in.norun.html
@@ -0,0 +1,9 @@
+HTML5 allows A to contain block-level content
+
+
+ A treated as block
+
+ Read more
+
+A treated as
+ inline
diff --git a/engine/tests/test_files/output/autop/domdoc_exp.html b/engine/tests/test_files/output/autop/domdoc_exp.html
new file mode 100644
index 000000000..8480c1083
--- /dev/null
+++ b/engine/tests/test_files/output/autop/domdoc_exp.html
@@ -0,0 +1,46 @@
+›
+
+Vietnamese - Tiếng Việt
+
+h1
+Paragraph link Bold italic bolditalic
+h2
+Paragraph size1 size2 size4
+h3
+Paragraph underline strikethrough color background
+
+ Blockquoted paragraph
+
+Paragraph following blockquote
+Paragraph between lists
+- Ordered
+ - List
+
Paragraph between lists
+- OL list
+ - nested
- inside a
+ - UL list
+
+
Paragraph between lists
+Table with |
+ |
+
|
+ border=0 |
+
Paragraph
+- UL list
+ - nested
+
+
Paragraph between tables
+Table with border=1 |
+ |
+
|
+ cellpadding = 5 |
+
Paragraph between tables
+Table with |
+ |
+
|
+ border=2 |
+
\ No newline at end of file
diff --git a/engine/tests/test_files/output/autop/domdoc_in.html b/engine/tests/test_files/output/autop/domdoc_in.html
new file mode 100644
index 000000000..4c465b435
--- /dev/null
+++ b/engine/tests/test_files/output/autop/domdoc_in.html
@@ -0,0 +1,80 @@
+›
+
+Vietnamese - Tiếng Việt
+
+h1
+Paragraph link Bold italic bolditalic
+h2
+Paragraph size1 size2 size4
+h3
+Paragraph underline strikethrough color background
+
+ Blockquoted paragraph
+
+Paragraph following blockquote
+
+Paragraph between lists
+
+ - Ordered
+ - List
+
+Paragraph between lists
+
+ - OL list
+ - nested
+ - inside a
+ - UL list
+
+
+Paragraph between lists
+
+
+
+ Table with |
+ |
+
+
+ |
+ border=0 |
+
+
+
+Paragraph
+
+ - UL list
+ - nested
+
+
+
+Paragraph between tables
+
+
+
+ Table with border=1 |
+ |
+
+
+ |
+ cellpadding = 5 |
+
+
+
+Paragraph between tables
+
+
+
+ Table with |
+ |
+
+
+ |
+ border=2 |
+
+
+
\ No newline at end of file
diff --git a/engine/tests/test_files/output/autop/typical-post.exp.html b/engine/tests/test_files/output/autop/typical-post.exp.html
new file mode 100644
index 000000000..f9d75a114
--- /dev/null
+++ b/engine/tests/test_files/output/autop/typical-post.exp.html
@@ -0,0 +1,84 @@
+Lorem ipsum dolor sit amet, consectetur adipiscing elit.
+Vivamus enim ante, mattis eget imperdiet nec, pharetra vel velit. Sed at euismod nibh. Praesent lacus tellus, posuere et convallis a, mollis et tellus. Suspendisse potenti. Phasellus tincidunt dignissim est eget mattis. Vestibulum lacinia condimentum tellus, non vestibulum erat dapibus quis. Aliquam arcu nibh, viverra adipiscing eleifend quis, pretium vitae ipsum.
+
+Curabitur turpis ante, congue ac dapibus quis, vehicula ac orci. Nunc luctus neque non massa porta sed pharetra ante accumsan. Nam suscipit risus quis libero convallis viverra. Ut at arcu enim, vel pharetra dolor.
+Donec at massa ante, sagittis fermentum urna.
+Mauris volutpat est id massa volutpat lacinia. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. In in nisl mauris. In aliquet pretium nisl, vel convallis neque cursus vitae. Curabitur id mauris in urna gravida ornare.
+
+[caption id="attachment_719" align="alignleft" width="150" caption="Ibanez AGB140 Bass"][/caption]
+
+Aenean aliquet cursus purus sed gravida. Cras auctor euismod justo, ac dictum purus facilisis dignissim. Quisque facilisis porta sem, ac suscipit quam molestie nec. Pellentesque quis hendrerit enim. Vivamus tempor erat diam. Sed eu felis nunc. Cras posuere lorem commodo turpis mollis sagittis. Mauris lobortis nunc felis.
+
+Maecenas elit lorem, varius sed condimentum ac, cursus et magna. Nam ut massa id augue consectetur porttitor eleifend in nunc. Curabitur cursus varius dictum. Vestibulum vel justo et neque tempus placerat a vel sapien.
+
+Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus enim ante, mattis eget imperdiet nec, pharetra vel velit. Sed at euismod nibh. Praesent lacus tellus, posuere et convallis a, mollis et tellus.
+<?php
+class DataTest extends PHPUnit_Framework_TestCase
+{
+ /**
+ * @dataProvider provider
+ */
+ public function testAdd($a, $b, $c)
+ {
+ $this->assertEquals($c, $a + $b);
+ }
+
+ public function provider()
+ {
+ return array(
+ array(0, 0, 0),
+ array(0, 1, 1),
+ array(1, 0, 1),
+ array(1, 1, 3)
+ );
+ }
+}
- Suspendisse potenti. Phasellus tincidunt dignissim est eget mattis.
+ - Vestibulum lacinia condimentum tellus, non vestibulum erat dapibus quis.
+ - Aliquam arcu nibh, viverra adipiscing eleifend quis, pretium vitae ipsum.
+ - Curabitur turpis ante, congue ac dapibus quis, vehicula ac orci.
+
+Nunc luctus neque non massa porta sed pharetra ante accumsan. Nam suscipit risus quis libero convallis viverra. Ut at arcu enim, vel pharetra dolor. Donec at massa ante, sagittis fermentum urna.
+
+
+Lorem ipsum dolor sit amet, consectetur adipiscing elit.
+Vivamus enim ante, mattis eget imperdiet nec, pharetra vel velit. Sed at euismod nibh. Praesent lacus tellus, posuere et convallis a, mollis et tellus. Suspendisse potenti. Phasellus tincidunt dignissim est eget mattis. Vestibulum lacinia condimentum tellus, non vestibulum erat dapibus quis. Aliquam arcu nibh, viverra adipiscing eleifend quis, pretium vitae ipsum.
+
+Curabitur turpis ante, congue ac dapibus quis, vehicula ac orci. Nunc luctus neque non massa porta sed pharetra ante accumsan. Nam suscipit risus quis libero convallis viverra. Ut at arcu enim, vel pharetra dolor.
+Donec at massa ante, sagittis fermentum urna.
+Mauris volutpat est id massa volutpat lacinia. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. In in nisl mauris. In aliquet pretium nisl, vel convallis neque cursus vitae. Curabitur id mauris in urna gravida ornare.
+
+[caption id="attachment_719" align="alignleft" width="150" caption="Ibanez AGB140 Bass"][/caption]
+
+Aenean aliquet cursus purus sed gravida. Cras auctor euismod justo, ac dictum purus facilisis dignissim. Quisque facilisis porta sem, ac suscipit quam molestie nec. Pellentesque quis hendrerit enim. Vivamus tempor erat diam. Sed eu felis nunc. Cras posuere lorem commodo turpis mollis sagittis. Mauris lobortis nunc felis.
+
+Maecenas elit lorem, varius sed condimentum ac, cursus et magna. Nam ut massa id augue consectetur porttitor eleifend in nunc. Curabitur cursus varius dictum. Vestibulum vel justo et neque tempus placerat a vel sapien.
+
+Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus enim ante, mattis eget imperdiet nec, pharetra vel velit. Sed at euismod nibh. Praesent lacus tellus, posuere et convallis a, mollis et tellus.
+<?php
+class DataTest extends PHPUnit_Framework_TestCase
+{
+ /**
+ * @dataProvider provider
+ */
+ public function testAdd($a, $b, $c)
+ {
+ $this->assertEquals($c, $a + $b);
+ }
+
+ public function provider()
+ {
+ return array(
+ array(0, 0, 0),
+ array(0, 1, 1),
+ array(1, 0, 1),
+ array(1, 1, 3)
+ );
+ }
+}
- Suspendisse potenti. Phasellus tincidunt dignissim est eget mattis.
+ - Vestibulum lacinia condimentum tellus, non vestibulum erat dapibus quis.
+ - Aliquam arcu nibh, viverra adipiscing eleifend quis, pretium vitae ipsum.
+ - Curabitur turpis ante, congue ac dapibus quis, vehicula ac orci.
+
+Nunc luctus neque non massa porta sed pharetra ante accumsan. Nam suscipit risus quis libero convallis viverra. Ut at arcu enim, vel pharetra dolor. Donec at massa ante, sagittis fermentum urna.
+
+
diff --git a/engine/tests/test_files/output/autop/typical-post.in.html b/engine/tests/test_files/output/autop/typical-post.in.html
new file mode 100644
index 000000000..6e4984cc4
--- /dev/null
+++ b/engine/tests/test_files/output/autop/typical-post.in.html
@@ -0,0 +1,89 @@
+Lorem ipsum dolor sit amet, consectetur adipiscing elit.
+Vivamus enim ante, mattis eget imperdiet nec, pharetra vel velit. Sed at euismod nibh. Praesent lacus tellus, posuere et convallis a, mollis et tellus. Suspendisse potenti. Phasellus tincidunt dignissim est eget mattis. Vestibulum lacinia condimentum tellus, non vestibulum erat dapibus quis. Aliquam arcu nibh, viverra adipiscing eleifend quis, pretium vitae ipsum.
+
+Curabitur turpis ante, congue ac dapibus quis, vehicula ac orci. Nunc luctus neque non massa porta sed pharetra ante accumsan. Nam suscipit risus quis libero convallis viverra. Ut at arcu enim, vel pharetra dolor.
+Donec at massa ante, sagittis fermentum urna.
+Mauris volutpat est id massa volutpat lacinia. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. In in nisl mauris. In aliquet pretium nisl, vel convallis neque cursus vitae. Curabitur id mauris in urna gravida ornare.
+
+[caption id="attachment_719" align="alignleft" width="150" caption="Ibanez AGB140 Bass"][/caption]
+
+Aenean aliquet cursus purus sed gravida. Cras auctor euismod justo, ac dictum purus facilisis dignissim. Quisque facilisis porta sem, ac suscipit quam molestie nec. Pellentesque quis hendrerit enim. Vivamus tempor erat diam. Sed eu felis nunc. Cras posuere lorem commodo turpis mollis sagittis. Mauris lobortis nunc felis.
+
+Maecenas elit lorem, varius sed condimentum ac, cursus et magna. Nam ut massa id augue consectetur porttitor eleifend in nunc. Curabitur cursus varius dictum. Vestibulum vel justo et neque tempus placerat a vel sapien.
+Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus enim ante, mattis eget imperdiet nec, pharetra vel velit. Sed at euismod nibh. Praesent lacus tellus, posuere et convallis a, mollis et tellus.
+
+<?php
+class DataTest extends PHPUnit_Framework_TestCase
+{
+ /**
+ * @dataProvider provider
+ */
+ public function testAdd($a, $b, $c)
+ {
+ $this->assertEquals($c, $a + $b);
+ }
+
+ public function provider()
+ {
+ return array(
+ array(0, 0, 0),
+ array(0, 1, 1),
+ array(1, 0, 1),
+ array(1, 1, 3)
+ );
+ }
+}
+
+ - Suspendisse potenti. Phasellus tincidunt dignissim est eget mattis.
+ - Vestibulum lacinia condimentum tellus, non vestibulum erat dapibus quis.
+ - Aliquam arcu nibh, viverra adipiscing eleifend quis, pretium vitae ipsum.
+ - Curabitur turpis ante, congue ac dapibus quis, vehicula ac orci.
+
+Nunc luctus neque non massa porta sed pharetra ante accumsan. Nam suscipit risus quis libero convallis viverra. Ut at arcu enim, vel pharetra dolor. Donec at massa ante, sagittis fermentum urna.
+
+
+
+Lorem ipsum dolor sit amet, consectetur adipiscing elit.
+Vivamus enim ante, mattis eget imperdiet nec, pharetra vel velit. Sed at euismod nibh. Praesent lacus tellus, posuere et convallis a, mollis et tellus. Suspendisse potenti. Phasellus tincidunt dignissim est eget mattis. Vestibulum lacinia condimentum tellus, non vestibulum erat dapibus quis. Aliquam arcu nibh, viverra adipiscing eleifend quis, pretium vitae ipsum.
+
+Curabitur turpis ante, congue ac dapibus quis, vehicula ac orci. Nunc luctus neque non massa porta sed pharetra ante accumsan. Nam suscipit risus quis libero convallis viverra. Ut at arcu enim, vel pharetra dolor.
+Donec at massa ante, sagittis fermentum urna.
+Mauris volutpat est id massa volutpat lacinia. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. In in nisl mauris. In aliquet pretium nisl, vel convallis neque cursus vitae. Curabitur id mauris in urna gravida ornare.
+
+[caption id="attachment_719" align="alignleft" width="150" caption="Ibanez AGB140 Bass"][/caption]
+
+Aenean aliquet cursus purus sed gravida. Cras auctor euismod justo, ac dictum purus facilisis dignissim. Quisque facilisis porta sem, ac suscipit quam molestie nec. Pellentesque quis hendrerit enim. Vivamus tempor erat diam. Sed eu felis nunc. Cras posuere lorem commodo turpis mollis sagittis. Mauris lobortis nunc felis.
+
+Maecenas elit lorem, varius sed condimentum ac, cursus et magna. Nam ut massa id augue consectetur porttitor eleifend in nunc. Curabitur cursus varius dictum. Vestibulum vel justo et neque tempus placerat a vel sapien.
+Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus enim ante, mattis eget imperdiet nec, pharetra vel velit. Sed at euismod nibh. Praesent lacus tellus, posuere et convallis a, mollis et tellus.
+
+<?php
+class DataTest extends PHPUnit_Framework_TestCase
+{
+ /**
+ * @dataProvider provider
+ */
+ public function testAdd($a, $b, $c)
+ {
+ $this->assertEquals($c, $a + $b);
+ }
+
+ public function provider()
+ {
+ return array(
+ array(0, 0, 0),
+ array(0, 1, 1),
+ array(1, 0, 1),
+ array(1, 1, 3)
+ );
+ }
+}
+
+ - Suspendisse potenti. Phasellus tincidunt dignissim est eget mattis.
+ - Vestibulum lacinia condimentum tellus, non vestibulum erat dapibus quis.
+ - Aliquam arcu nibh, viverra adipiscing eleifend quis, pretium vitae ipsum.
+ - Curabitur turpis ante, congue ac dapibus quis, vehicula ac orci.
+
+Nunc luctus neque non massa porta sed pharetra ante accumsan. Nam suscipit risus quis libero convallis viverra. Ut at arcu enim, vel pharetra dolor. Donec at massa ante, sagittis fermentum urna.
+
+
\ No newline at end of file
diff --git a/engine/tests/test_files/output/autop/wp-welcome.exp.html b/engine/tests/test_files/output/autop/wp-welcome.exp.html
new file mode 100644
index 000000000..2f612e3dd
--- /dev/null
+++ b/engine/tests/test_files/output/autop/wp-welcome.exp.html
@@ -0,0 +1,22 @@
+
+Welcome to WordPress! This post contains important information. After you read it, you can make it private to hide it from visitors but still have the information handy for future reference.
+
+First things first:
+
+As a subscriber, you will receive an email every time an update is available (and only then). This will make it easier to keep your site up to date, and secure from evildoers.
When a new version is released, log in to the Dashboard and follow the instructions.
Upgrading is a couple of clicks!
+
+Then you can start enjoying the WordPress experience:
+
+To keep this post for reference, click to edit it, go to the Publish box and change its Visibility from Public to Private.
+
+Thank you for selecting WordPress. We wish you happy publishing!
+
+PS. Not yet subscribed for update notifications? Do it now!
diff --git a/engine/tests/test_files/output/autop/wp-welcome.in.html b/engine/tests/test_files/output/autop/wp-welcome.in.html
new file mode 100644
index 000000000..338ede73f
--- /dev/null
+++ b/engine/tests/test_files/output/autop/wp-welcome.in.html
@@ -0,0 +1,25 @@
+Welcome to WordPress! This post contains important information. After you read it, you can make it private to hide it from visitors but still have the information handy for future reference.
+
+First things first:
+
+As a subscriber, you will receive an email every time an update is available (and only then). This will make it easier to keep your site up to date, and secure from evildoers.
+When a new version is released, log in to the Dashboard and follow the instructions.
+Upgrading is a couple of clicks!
+
+Then you can start enjoying the WordPress experience:
+
+To keep this post for reference, click to edit it, go to the Publish box and change its Visibility from Public to Private.
+
+Thank you for selecting WordPress. We wish you happy publishing!
+
+PS. Not yet subscribed for update notifications? Do it now!
diff --git a/engine/tests/test_files/output/autop/wpautop-fails.exp.html b/engine/tests/test_files/output/autop/wpautop-fails.exp.html
new file mode 100644
index 000000000..d018db4ff
--- /dev/null
+++ b/engine/tests/test_files/output/autop/wpautop-fails.exp.html
@@ -0,0 +1,31 @@
+
+paragraph
+
+paragraph
+
+paragraph
+- line
+- paragraph
+
+paragraph
+
+paragraph
line
line
+Honor
+this whitespace
+
+paragraph
+
+paragraph
+- term
- paragraph
+
+
+
+paragraph
+Hello
World
+Paragraph
Line
\ No newline at end of file
diff --git a/engine/tests/test_files/output/autop/wpautop-fails.in.html b/engine/tests/test_files/output/autop/wpautop-fails.in.html
new file mode 100644
index 000000000..9aa24be59
--- /dev/null
+++ b/engine/tests/test_files/output/autop/wpautop-fails.in.html
@@ -0,0 +1,41 @@
+
+paragraph
+
+paragraph
+
+paragraph
+
+- line
+- paragraph
+
+paragraph
+
+paragraph
+line
+ line
+Honor
+this whitespace
+
+paragraph
+
+paragraph
+ - term
- paragraph
+
+
+
+paragraph
+
+
+Hello
+
+World
+
+Paragraph
+
+Line
\ No newline at end of file
diff --git a/engine/tests/test_files/output/autop/wysiwyg-test.exp.html b/engine/tests/test_files/output/autop/wysiwyg-test.exp.html
new file mode 100644
index 000000000..1f23d6154
--- /dev/null
+++ b/engine/tests/test_files/output/autop/wysiwyg-test.exp.html
@@ -0,0 +1,51 @@
+
+&nbps;
≴
+h1
+Paragraph link Bold italic bolditalic
+h2
+Paragraph size1 size2 size4
+h3
+Paragraph underline strikethrough color background
+
+Blockquoted paragraph
+
+Paragraph following blockquote
+
+Paragraph between lists
+- Ordered
+ - List
+
+Paragraph between lists
+- OL list
+ - nested
+
- inside a
+ - UL list
+
+
+Paragraph between lists
+|
Table with |
+ |
+
|
+ border=0 |
+
+Paragraph
+- UL list
+ - nested
+
+
+Paragraph between tables
+Table with border=1 |
+ |
+
|
+ cellpadding = 5 |
+
+Paragraph between tables
+Table with |
+ |
+
|
+ border=2 |
+
\ No newline at end of file
diff --git a/engine/tests/test_files/output/autop/wysiwyg-test.in.html b/engine/tests/test_files/output/autop/wysiwyg-test.in.html
new file mode 100644
index 000000000..733b0e2ec
--- /dev/null
+++ b/engine/tests/test_files/output/autop/wysiwyg-test.in.html
@@ -0,0 +1,79 @@
+&nbps;
+≴
+h1
+Paragraph link Bold italic bolditalic
+h2
+Paragraph size1 size2 size4
+h3
+Paragraph underline strikethrough color background
+Blockquoted paragraph
+Paragraph following blockquote
+
+Paragraph between lists
+
+ - Ordered
+ - List
+
+Paragraph between lists
+
+ - OL list
+ - nested
+
+ - inside a
+ - UL list
+
+
+Paragraph between lists
+
+
+
+
+
+ Table with |
+ |
+
+
+ |
+ border=0 |
+
+
+
+Paragraph
+
+ - UL list
+ - nested
+
+
+
+Paragraph between tables
+
+
+
+ Table with border=1 |
+ |
+
+
+ |
+ cellpadding = 5 |
+
+
+
+Paragraph between tables
+
+
+
+ Table with |
+ |
+
+
+ |
+ border=2 |
+
+
+
\ No newline at end of file
diff --git a/mod/groups/views/rss/object/groupforumtopic.php b/mod/groups/views/rss/object/groupforumtopic.php
index d730ef796..b2d05d488 100644
--- a/mod/groups/views/rss/object/groupforumtopic.php
+++ b/mod/groups/views/rss/object/groupforumtopic.php
@@ -14,7 +14,7 @@ if (empty($title)) {
$permalink = htmlspecialchars($vars['entity']->getURL(), ENT_NOQUOTES, 'UTF-8');
$pubdate = date('r', $vars['entity']->getTimeCreated());
-$description = autop($vars['entity']->description);
+$description = elgg_autop($vars['entity']->description);
$creator = elgg_view('page/components/creator', $vars);
$georss = elgg_view('page/components/georss', $vars);
diff --git a/mod/search/views/default/search/no_results.php b/mod/search/views/default/search/no_results.php
index 74b5b2cfa..0e9a5e295 100644
--- a/mod/search/views/default/search/no_results.php
+++ b/mod/search/views/default/search/no_results.php
@@ -3,4 +3,4 @@
* No results from search
*/
-echo autop(elgg_echo('search:no_results'));
+echo elgg_autop(elgg_echo('search:no_results'));
diff --git a/mod/thewire/views/rss/object/thewire.php b/mod/thewire/views/rss/object/thewire.php
index 494c2c8dc..8fddb8aa8 100644
--- a/mod/thewire/views/rss/object/thewire.php
+++ b/mod/thewire/views/rss/object/thewire.php
@@ -15,7 +15,7 @@ $title = elgg_echo('thewire:by', array($owner->name));
$permalink = htmlspecialchars($vars['entity']->getURL(), ENT_NOQUOTES, 'UTF-8');
$pubdate = date('r', $vars['entity']->getTimeCreated());
-$description = autop($vars['entity']->description);
+$description = elgg_autop($vars['entity']->description);
$creator = elgg_view('page/components/creator', $vars);
$georss = elgg_view('page/components/georss', $vars);
diff --git a/mod/uservalidationbyemail/views/default/forms/uservalidationbyemail/bulk_action.php b/mod/uservalidationbyemail/views/default/forms/uservalidationbyemail/bulk_action.php
index cbd13a709..9199922d6 100644
--- a/mod/uservalidationbyemail/views/default/forms/uservalidationbyemail/bulk_action.php
+++ b/mod/uservalidationbyemail/views/default/forms/uservalidationbyemail/bulk_action.php
@@ -27,7 +27,7 @@ if (!$count) {
access_show_hidden_entities($hidden_entities);
elgg_set_ignore_access($ia);
- echo autop(elgg_echo('uservalidationbyemail:admin:no_unvalidated_users'));
+ echo elgg_autop(elgg_echo('uservalidationbyemail:admin:no_unvalidated_users'));
return TRUE;
}
diff --git a/views/default/forms/profile/fields/add.php b/views/default/forms/profile/fields/add.php
index 1ea9c57a9..2087ec299 100644
--- a/views/default/forms/profile/fields/add.php
+++ b/views/default/forms/profile/fields/add.php
@@ -25,5 +25,5 @@ $formbody = <<< END
$submit_control
END;
-echo autop(elgg_echo('profile:explainchangefields'));
+echo elgg_autop(elgg_echo('profile:explainchangefields'));
echo $formbody;
diff --git a/views/default/forms/user/passwordreset.php b/views/default/forms/user/passwordreset.php
index 3c89776f6..5946fa7c0 100644
--- a/views/default/forms/user/passwordreset.php
+++ b/views/default/forms/user/passwordreset.php
@@ -3,7 +3,7 @@
* Reset user password form
*/
-echo autop(elgg_echo('user:resetpassword:reset_password_confirm'));
+echo elgg_autop(elgg_echo('user:resetpassword:reset_password_confirm'));
echo elgg_view('input/hidden', array(
'name' => 'u',
diff --git a/views/default/output/longtext.php b/views/default/output/longtext.php
index 200f27de5..589100c4f 100644
--- a/views/default/output/longtext.php
+++ b/views/default/output/longtext.php
@@ -31,7 +31,7 @@ if ($parse_urls) {
$text = filter_tags($text);
-$text = autop($text);
+$text = elgg_autop($text);
$attributes = elgg_format_attributes($vars);
diff --git a/views/default/page/elements/messages.php b/views/default/page/elements/messages.php
index a35a48586..edd40d71e 100644
--- a/views/default/page/elements/messages.php
+++ b/views/default/page/elements/messages.php
@@ -18,7 +18,7 @@ if (isset($vars['object']) && is_array($vars['object']) && sizeof($vars['object'
foreach ($vars['object'] as $type => $list ) {
foreach ($list as $message) {
echo "";
- echo autop($message);
+ echo elgg_autop($message);
echo '';
}
}
diff --git a/views/installation/install/pages/admin.php b/views/installation/install/pages/admin.php
index 9456e682f..e810aa701 100644
--- a/views/installation/install/pages/admin.php
+++ b/views/installation/install/pages/admin.php
@@ -3,7 +3,7 @@
* Install create admin account page
*/
-echo autop(elgg_echo('install:admin:instructions'));
+echo elgg_autop(elgg_echo('install:admin:instructions'));
$vars['type'] = 'admin';
diff --git a/views/installation/install/pages/complete.php b/views/installation/install/pages/complete.php
index 2f5a04854..80f8e7434 100644
--- a/views/installation/install/pages/complete.php
+++ b/views/installation/install/pages/complete.php
@@ -3,7 +3,7 @@
* Install completion page
*/
-echo autop(elgg_echo('install:complete:instructions'));
+echo elgg_autop(elgg_echo('install:complete:instructions'));
?>
diff --git a/views/installation/install/pages/database.php b/views/installation/install/pages/database.php
index d3011c9e3..d24b4f57b 100644
--- a/views/installation/install/pages/database.php
+++ b/views/installation/install/pages/database.php
@@ -6,12 +6,12 @@
*/
if (isset($vars['failure']) && $vars['failure']) {
- echo autop(elgg_echo('install:database:error'));
+ echo elgg_autop(elgg_echo('install:database:error'));
$vars['refresh'] = TRUE;
$vars['advance'] = FALSE;
echo elgg_view('install/nav', $vars);
} else {
- echo autop(elgg_echo('install:database:instructions'));
+ echo elgg_autop(elgg_echo('install:database:instructions'));
$vars['type'] = 'database';
diff --git a/views/installation/install/pages/requirements.php b/views/installation/install/pages/requirements.php
index e3689e761..06f309c90 100644
--- a/views/installation/install/pages/requirements.php
+++ b/views/installation/install/pages/requirements.php
@@ -14,7 +14,7 @@ if ($vars['num_failures'] != 0) {
$instruct_text = elgg_echo('install:requirements:instructions:success');
}
-echo autop($instruct_text);
+echo elgg_autop($instruct_text);
$report = $vars['report'];
foreach ($report as $category => $checks) {
@@ -23,7 +23,7 @@ foreach ($report as $category => $checks) {
echo "";
foreach ($checks as $check) {
echo "- ";
- echo autop($check['message']);
+ echo elgg_autop($check['message']);
echo "
";
}
echo "
";
diff --git a/views/installation/install/pages/settings.php b/views/installation/install/pages/settings.php
index 30a1deb5a..04f23c0ea 100644
--- a/views/installation/install/pages/settings.php
+++ b/views/installation/install/pages/settings.php
@@ -1,6 +1,6 @@
$list ) {
foreach ($list as $message) {
echo "";
- echo autop($message);
+ echo elgg_autop($message);
echo '';
}
}
diff --git a/views/opendd/messages/exceptions/exception.php b/views/opendd/messages/exceptions/exception.php
index 54868f1f4..dc0f48a8d 100644
--- a/views/opendd/messages/exceptions/exception.php
+++ b/views/opendd/messages/exceptions/exception.php
@@ -11,7 +11,7 @@
?>