Google Doc Embedder - Version 1.7.1

Version Description

  • Fixed: Misleading error message if file
Download this release

Release Info

Developer k3davis
Plugin Icon wp plugin Google Doc Embedder
Version 1.7.1
Comparing to
See all releases

Code changes from version 1.7 to 1.7.1

Files changed (3) hide show
  1. functions.php +1 -1
  2. gviewer.php +4 -2
  3. readme.txt +5 -0
functions.php CHANGED
@@ -48,7 +48,7 @@ function validUrl($url) {
48
  }
49
  curl_setopt($handle, CURLOPT_HEADER, true);
50
  curl_setopt($handle, CURLOPT_FAILONERROR, true);
51
- curl_setopt($handle, CURLOPT_HTTPHEADER, Array("Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3") ); // needed for some sites (such as digg.com)
52
  curl_setopt($handle, CURLOPT_NOBODY, true);
53
  curl_setopt($handle, CURLOPT_FOLLOWLOCATION, true); // only useful in case of redirects
54
  curl_setopt($handle, CURLOPT_RETURNTRANSFER, true);
48
  }
49
  curl_setopt($handle, CURLOPT_HEADER, true);
50
  curl_setopt($handle, CURLOPT_FAILONERROR, true);
51
+ curl_setopt($handle, CURLOPT_HTTPHEADER, Array("User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3") ); // needed for some sites (such as digg.com)
52
  curl_setopt($handle, CURLOPT_NOBODY, true);
53
  curl_setopt($handle, CURLOPT_FOLLOWLOCATION, true); // only useful in case of redirects
54
  curl_setopt($handle, CURLOPT_RETURNTRANSFER, true);
gviewer.php CHANGED
@@ -5,7 +5,7 @@ Plugin Name: Google Doc Embedder
5
  Plugin URI: http://davismetro.com/gde/
6
  Description: Lets you embed PDF files, PowerPoint presentations, and TIFF images in a web page using the Google Docs Viewer.
7
  Author: Kevin Davis
8
- Version: 1.7
9
  */
10
 
11
  /* Copyright 2009 Kevin Davis. E-mail: kev@tnw.org
@@ -50,7 +50,9 @@ function gviewer_func($atts) {
50
  $exts = "pdf|ppt|tif|tiff";
51
 
52
  // check link for validity
53
- if (!validLink($file)){
 
 
54
  $code = "\n<!-- GDE EMBED ERROR: invalid URL, please use fully qualified URL -->\n";
55
  } elseif (!validType($file,$exts)) {
56
  $code = "\n<!-- GDE EMBED ERROR: unsupported file type -->\n";
5
  Plugin URI: http://davismetro.com/gde/
6
  Description: Lets you embed PDF files, PowerPoint presentations, and TIFF images in a web page using the Google Docs Viewer.
7
  Author: Kevin Davis
8
+ Version: 1.7.1
9
  */
10
 
11
  /* Copyright 2009 Kevin Davis. E-mail: kev@tnw.org
50
  $exts = "pdf|ppt|tif|tiff";
51
 
52
  // check link for validity
53
+ if (!$file) {
54
+ $code = "\n<!-- GDE EMBED ERROR: file attribute not found (check syntax) -->\n";
55
+ } elseif (!validLink($file)){
56
  $code = "\n<!-- GDE EMBED ERROR: invalid URL, please use fully qualified URL -->\n";
57
  } elseif (!validType($file,$exts)) {
58
  $code = "\n<!-- GDE EMBED ERROR: unsupported file type -->\n";
readme.txt CHANGED
@@ -36,6 +36,7 @@ Use the custom shortcode `[gview]` to embed the file, as shown:
36
 
37
  `[gview file="http://url.to/file.pdf"]`
38
 
 
39
 
40
  Optional attributes:
41
 
@@ -56,6 +57,10 @@ That's not a question ;) but if you have any particular ideas on further develop
56
 
57
  == Changelog ==
58
 
 
 
 
 
59
  = 1.7 =
60
  * Added: Ability to hide selected viewer toolbar buttons
61
  * Fixed: Mask URL option ignored on non-PDF file types
36
 
37
  `[gview file="http://url.to/file.pdf"]`
38
 
39
+ Note: the `file=` attribute (pointing to the full URL of the file) is **required**.
40
 
41
  Optional attributes:
42
 
57
 
58
  == Changelog ==
59
 
60
+ = 1.7.1 =
61
+ * Fixed: Misleading error message if file= attribute not used
62
+ * Fixed: Bug in curl header may cause false "not found" error
63
+
64
  = 1.7 =
65
  * Added: Ability to hide selected viewer toolbar buttons
66
  * Fixed: Mask URL option ignored on non-PDF file types