Advertisement
acegiak

Untitled

Oct 22nd, 2013
318
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.73 KB | None | 0 0
  1.   public function _findWebmentionEndpointInHTML($body) {
  2.     if(preg_match('/<link[ ]+href="([^"]+)"[ ]+rel="(?:webmention ?|http:\/\/webmention\.org\/? ?)+"[ ]*\/?>/i', $body, $match)
  3.         || preg_match('/<link[ ]+rel="(?:webmention ?|http:\/\/webmention\.org\/? ?)+"[ ]+href="([^"]+)"[ ]*\/?>/i', $body, $match)) {
  4.       return $match[1];
  5.     }  else {
  6.       return false;
  7.     }
  8.   }
  9.  
  10.  
  11.   OR
  12.  
  13.  
  14.     public function _findWebmentionEndpointInHTML($body) {
  15.     if(preg_match('/<link[ ]+href="([^"]+)"[ ]+rel=".*?webmention.*?"[ ]*\/?>/i', $body, $match)
  16.         || preg_match('/<link[ ]+rel=".*?webmention.*?"[ ]+href="([^"]+)"[ ]*\/?>/i', $body, $match)) {
  17.       return $match[1];
  18.     }  else {
  19.       return false;
  20.     }
  21.   }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement