| @@ 58-70 (lines=13) @@ | ||
| 55 | $this->assertEquals(false, wp_validate_redirect($url, false)); |
|
| 56 | } |
|
| 57 | ||
| 58 | function valid_url_provider() |
|
| 59 | { |
|
| 60 | return array( |
|
| 61 | array( 'http://example.com', 'http://example.com' ), |
|
| 62 | array( 'http://example.com/', 'http://example.com/' ), |
|
| 63 | array( 'https://example.com/', 'https://example.com/' ), |
|
| 64 | array( '//example.com', 'http://example.com' ), |
|
| 65 | array( '//example.com/', 'http://example.com/' ), |
|
| 66 | array( 'http://example.com/?foo=http://example.com/', 'http://example.com/?foo=http://example.com/' ), |
|
| 67 | array( 'http://[email protected]/', 'http://[email protected]/' ), |
|
| 68 | array( 'http://user:@example.com/', 'http://user:@example.com/' ), |
|
| 69 | array( 'http://user:[email protected]/', 'http://user:[email protected]/' ), |
|
| 70 | ); |
|
| 71 | } |
|
| 72 | ||
| 73 | function invalid_url_provider() |
|
| @@ 1187-1226 (lines=40) @@ | ||
| 1184 | return $this->assertEquals($output, wptexturize($input)); |
|
| 1185 | } |
|
| 1186 | ||
| 1187 | function data_quoted_numbers() |
|
| 1188 | { |
|
| 1189 | return array( |
|
| 1190 | array( |
|
| 1191 | 'word "42.00" word', |
|
| 1192 | 'word “42.00” word', |
|
| 1193 | ), |
|
| 1194 | array( |
|
| 1195 | 'word "42.00"word', |
|
| 1196 | 'word “42.00”word', |
|
| 1197 | ), |
|
| 1198 | array( |
|
| 1199 | "word '42.00' word", |
|
| 1200 | "word ‘42.00’ word", |
|
| 1201 | ), |
|
| 1202 | array( |
|
| 1203 | "word '42.00'word", |
|
| 1204 | "word ‘42.00’word", |
|
| 1205 | ), |
|
| 1206 | array( |
|
| 1207 | 'word "42" word', |
|
| 1208 | 'word “42” word', |
|
| 1209 | ), |
|
| 1210 | array( |
|
| 1211 | 'word "42,00" word', |
|
| 1212 | 'word “42,00” word', |
|
| 1213 | ), |
|
| 1214 | array( |
|
| 1215 | 'word "4,242.00" word', |
|
| 1216 | 'word “4,242.00” word', |
|
| 1217 | ), |
|
| 1218 | array( |
|
| 1219 | "word '99's word", |
|
| 1220 | "word ’99’s word", |
|
| 1221 | ), |
|
| 1222 | array( |
|
| 1223 | "word '99'samsonite", |
|
| 1224 | "word ’99’samsonite", |
|
| 1225 | ), |
|
| 1226 | ); |
|
| 1227 | } |
|
| 1228 | ||
| 1229 | /** |
|
| @@ 1851-1890 (lines=40) @@ | ||
| 1848 | return $this->assertEquals($output, wptexturize($input)); |
|
| 1849 | } |
|
| 1850 | ||
| 1851 | function data_element_stack() |
|
| 1852 | { |
|
| 1853 | return array( |
|
| 1854 | array( |
|
| 1855 | '<span>hello</code>---</span>', |
|
| 1856 | '<span>hello</code>—</span>', |
|
| 1857 | ), |
|
| 1858 | array( |
|
| 1859 | '</code>hello<span>---</span>', |
|
| 1860 | '</code>hello<span>—</span>', |
|
| 1861 | ), |
|
| 1862 | array( |
|
| 1863 | '<code>hello</code>---</span>', |
|
| 1864 | '<code>hello</code>—</span>', |
|
| 1865 | ), |
|
| 1866 | array( |
|
| 1867 | '<span>hello</span>---<code>', |
|
| 1868 | '<span>hello</span>—<code>', |
|
| 1869 | ), |
|
| 1870 | array( |
|
| 1871 | '<span>hello<code>---</span>', |
|
| 1872 | '<span>hello<code>---</span>', |
|
| 1873 | ), |
|
| 1874 | array( |
|
| 1875 | '<code>hello<span>---</span>', |
|
| 1876 | '<code>hello<span>---</span>', |
|
| 1877 | ), |
|
| 1878 | array( |
|
| 1879 | '<code>hello</span>---</span>', |
|
| 1880 | '<code>hello</span>---</span>', |
|
| 1881 | ), |
|
| 1882 | array( |
|
| 1883 | '<span><code>hello</code>---</span>', |
|
| 1884 | '<span><code>hello</code>—</span>', |
|
| 1885 | ), |
|
| 1886 | array( |
|
| 1887 | '<code>hello</code>world<span>---</span>', |
|
| 1888 | '<code>hello</code>world<span>—</span>', |
|
| 1889 | ), |
|
| 1890 | ); |
|
| 1891 | } |
|
| 1892 | ||
| 1893 | /** |
|
| @@ 464-503 (lines=40) @@ | ||
| 461 | return $this->assertEquals($output, wp_kses($input, $allowedposttags)); |
|
| 462 | } |
|
| 463 | ||
| 464 | function data_slash_zero_removal() |
|
| 465 | { |
|
| 466 | return array( |
|
| 467 | array( |
|
| 468 | 'This \\0 should be no big deal.', |
|
| 469 | 'This \\0 should be no big deal.', |
|
| 470 | ), |
|
| 471 | array( |
|
| 472 | '<div>This \\0 should be no big deal.</div>', |
|
| 473 | '<div>This \\0 should be no big deal.</div>', |
|
| 474 | ), |
|
| 475 | array( |
|
| 476 | '<div align="\\0left">This should be no big deal.</div>', |
|
| 477 | '<div align="\\0left">This should be no big deal.</div>', |
|
| 478 | ), |
|
| 479 | array( |
|
| 480 | 'This <div style="float:\\0left"> is more of a concern.', |
|
| 481 | 'This <div style="float:left"> is more of a concern.', |
|
| 482 | ), |
|
| 483 | array( |
|
| 484 | 'This <div style="float:\\0\\0left"> is more of a concern.', |
|
| 485 | 'This <div style="float:left"> is more of a concern.', |
|
| 486 | ), |
|
| 487 | array( |
|
| 488 | 'This <div style="float:\\\\00left"> is more of a concern.', |
|
| 489 | 'This <div style="float:left"> is more of a concern.', |
|
| 490 | ), |
|
| 491 | array( |
|
| 492 | 'This <div style="float:\\\\\\\\0000left"> is more of a concern.', |
|
| 493 | 'This <div style="float:left"> is more of a concern.', |
|
| 494 | ), |
|
| 495 | array( |
|
| 496 | 'This <div style="float:\\0000left"> is more of a concern.', |
|
| 497 | 'This <div style="float:left"> is more of a concern.', |
|
| 498 | ), |
|
| 499 | array( |
|
| 500 | '<style type="text/css">div {background-image:\\0}</style>', |
|
| 501 | 'div {background-image:\\0}', |
|
| 502 | ), |
|
| 503 | ); |
|
| 504 | } |
|
| 505 | ||
| 506 | /** |
|
| @@ 187-242 (lines=56) @@ | ||
| 184 | $this->assertEquals($content, $result); |
|
| 185 | } |
|
| 186 | ||
| 187 | function data_autoembed() |
|
| 188 | { |
|
| 189 | return array( |
|
| 190 | ||
| 191 | // Should embed |
|
| 192 | array( |
|
| 193 | 'https://w.org', |
|
| 194 | '[embed]' |
|
| 195 | ), |
|
| 196 | array( |
|
| 197 | 'test |
|
| 198 | https://w.org |
|
| 199 | test', |
|
| 200 | 'test |
|
| 201 | [embed] |
|
| 202 | test' |
|
| 203 | ), |
|
| 204 | array( |
|
| 205 | '<p class="test">https://w.org</p>', |
|
| 206 | '<p class="test">[embed]</p>' |
|
| 207 | ), |
|
| 208 | array( |
|
| 209 | '<p> https://w.org </p>', |
|
| 210 | '<p> [embed] </p>' |
|
| 211 | ), |
|
| 212 | array( |
|
| 213 | '<p>test |
|
| 214 | https://w.org |
|
| 215 | test</p>', |
|
| 216 | '<p>test |
|
| 217 | [embed] |
|
| 218 | test</p>' |
|
| 219 | ), |
|
| 220 | array( |
|
| 221 | '<p>https://w.org |
|
| 222 | </p>', |
|
| 223 | '<p>[embed] |
|
| 224 | </p>' |
|
| 225 | ), |
|
| 226 | ||
| 227 | // Should NOT embed |
|
| 228 | array( |
|
| 229 | 'test https://w.org</p>' |
|
| 230 | ), |
|
| 231 | array( |
|
| 232 | '<span>https://w.org</a>' |
|
| 233 | ), |
|
| 234 | array( |
|
| 235 | '<pre>https://w.org |
|
| 236 | </p>' |
|
| 237 | ), |
|
| 238 | array( |
|
| 239 | '<a href="https://w.org"> |
|
| 240 | https://w.org</a>' |
|
| 241 | ), |
|
| 242 | ); |
|
| 243 | } |
|
| 244 | ||
| 245 | /** |
|