-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathgfolder_embed.php
50 lines (43 loc) · 1.92 KB
/
gfolder_embed.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
/**
* Plugin Name: Embed a Google Drive Folder w the unique folder ID
* Plugin URI: https://github.com/woodwardtw/gfolder_embed
* Description: Embed your Google Drive Folder via the unique ID. You can also define a list or grid view via the style parameter. [gdrive id="YourFolderID" style="grid or list" width="" height="" resourcekey="may be needed in some cases"]
* Version: 1.1
* Author: Tom Woodward
* Author URI: http://bionicteaching.com
* License: GPL2
*/
/* 2014 PLUGIN_AUTHOR_NAME (email : bionicteaching@gmail.com)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2, as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
//[gdrive id="YourFolderID" style="Grid or List" width="" height=""]
function gdrive_shortcode($atts) {
$rkey = '';
$a = shortcode_atts( array(
'id' => '',
'style' => 'list',
'width' => '100%',
'height' => '500px',
'resourcekey' => '',
'sort' => ''
), $atts);
if($a['resourcekey']){
$rkey = '&resourcekey=' .$a['resourcekey'];
}
$id = $a['id'];
$style = $a['style'];
$width = $a['width'];
$height = $a['height'];
return "<iframe src='https://drive.google.com/embeddedfolderview?id={$id}{$rkey}#{$style}' frameborder='0' width='{$width}' height='{$height}' scrolling='auto'></iframe>";
}
add_shortcode( 'gdrive', 'gdrive_shortcode' );