Version Description
Download this release
Release Info
Developer | k3davis |
Plugin | Google Doc Embedder |
Version | 0.2 |
Comparing to | |
See all releases |
Version 0.2
- gviewer.php +37 -0
- readme.txt +57 -0
- screenshot-1.png +0 -0
gviewer.php
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
Plugin Name: Google Doc Embedder
|
5 |
+
Plugin URI: http://wordpress.org/#
|
6 |
+
Description: Lets you embed PDF files and PowerPoint presentations in a web page using the Google Document Viewer.
|
7 |
+
Author: Kevin Davis
|
8 |
+
Version: 0.2
|
9 |
+
Author URI: http://www.davismetro.com/
|
10 |
+
*/
|
11 |
+
|
12 |
+
// [gview file="http://path.to/file.pdf" save="1" width="600" height="500"]
|
13 |
+
function gviewer_func($atts) {
|
14 |
+
extract(shortcode_atts(array(
|
15 |
+
'file' => '',
|
16 |
+
'save' => '1',
|
17 |
+
'width' => '600',
|
18 |
+
'height' => '500'
|
19 |
+
), $atts));
|
20 |
+
|
21 |
+
$code=<<<HERE
|
22 |
+
<iframe src="http://docs.google.com/gview?url=%U%&embedded=true" style="width:%W%px; height:%H%px;" frameborder="0"></iframe>
|
23 |
+
HERE;
|
24 |
+
|
25 |
+
$code = str_replace("%U%", $file, $code);
|
26 |
+
$code = str_replace("%W%", $width, $code);
|
27 |
+
$code = str_replace("%H%", $height, $code);
|
28 |
+
if ($save == "1") {
|
29 |
+
$code .= "<p><a href=\"$file\" target=\"_blank\">download file</a></p>";
|
30 |
+
}
|
31 |
+
|
32 |
+
return $code;
|
33 |
+
}
|
34 |
+
|
35 |
+
add_shortcode('gview', 'gviewer_func');
|
36 |
+
|
37 |
+
?>
|
readme.txt
ADDED
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== Google Doc Embedder ===
|
2 |
+
Contributors: k3davis
|
3 |
+
Tags: pdf, ppt, powerpoint, google, embed, google docs, document
|
4 |
+
Requires at least: 2.5
|
5 |
+
Tested up to: 2.9-rare
|
6 |
+
Stable tag: trunk
|
7 |
+
|
8 |
+
Lets you embed PDF files and PowerPoint presentations in a web page using the Google Document Viewer.
|
9 |
+
|
10 |
+
== Description ==
|
11 |
+
|
12 |
+
Google Doc Embedder lets you embed PDF files and PowerPoint presentations in a web page using the Google Document Viewer.
|
13 |
+
|
14 |
+
Similar to services like Sribd, Google Doc Embedder will allow you to embed a PDF or PPT (PowerPoint) file directly into your page or post, not requiring the user to have Adobe Reader or PowerPoint installed to view the contents. Unlike Scribd, the files do not need to be uploaded to any service first - including Google Documents - but can exist anywhere accessible on your site or the internet.
|
15 |
+
|
16 |
+
Note: This plugin utilizes an undocumented feature of the Google Document viewer, and as such it may be subject to hazards if their viewer unexpectedly changes drastically. In this unlikely event, the plugin should degrade nicely and not break your site. :)
|
17 |
+
|
18 |
+
== Installation ==
|
19 |
+
|
20 |
+
1. Upload the entire `google-document-embedder` folder to the `/wp-content/plugins/` directory.
|
21 |
+
1. Activate the plugin through the 'Plugins' menu in WordPress.
|
22 |
+
|
23 |
+
You will find 'Contact' menu in your WordPress admin panel.
|
24 |
+
|
25 |
+
For basic usage, please see the [FAQ].
|
26 |
+
|
27 |
+
== Frequently Asked Questions ==
|
28 |
+
|
29 |
+
= What file types can be embedded? =
|
30 |
+
This plugin can embed PDF or PPT files only. The file to embed must first be available somewhere on the internet. You can upload it to your WordPress site using the standard techniques, or link to a file on another site. **You do not need to save the file in Google Documents first to embed it.**
|
31 |
+
|
32 |
+
= How do I embed a file in my page or post? =
|
33 |
+
Use the custom shortcode `[gview]` to embed the file, as shown:
|
34 |
+
|
35 |
+
`[gview file="http://url.to/file.pdf"]`
|
36 |
+
|
37 |
+
Optional attributes:
|
38 |
+
|
39 |
+
* `save=` : Set to 0 if you wish to suppress the direct download link to the file under the embedded viewer
|
40 |
+
* `width=` : To override the default width of the viewer, enter a new width value (number in pixels)
|
41 |
+
* `height=` : To override the default height of the viewer, enter a new height value (number in pixels)
|
42 |
+
|
43 |
+
= Nothing is showing up! What do I do? =
|
44 |
+
View the source on the web page where you've embedded the viewer. In order to degrade gracefully in case an error occurs, error messages will be inserted as HTML comments in these pages at the spot the viewer is called.
|
45 |
+
|
46 |
+
== Screenshots ==
|
47 |
+
|
48 |
+
1. Appearance of embedded viewer (blank file)
|
49 |
+
|
50 |
+
== Changelog ==
|
51 |
+
|
52 |
+
=0.2=
|
53 |
+
*Initial beta release. Fully functional, but no niceties...
|
54 |
+
|
55 |
+
== License ==
|
56 |
+
|
57 |
+
This plugin is free for everyone. Since it's released under the GPL, you can use it free of charge on your personal or commercial blog.
|
screenshot-1.png
ADDED
Binary file
|