예제 #1
0
파일: Facebook.php 프로젝트: heatery/Embed
 /**
  * Returns the id found in an facebook url
  *
  * @param Url $url
  *
  * @return string
  */
 private function getId(Url $url)
 {
     if ($url->hasParameter('story_fbid')) {
         $this->isPost = true;
         return $url->getParameter('story_fbid');
     }
     if ($url->hasParameter('fbid')) {
         return $url->getParameter('fbid');
     }
     if ($url->hasParameter('id')) {
         return $url->getParameter('id');
     }
     if ($url->getDirectory(0) === 'events') {
         return $url->getDirectory(1);
     }
     if ($url->getDirectory(0) === 'pages') {
         return $url->getDirectory(2);
     }
     if ($url->getDirectory(1) === 'posts') {
         $this->isPost = true;
         return $url->getDirectory(2);
     }
     if ($url->getDirectory(2) === 'posts') {
         $this->isPost = true;
         return $url->getDirectory(3);
     }
     return $url->getDirectory(0);
 }