WordPress.org

Make WordPress Core

Ticket #11257: wpautop-test-case.php

File wpautop-test-case.php, 7.8 KB (added by miqrogroove, 4 years ago)

Test Case demonstrates failure of the last assignment to $pee in wpautop()

Line 
1<?php
2/**
3 * Ticket #11257 wpauatop() Test case
4 *
5 * Passes if the value, type, and length of $pee are echoed.
6 * Fails if "NULL" is echoed.
7 *
8 * @author Robert Chapin (miqrogroove)
9 **/
10$pee = '<h4>S/S 07</h4>
11<p>Carmen Kass</p>
12<table style="width: 100%;" border="0">
13<colgroup span="2"></colgroup>
14<tbody>
15<tr>
16<td>
17<p>[caption id="attachment_2219" align="aligncenter" width="300" caption="Carmen Kass in Bruuns Bazaar Spring Summer 2007 Ad Campaign"]<a rel="attachment wp-att-2219" href="http://blogyul.miqrogroove.com/2009/06/bruuns-bazaar-bizarre-and-the-best/bruunsbazaarcampaignspringsummer2007carmenkass2/"><img class="size-medium wp-image-2219" title="bruunsbazaarcampaignspringsummer2007carmenkass2" src="http://blogyul.miqrogroove.com/wp-content/uploads/2009/04/bruunsbazaarcampaignspringsummer2007carmenkass2-300x185.jpg" alt="Carmen Kass in Bruuns Bazaar Spring Summer 2007 Ad Campaign" width="300" height="185" /></a>[/caption]</td>
18<td>
19<p>[caption id="attachment_2220" align="aligncenter" width="300" caption="Carmen Kass in Bruuns Bazaar Spring Summer 2007 Ad Campaign"]<a rel="attachment wp-att-2220" href="http://blogyul.miqrogroove.com/2009/06/bruuns-bazaar-bizarre-and-the-best/bruunsbazaarcampaignspringsummer2007carmenkass3/"><img class="size-medium wp-image-2220" title="bruunsbazaarcampaignspringsummer2007carmenkass3" src="http://blogyul.miqrogroove.com/wp-content/uploads/2009/04/bruunsbazaarcampaignspringsummer2007carmenkass3-300x186.jpg" alt="Carmen Kass in Bruuns Bazaar Spring Summer 2007 Ad Campaign" width="300" height="186" /></a>[/caption]</td>
20</tr>
21<tr>
22<td>
23<p>[caption id="attachment_2221" align="aligncenter" width="300" caption="Carmen Kass in Bruuns Bazaar Spring Summer 2007 Ad Campaign"]<a rel="attachment wp-att-2221" href="http://blogyul.miqrogroove.com/2009/06/bruuns-bazaar-bizarre-and-the-best/bruunsbazaarcampaignspringsummer2007carmenkass4/"><img class="size-medium wp-image-2221" title="bruunsbazaarcampaignspringsummer2007carmenkass4" src="http://blogyul.miqrogroove.com/wp-content/uploads/2009/04/bruunsbazaarcampaignspringsummer2007carmenkass4-300x186.jpg" alt="Carmen Kass in Bruuns Bazaar Spring Summer 2007 Ad Campaign" width="300" height="186" /></a>[/caption]</td>
24<td>
25<p>[caption id="attachment_2222" align="aligncenter" width="300" caption="Carmen Kass in Bruuns Bazaar Spring Summer 2007 Ad Campaign"]<a rel="attachment wp-att-2222" href="http://blogyul.miqrogroove.com/2009/06/bruuns-bazaar-bizarre-and-the-best/bruunsbazaarcampaignspringsummer2007carmenkass5/"><img class="size-medium wp-image-2222" title="bruunsbazaarcampaignspringsummer2007carmenkass5" src="http://blogyul.miqrogroove.com/wp-content/uploads/2009/04/bruunsbazaarcampaignspringsummer2007carmenkass5-300x206.jpg" alt="Carmen Kass in Bruuns Bazaar Spring Summer 2007 Ad Campaign" width="300" height="206" /></a>[/caption]</td>
26</tr>
27</tbody>
28</table>
29<h4>F/W 07/08</h4>
30<p>Carmen Kass</p>
31<table style="width: 100%;" border="0">
32<colgroup span="2"></colgroup>
33<tbody>
34<tr>
35<td>
36<p>[caption id="attachment_2224" align="aligncenter" width="200" caption="Carmen Kass in Bruuns Bazaars Fall Winter 2007.08 Ad Campaign"]<a rel="attachment wp-att-2224" href="http://blogyul.miqrogroove.com/2009/06/bruuns-bazaar-bizarre-and-the-best/bruunsbazaarcampaignfallwinter200708carmenkass1/"><img class="size-medium wp-image-2224" title="bruunsbazaarcampaignfallwinter200708carmenkass1" src="http://blogyul.miqrogroove.com/wp-content/uploads/2009/04/bruunsbazaarcampaignfallwinter200708carmenkass1-200x300.jpg" alt="Carmen Kass in Bruuns Bazaars Fall Winter 2007.08 Ad Campaign" width="200" height="300" /></a>[/caption]</td>
37<td>
38<p>[caption id="attachment_2225" align="aligncenter" width="200" caption="Carmen Kass in Bruuns Bazaars Fall Winter 2007.08 Ad Campaign"]<a rel="attachment wp-att-2225" href="http://blogyul.miqrogroove.com/2009/06/bruuns-bazaar-bizarre-and-the-best/bruunsbazaarcampaignfallwinter200708carmenkass2/"><img class="size-medium wp-image-2225" title="bruunsbazaarcampaignfallwinter200708carmenkass2" src="http://blogyul.miqrogroove.com/wp-content/uploads/2009/04/bruunsbazaarcampaignfallwinter200708carmenkass2-200x300.jpg" alt="Carmen Kass in Bruuns Bazaars Fall Winter 2007.08 Ad Campaign" width="200" height="300" /></a>[/caption]</td>
39</tr>
40<tr>
41<td>
42<p>[caption id="attachment_2226" align="aligncenter" width="200" caption="Carmen Kass in Bruuns Bazaars Fall Winter 2007.08 Ad Campaign"]<a rel="attachment wp-att-2226" href="http://blogyul.miqrogroove.com/2009/06/bruuns-bazaar-bizarre-and-the-best/bruunsbazaarcampaignfallwinter200708carmenkass3/"><img class="size-medium wp-image-2226" title="bruunsbazaarcampaignfallwinter200708carmenkass3" src="http://blogyul.miqrogroove.com/wp-content/uploads/2009/04/bruunsbazaarcampaignfallwinter200708carmenkass3-200x300.jpg" alt="Carmen Kass in Bruuns Bazaars Fall Winter 2007.08 Ad Campaign" width="200" height="300" /></a>[/caption]</td>
43<td>
44<p>[caption id="attachment_2227" align="aligncenter" width="200" caption="Carmen Kass in Bruuns Bazaars Fall Winter 2007.08 Ad Campaign"]<a rel="attachment wp-att-2227" href="http://blogyul.miqrogroove.com/2009/06/bruuns-bazaar-bizarre-and-the-best/bruunsbazaarcampaignfallwinter200708carmenkass4/"><img class="size-medium wp-image-2227" title="bruunsbazaarcampaignfallwinter200708carmenkass4" src="http://blogyul.miqrogroove.com/wp-content/uploads/2009/04/bruunsbazaarcampaignfallwinter200708carmenkass4-200x300.jpg" alt="Carmen Kass in Bruuns Bazaars Fall Winter 2007.08 Ad Campaign" width="200" height="300" /></a>[/caption]</td>
45</tr>
46<tr>
47<td>
48<p>[caption id="attachment_2228" align="aligncenter" width="200" caption="Carmen Kass in Bruuns Bazaars Fall Winter 2007.08 Ad Campaign"]<a rel="attachment wp-att-2228" href="http://blogyul.miqrogroove.com/2009/06/bruuns-bazaar-bizarre-and-the-best/bruunsbazaarcampaignfallwinter200708carmenkass5/"><img class="size-medium wp-image-2228" title="bruunsbazaarcampaignfallwinter200708carmenkass5" src="http://blogyul.miqrogroove.com/wp-content/uploads/2009/04/bruunsbazaarcampaignfallwinter200708carmenkass5-200x300.jpg" alt="Carmen Kass in Bruuns Bazaars Fall Winter 2007.08 Ad Campaign" width="200" height="300" /></a>[/caption]</td>
49<td> </td>
50</tr>
51</tbody>
52</table>
53<h4>S/S 08</h4>
54<p>Carmen Kass</p>
55<table style="width: 100%;" border="0">
56<colgroup span="2"></colgroup>
57<tbody>
58<tr>
59<td>
60<p>[caption id="attachment_2229" align="aligncenter" width="300" caption="Carmen Kass for Bruuns Bazaar Spring Summer 2008 Ad Campaign"]<a rel="attachment wp-att-2229" href="http://blogyul.miqrogroove.com/2009/06/bruuns-bazaar-bizarre-and-the-best/bruunsbazaarspringsummer2008carmenkass1/"><img class="size-medium wp-image-2229" title="bruunsbazaarspringsummer2008carmenkass1" src="http://blogyul.miqrogroove.com/wp-content/uploads/2009/04/bruunsbazaarspringsummer2008carmenkass1-300x165.jpg" alt="Carmen Kass for Bruuns Bazaar Spring Summer 2008 Ad Campaign" width="300" height="165" /></a>[/caption]</td>
61<td>
62<p>[caption id="attachment_2230" align="aligncenter" width="300" caption="Carmen Kass for Bruuns Bazaar Spring Summer 2008 Ad Campaign"]<a rel="attachment wp-att-2230" href="http://blogyul.miqrogroove.com/2009/06/bruuns-bazaar-bizarre-and-the-best/bruunsbazaarspringsummer2008carmenkass2/"><img class="size-medium wp-image-2230" title="bruunsbazaarspringsummer2008carmenkass2" src="http://blogyul.miqrogroove.com/wp-content/uploads/2009/04/bruunsbazaarspringsummer2008carmenkass2-300x181.jpg" alt="Carmen Kass for Bruuns Bazaar Spring Summer 2008 Ad Campaign" width="300" height="181" /></a>[/caption]</td>
63</tr>
64</tbody>
65</table>';
66
67$tagregexp = "wp_caption|caption|gallery";
68$backref = 2 + 1;
69$regex = '(.?)\[('.$tagregexp.')\b(.*?)(?:(\/))?\](?:(.+?)\[\/\2\])?(.?)';
70//$regex = '(.?)\\[('.$tagregexp.')\\b(.*?)\\/?\\](?:(.+?)\\[\\/\\'.$backref.'\\])?(.?)';
71
72$pee = preg_replace('/<p>\s*?(' . $regex . ')\s*<\/p>/s', '$1', $pee);
73
74var_dump($pee);
75?>