File tree Expand file tree Collapse file tree 1 file changed +67
-0
lines changed
Expand file tree Collapse file tree 1 file changed +67
-0
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+ /**
3+ * Adapter provider more information from flickr
4+ */
5+ namespace Embed \Adapters ;
6+
7+ use Embed \Url ;
8+ use Embed \Request ;
9+ use Embed \Utils ;
10+
11+ class Flickr extends Webpage implements AdapterInterface
12+ {
13+ /**
14+ * {@inheritdoc}
15+ */
16+ public static function check (Request $ request )
17+ {
18+ return $ request ->match ([
19+ 'https://www.flickr.com/photos/* ' ,
20+ ]);
21+ }
22+
23+ /**
24+ * {@inheritdoc}
25+ */
26+ public function getCode ()
27+ {
28+ $ code = parent ::getCode ();
29+
30+ if (empty ($ code )) {
31+ $ url = (new Url ($ this ->request ->getUrl ()))
32+ ->withAddedDirectory ('player ' );
33+
34+ $ code = Utils::iframe ($ url ->getUrl (), $ this ->width , $ this ->height );
35+ }
36+
37+ return $ code ;
38+ }
39+
40+ /**
41+ * {@inheritdoc}
42+ */
43+ public function getWidth ()
44+ {
45+ if (!parent ::getCode ()) {
46+ return 640 ;
47+ }
48+ }
49+
50+ /**
51+ * {@inheritdoc}
52+ */
53+ public function getHeight ()
54+ {
55+ if (!parent ::getCode ()) {
56+ return 425 ;
57+ }
58+ }
59+
60+ /**
61+ * {@inheritdoc}
62+ */
63+ public function getProviderName ()
64+ {
65+ return 'Flickr ' ;
66+ }
67+ }
You can’t perform that action at this time.
0 commit comments