예제 #1
0
파일: Flickr.php 프로젝트: SmartCrowd/Embed
 /**
  * {@inheritdoc}
  */
 public function getHeight()
 {
     if (!parent::getCode()) {
         return 425;
     }
     return parent::getHeight();
 }
예제 #2
0
파일: Github.php 프로젝트: slawus/Embed
 /**
  * {@inheritdoc}
  */
 public function getCode()
 {
     if ($this->request->match('https://github.com/*/*/blob/*')) {
         $username = $this->request->getDirectoryPosition(0);
         $repo = $this->request->getDirectoryPosition(1);
         $ref = $this->request->getDirectoryPosition(3);
         $path_to_file = implode('/', $this->request->getSlicePath(4));
         switch ($this->request->getExtension()) {
             case 'geojson':
                 //https://help.github.com/articles/mapping-geojson-files-on-github/#embedding-your-map-elsewhere
                 return "<script src=\"https://embed.githubusercontent.com/view/geojson/{$username}/{$repo}/{$ref}/{$path_to_file}\"></script>";
             case 'stl':
                 //https://help.github.com/articles/3d-file-viewer/#embedding-your-model-elsewhere
                 return "<script src=\"https://embed.githubusercontent.com/view/3d/{$username}/{$repo}/{$ref}/{$path_to_file}\"></script>";
         }
     }
     return parent::getCode();
 }