File tree Expand file tree Collapse file tree 2 files changed +19
-3
lines changed
Expand file tree Collapse file tree 2 files changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ public static function check(Request $request)
1818 return $ request ->match ([
1919 'https://maps.google.* ' ,
2020 'https://www.google.*/maps* ' ,
21+ 'https://drive.google.com/file/*/view ' ,
2122 ]);
2223 }
2324
@@ -26,9 +27,14 @@ public static function check(Request $request)
2627 */
2728 public function getCode ()
2829 {
29- $ url = (new Url ($ this ->request ->getUrl ()))
30- ->withQueryParameter ('output ' , 'embed ' )
31- ->withQueryParameter ('s ' , '' );
30+ $ url = new Url ($ this ->request ->getUrl ());
31+
32+ if ($ this ->request ->getHost () === 'drive.google.com ' ) {
33+ $ url = $ url ->withDirectoryPosition (3 , 'preview ' );
34+ } else {
35+ $ url ->withQueryParameter ('output ' , 'embed ' )
36+ ->withQueryParameter ('s ' , '' );
37+ }
3238
3339 return Utils::iframe ($ url ->getUrl ());
3440 }
Original file line number Diff line number Diff line change @@ -9,4 +9,14 @@ public function testMap()
99 $ this ->assertEquals ($ info ->type , 'rich ' );
1010 $ this ->assertEquals ($ info ->providerName , 'Google Maps ' );
1111 }
12+
13+ public function testDrive ()
14+ {
15+ $ info = Embed \Embed::create ('https://drive.google.com/file/d/0B2rwN8wAbVSWbmFJdUdnV2VSTTg/view ' );
16+
17+ $ this ->assertEquals ($ info ->title , 'Entrevista_Rianxo_RadioFusion_150724.mp3 ' );
18+ $ this ->assertEquals ($ info ->type , 'rich ' );
19+ $ this ->assertEquals ($ info ->code , '<iframe src="https://drive.google.com/file/d/0B2rwN8wAbVSWbmFJdUdnV2VSTTg/preview?usp=embed_facebook&pli=1" frameborder="0" allowTransparency="true" style="border:none;overflow:hidden;width:600px;height:400px;"></iframe> ' );
20+ $ this ->assertEquals ($ info ->providerName , 'Google Docs ' );
21+ }
1222}
You can’t perform that action at this time.
0 commit comments