Version Description
- Added: Option to restrict download link to logged in users (thanks kris)
- Added: Compatibility with WP 3.0
Download this release
Release Info
Developer | k3davis |
Plugin | Google Doc Embedder |
Version | 1.9.4 |
Comparing to | |
See all releases |
Code changes from version 1.9.3 to 1.9.4
- functions.php +5 -1
- gviewer.php +11 -4
- options.php +7 -1
- readme.txt +5 -1
functions.php
CHANGED
@@ -15,6 +15,7 @@ function gde_init($reset = NULL) {
|
|
15 |
'default_height' => '500',
|
16 |
'height_type' => 'px',
|
17 |
'show_dl' => 'yes',
|
|
|
18 |
'link_text' => 'Download (%FT, %FS)',
|
19 |
'link_pos' => 'below',
|
20 |
'link_func' => 'default',
|
@@ -106,7 +107,6 @@ function gde_validLink($link) {
|
|
106 |
}
|
107 |
|
108 |
function gde_validType($link, $exts) {
|
109 |
-
|
110 |
if(preg_match("/($exts)$/i",$link)) {
|
111 |
return true;
|
112 |
} else {
|
@@ -115,6 +115,10 @@ function gde_validType($link, $exts) {
|
|
115 |
}
|
116 |
|
117 |
function gde_validUrl($url) {
|
|
|
|
|
|
|
|
|
118 |
$request = new WP_Http;
|
119 |
$result = $request->request($url);
|
120 |
if (is_array($result)) {
|
15 |
'default_height' => '500',
|
16 |
'height_type' => 'px',
|
17 |
'show_dl' => 'yes',
|
18 |
+
'restrict_dl' => 'no',
|
19 |
'link_text' => 'Download (%FT, %FS)',
|
20 |
'link_pos' => 'below',
|
21 |
'link_func' => 'default',
|
107 |
}
|
108 |
|
109 |
function gde_validType($link, $exts) {
|
|
|
110 |
if(preg_match("/($exts)$/i",$link)) {
|
111 |
return true;
|
112 |
} else {
|
115 |
}
|
116 |
|
117 |
function gde_validUrl($url) {
|
118 |
+
if (!class_exists('WP_Http')) {
|
119 |
+
// wp3 compatibility
|
120 |
+
include_once( ABSPATH . WPINC. '/class-http.php' );
|
121 |
+
}
|
122 |
$request = new WP_Http;
|
123 |
$result = $request->request($url);
|
124 |
if (is_array($result)) {
|
gviewer.php
CHANGED
@@ -5,10 +5,10 @@ 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 (no Flash or PDF browser plug-ins required).
|
7 |
Author: Kevin Davis
|
8 |
-
Version: 1.9.
|
9 |
*/
|
10 |
|
11 |
-
$gde_ver = "1.9.
|
12 |
|
13 |
/**
|
14 |
* LICENSE
|
@@ -44,7 +44,7 @@ $pUrl = plugins_url(plugin_basename(dirname(__FILE__)));
|
|
44 |
function gde_gviewer_func($atts) {
|
45 |
|
46 |
// current settings
|
47 |
-
global $gdeoptions, $exts, $pUrl;
|
48 |
|
49 |
extract(shortcode_atts(array(
|
50 |
'file' => '',
|
@@ -92,9 +92,16 @@ HERE;
|
|
92 |
|
93 |
$lnk = "http://docs.google.com/viewer?url=".urlencode($file)."&embedded=true";
|
94 |
$linkcode = "";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
95 |
|
96 |
if ($save == "yes" || $save == "1") {
|
97 |
-
|
98 |
$dlMethod = $gdeoptions['link_func'];
|
99 |
if ($fnp[1] == "PDF") {
|
100 |
if ($dlMethod == "force" or $dlMethod == "force-mask") {
|
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 (no Flash or PDF browser plug-ins required).
|
7 |
Author: Kevin Davis
|
8 |
+
Version: 1.9.4
|
9 |
*/
|
10 |
|
11 |
+
$gde_ver = "1.9.4.99";
|
12 |
|
13 |
/**
|
14 |
* LICENSE
|
44 |
function gde_gviewer_func($atts) {
|
45 |
|
46 |
// current settings
|
47 |
+
global $gdeoptions, $exts, $pUrl, $user_ID;
|
48 |
|
49 |
extract(shortcode_atts(array(
|
50 |
'file' => '',
|
92 |
|
93 |
$lnk = "http://docs.google.com/viewer?url=".urlencode($file)."&embedded=true";
|
94 |
$linkcode = "";
|
95 |
+
|
96 |
+
get_currentuserinfo();
|
97 |
+
$dlRestrict = $gdeoptions['restrict_dl'];
|
98 |
+
if ($dlRestrict == "yes" && ($user_ID == '')) {
|
99 |
+
// no user logged in and restrict set; override link setting
|
100 |
+
$save = "no";
|
101 |
+
}
|
102 |
|
103 |
if ($save == "yes" || $save == "1") {
|
104 |
+
|
105 |
$dlMethod = $gdeoptions['link_func'];
|
106 |
if ($fnp[1] == "PDF") {
|
107 |
if ($dlMethod == "force" or $dlMethod == "force-mask") {
|
options.php
CHANGED
@@ -21,6 +21,11 @@ if(isset($_REQUEST['defaults'])) {
|
|
21 |
} else {
|
22 |
$gdeoptions['show_dl'] = "no";
|
23 |
}
|
|
|
|
|
|
|
|
|
|
|
24 |
if(isset($_POST['default_width'])) {
|
25 |
$neww = $_POST['default_width'];
|
26 |
if (strlen($neww) > 0) $gdeoptions['default_width'] = gde_sanitizeOpt($neww, $_POST['width_type']);
|
@@ -102,7 +107,8 @@ To override size on individual posts, manually set in the post shortcode using (
|
|
102 |
To override display setting on an individual post, use <code>save="1"</code> (show) or <code>save="0"</code> (hide) in the post shortcode.</em></td>
|
103 |
</tr>
|
104 |
<tr valign="top">
|
105 |
-
<td colspan="2"><?php gde_showCheck('show_dl', t('Display the download link by default'));
|
|
|
106 |
</tr>
|
107 |
<tr valign="top">
|
108 |
<th scope="row">Link Text</th>
|
21 |
} else {
|
22 |
$gdeoptions['show_dl'] = "no";
|
23 |
}
|
24 |
+
if(isset($_POST['restrict_dl'])) {
|
25 |
+
$gdeoptions['restrict_dl'] = "yes";
|
26 |
+
} else {
|
27 |
+
$gdeoptions['restrict_dl'] = "no";
|
28 |
+
}
|
29 |
if(isset($_POST['default_width'])) {
|
30 |
$neww = $_POST['default_width'];
|
31 |
if (strlen($neww) > 0) $gdeoptions['default_width'] = gde_sanitizeOpt($neww, $_POST['width_type']);
|
107 |
To override display setting on an individual post, use <code>save="1"</code> (show) or <code>save="0"</code> (hide) in the post shortcode.</em></td>
|
108 |
</tr>
|
109 |
<tr valign="top">
|
110 |
+
<td colspan="2"><?php gde_showCheck('show_dl', t('Display the download link by default')); ?><br/>
|
111 |
+
<?php gde_showCheck('restrict_dl', t('Only display download link to logged in users')); ?></td>
|
112 |
</tr>
|
113 |
<tr valign="top">
|
114 |
<th scope="row">Link Text</th>
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: k3davis
|
|
3 |
Donate link: http://pledgie.com/campaigns/6048
|
4 |
Tags: pdf, pps, ppt, tiff, powerpoint, google, embed, google docs, document
|
5 |
Requires at least: 2.8
|
6 |
-
Tested up to:
|
7 |
Stable tag: trunk
|
8 |
|
9 |
Lets you embed PDF, PowerPoint presentations (PPT, PPS), and TIFF images in a web page using the Google Docs Viewer (no Flash or PDF browser plug-ins required).
|
@@ -60,6 +60,10 @@ That's not a question ;) but if you have any particular ideas on further develop
|
|
60 |
|
61 |
== Changelog ==
|
62 |
|
|
|
|
|
|
|
|
|
63 |
= 1.9.3 =
|
64 |
* Added: Support for PPS files (thanks Dan)
|
65 |
* Changed: Simplified default IE Warning text
|
3 |
Donate link: http://pledgie.com/campaigns/6048
|
4 |
Tags: pdf, pps, ppt, tiff, powerpoint, google, embed, google docs, document
|
5 |
Requires at least: 2.8
|
6 |
+
Tested up to: 3.0
|
7 |
Stable tag: trunk
|
8 |
|
9 |
Lets you embed PDF, PowerPoint presentations (PPT, PPS), and TIFF images in a web page using the Google Docs Viewer (no Flash or PDF browser plug-ins required).
|
60 |
|
61 |
== Changelog ==
|
62 |
|
63 |
+
= 1.9.4 =
|
64 |
+
* Added: Option to restrict download link to logged in users (thanks kris)
|
65 |
+
* Added: Compatibility with WP 3.0
|
66 |
+
|
67 |
= 1.9.3 =
|
68 |
* Added: Support for PPS files (thanks Dan)
|
69 |
* Changed: Simplified default IE Warning text
|