Commit 29d0dd740c329c2674de58bec172419148a1b495

Allow whitespace before and after the = and require space before the href in <link href="url"> html
extlib/Services/oEmbed.php
(4 / 4)
  
256256
257257 $code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
258258 if (substr($code, 0, 1) != '2') {
259 throw new Services_oEmbed_Exception('Non-200 code returned');
259 throw new Services_oEmbed_Exception('Non-200 code returned. Got code ' . $code);
260260 }
261261
262262 curl_close($ch);
302302
303303 // Find all <link /> tags that have a valid oembed type set. We then
304304 // extract the href attribute for each type.
305 $regexp = '#<link([^>]*)type="' .
305 $regexp = '#<link([^>]*)type[\s\n]*=[\s\n]*"' .
306306 '(application/json|text/xml)\+oembed"([^>]*)>#im';
307307
308308 $m = $ret = array();
314314
315315 foreach ($m[0] as $i => $link) {
316316 $h = array();
317 if (preg_match('/href="([^"]+)"/i', $link, $h)) {
317 if (preg_match('/[\s\n]+href[\s\n]*=[\s\n]*"([^"]+)"/im', $link, $h)) {
318318 $ret[$m[2][$i]] = $h[1];
319319 }
320320 }
347347
348348 $code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
349349 if (substr($code, 0, 1) != '2') {
350 throw new Services_oEmbed_Exception('Non-200 code returned');
350 throw new Services_oEmbed_Exception('Non-200 code returned. Got code ' . $code);
351351 }
352352
353353 return $result;

Comments

Add a new comment:

Login or create an account to post a comment

Add your comment