예제 #1
0
 /**
  * Returns the id found in a facebook url
  *
  * @param Url $url
  *
  * @return string
  */
 private function getId(Url $url)
 {
     if ($url->hasQueryParameter('story_fbid')) {
         $this->isEmbeddable = true;
         return $url->getQueryParameter('story_fbid');
     }
     if ($url->hasQueryParameter('fbid')) {
         return $url->getQueryParameter('fbid');
     }
     if ($url->hasQueryParameter('id')) {
         return $url->getQueryParameter('id');
     }
     if ($url->getDirectoryPosition(0) === 'events') {
         $this->isEmbeddable = true;
         return $url->getDirectoryPosition(1);
     }
     if ($url->getDirectoryPosition(0) === 'pages') {
         return $url->getDirectoryPosition(2);
     }
     if ($url->getDirectoryPosition(1) === 'posts') {
         $this->isEmbeddable = true;
         return $url->getDirectoryPosition(2);
     }
     if ($url->getDirectoryPosition(2) === 'posts') {
         $this->isEmbeddable = true;
         return $url->getDirectoryPosition(3);
     }
     return $url->getDirectoryPosition(0);
 }
예제 #2
0
파일: N500px.php 프로젝트: SmartCrowd/Embed
 /**
  * {@inheritdoc}
  */
 public static function getEndPoint(Url $url)
 {
     if (is_numeric($url->getDirectoryPosition(1))) {
         return $url->createUrl()->withDirectoryPosition(2, 'oembed.json');
     }
     return '';
 }