Version Description
- Removed: toolbar button options (Google prevents this from working, sorry)
Download this release
Release Info
Developer | k3davis |
Plugin | Google Doc Embedder |
Version | 1.7.2 |
Comparing to | |
See all releases |
Code changes from version 1.7.1 to 1.7.2
- altview.php +0 -41
- functions.php +1 -5
- gviewer.php +12 -12
- options.php +0 -32
- readme.txt +4 -1
- screenshot-2.png +0 -0
- uninstall.php +12 -0
altview.php
DELETED
@@ -1,41 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
$str = $_SERVER['QUERY_STRING'];
|
4 |
-
parse_str($str);
|
5 |
-
|
6 |
-
if (!$src = curl_get_file_contents($loc)) {
|
7 |
-
echo "<html><body>\n\n<!-- GDE EMBED ERROR: alt viewer failed to load -->\n\n</body></html>";
|
8 |
-
exit;
|
9 |
-
}
|
10 |
-
|
11 |
-
$src = str_replace('<head>','<head><base href="http://docs.google.com/gview" />', $src);
|
12 |
-
|
13 |
-
if ($logo == "no") {
|
14 |
-
$src = str_replace('.goog-logo-small {','.goog-logo-small { display: none !important;', $src);
|
15 |
-
}
|
16 |
-
if ($full == "no") {
|
17 |
-
$src = str_replace('.controlbar-open-in-viewer-image {','.controlbar-open-in-viewer-image { display: none !important;', $src);
|
18 |
-
}
|
19 |
-
if ($pgup == "no") {
|
20 |
-
$src = str_replace('.controlbar-two-up-image {','.controlbar-two-up-image { display: none !important;', $src);
|
21 |
-
$src = str_replace('.controlbar-one-up-image {','.controlbar-one-up-image { display: none !important;', $src);
|
22 |
-
}
|
23 |
-
if ($zoom == "no") {
|
24 |
-
$src = str_replace('.controlbar-minus-image {','.controlbar-minus-image { display: none !important;', $src);
|
25 |
-
$src = str_replace('.controlbar-plus-image {','.controlbar-plus-image { display: none !important;', $src);
|
26 |
-
}
|
27 |
-
|
28 |
-
echo $src;
|
29 |
-
|
30 |
-
function curl_get_file_contents($URL)
|
31 |
-
{
|
32 |
-
$c = curl_init();
|
33 |
-
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
|
34 |
-
curl_setopt($c, CURLOPT_URL, $URL);
|
35 |
-
$contents = curl_exec($c);
|
36 |
-
curl_close($c);
|
37 |
-
|
38 |
-
if ($contents) return $contents;
|
39 |
-
else return FALSE;
|
40 |
-
}
|
41 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
functions.php
CHANGED
@@ -8,11 +8,7 @@ function getDefaults() {
|
|
8 |
"gde_show_dl" => 1,
|
9 |
"gde_link_text" => "Download (%FT, %FS)",
|
10 |
"gde_link_pos" => "below",
|
11 |
-
"gde_link_func" => "default"
|
12 |
-
"gde_xlogo" => 0,
|
13 |
-
"gde_xfull" => 0,
|
14 |
-
"gde_xpgup" => 0,
|
15 |
-
"gde_xzoom" => 0
|
16 |
);
|
17 |
|
18 |
return $defaults;
|
8 |
"gde_show_dl" => 1,
|
9 |
"gde_link_text" => "Download (%FT, %FS)",
|
10 |
"gde_link_pos" => "below",
|
11 |
+
"gde_link_func" => "default"
|
|
|
|
|
|
|
|
|
12 |
);
|
13 |
|
14 |
return $defaults;
|
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
|
@@ -35,10 +35,6 @@ function gviewer_func($atts) {
|
|
35 |
$wd = get_option('gde_default_width');
|
36 |
$ht = get_option('gde_default_height');
|
37 |
$txt = get_option('gde_link_text');
|
38 |
-
$xlogo = get_option('gde_xlogo');
|
39 |
-
$xfull = get_option('gde_xfull');
|
40 |
-
$xpgup = get_option('gde_xpgup');
|
41 |
-
$xzoom = get_option('gde_xzoom');
|
42 |
extract(shortcode_atts(array(
|
43 |
'file' => '',
|
44 |
'save' => $dl,
|
@@ -70,13 +66,6 @@ function gviewer_func($atts) {
|
|
70 |
HERE;
|
71 |
|
72 |
$lnk = "http://docs.google.com/viewer?url=".urlencode($file)."&embedded=true";
|
73 |
-
if ($xlogo || $xfull || $xpgup || $xzoom) {
|
74 |
-
$lnk = $pUrl."/altview.php?loc=".urlencode($lnk);
|
75 |
-
if ($xlogo == "1") { $lnk .= "&logo=no"; }
|
76 |
-
if ($xfull == "1") { $lnk .= "&full=no"; }
|
77 |
-
if ($xpgup == "1") { $lnk .= "&pgup=no"; }
|
78 |
-
if ($xzoom == "1") { $lnk .= "&zoom=no"; }
|
79 |
-
}
|
80 |
|
81 |
if ($save == "1") {
|
82 |
|
@@ -134,6 +123,17 @@ function gde_activate() {
|
|
134 |
foreach($defaults as $set => $val) {
|
135 |
add_option($set, $val);
|
136 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
137 |
}
|
138 |
|
139 |
// add an option page
|
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.2
|
9 |
*/
|
10 |
|
11 |
/* Copyright 2009 Kevin Davis. E-mail: kev@tnw.org
|
35 |
$wd = get_option('gde_default_width');
|
36 |
$ht = get_option('gde_default_height');
|
37 |
$txt = get_option('gde_link_text');
|
|
|
|
|
|
|
|
|
38 |
extract(shortcode_atts(array(
|
39 |
'file' => '',
|
40 |
'save' => $dl,
|
66 |
HERE;
|
67 |
|
68 |
$lnk = "http://docs.google.com/viewer?url=".urlencode($file)."&embedded=true";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
|
70 |
if ($save == "1") {
|
71 |
|
123 |
foreach($defaults as $set => $val) {
|
124 |
add_option($set, $val);
|
125 |
}
|
126 |
+
|
127 |
+
// remove legacy options if present
|
128 |
+
$legacy_options = array(
|
129 |
+
"gde_xlogo" => 0,
|
130 |
+
"gde_xfull" => 0,
|
131 |
+
"gde_xpgup" => 0,
|
132 |
+
"gde_xzoom" => 0
|
133 |
+
);
|
134 |
+
foreach ($legacy_options as $lopt => $val) {
|
135 |
+
delete_option($lopt);
|
136 |
+
}
|
137 |
}
|
138 |
|
139 |
// add an option page
|
options.php
CHANGED
@@ -12,10 +12,6 @@ if(isset($_REQUEST['defaults'])) {
|
|
12 |
update_option('gde_link_text', $set['gde_link_text']);
|
13 |
update_option('gde_link_pos', $set['gde_link_pos']);
|
14 |
update_option('gde_link_func', $set['gde_link_func']);
|
15 |
-
update_option('gde_xlogo', $set['gde_xlogo']);
|
16 |
-
update_option('gde_xfull', $set['gde_xfull']);
|
17 |
-
update_option('gde_xpgup', $set['gde_xpgup']);
|
18 |
-
update_option('gde_xzoom', $set['gde_xzoom']);
|
19 |
|
20 |
showMessage("Options reset to defaults");
|
21 |
} elseif(isset($_REQUEST['submit'])) {
|
@@ -26,26 +22,6 @@ if(isset($_REQUEST['defaults'])) {
|
|
26 |
} else {
|
27 |
update_option('gde_show_dl', 0);
|
28 |
}
|
29 |
-
if(isset($_POST['gde_xlogo'])) {
|
30 |
-
update_option('gde_xlogo', 1);
|
31 |
-
} else {
|
32 |
-
update_option('gde_xlogo', 0);
|
33 |
-
}
|
34 |
-
if(isset($_POST['gde_xfull'])) {
|
35 |
-
update_option('gde_xfull', 1);
|
36 |
-
} else {
|
37 |
-
update_option('gde_xfull', 0);
|
38 |
-
}
|
39 |
-
if(isset($_POST['gde_xpgup'])) {
|
40 |
-
update_option('gde_xpgup', 1);
|
41 |
-
} else {
|
42 |
-
update_option('gde_xpgup', 0);
|
43 |
-
}
|
44 |
-
if(isset($_POST['gde_xzoom'])) {
|
45 |
-
update_option('gde_xzoom', 1);
|
46 |
-
} else {
|
47 |
-
update_option('gde_xzoom', 0);
|
48 |
-
}
|
49 |
if(isset($_POST['gde_default_width'])) {
|
50 |
$neww = $_POST['gde_default_width'];
|
51 |
if (strlen($neww) > 0) update_option('gde_default_width', sanitizeOpt($neww));
|
@@ -88,14 +64,6 @@ To override size on individual posts, manually set <code>height=</code> and <cod
|
|
88 |
<td><input type="text" size="5" name="gde_default_height" value="<?php echo get_option('gde_default_height'); ?>" /> px</td>
|
89 |
</tr>
|
90 |
<tr valign="top">
|
91 |
-
<th scope="row">Hide From Toolbar:</th>
|
92 |
-
<td><?php showCheck('gde_xlogo', t('Google Logo')); ?>
|
93 |
-
<?php showCheck('gde_xpgup', t('Single/Double Page View')); ?>
|
94 |
-
<?php showCheck('gde_xzoom', t('Zoom In/Out')); ?>
|
95 |
-
<?php showCheck('gde_xfull', t('Open in New Window')); ?>
|
96 |
-
</td>
|
97 |
-
</tr>
|
98 |
-
<tr valign="top">
|
99 |
<td colspan="2"><strong>Download Link Options</strong><br/>
|
100 |
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>
|
101 |
</tr>
|
12 |
update_option('gde_link_text', $set['gde_link_text']);
|
13 |
update_option('gde_link_pos', $set['gde_link_pos']);
|
14 |
update_option('gde_link_func', $set['gde_link_func']);
|
|
|
|
|
|
|
|
|
15 |
|
16 |
showMessage("Options reset to defaults");
|
17 |
} elseif(isset($_REQUEST['submit'])) {
|
22 |
} else {
|
23 |
update_option('gde_show_dl', 0);
|
24 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
if(isset($_POST['gde_default_width'])) {
|
26 |
$neww = $_POST['gde_default_width'];
|
27 |
if (strlen($neww) > 0) update_option('gde_default_width', sanitizeOpt($neww));
|
64 |
<td><input type="text" size="5" name="gde_default_height" value="<?php echo get_option('gde_default_height'); ?>" /> px</td>
|
65 |
</tr>
|
66 |
<tr valign="top">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
<td colspan="2"><strong>Download Link Options</strong><br/>
|
68 |
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>
|
69 |
</tr>
|
readme.txt
CHANGED
@@ -52,11 +52,14 @@ That's not a question ;) but if you have any particular ideas on further develop
|
|
52 |
|
53 |
== Screenshots ==
|
54 |
|
55 |
-
1.
|
56 |
2. Settings page
|
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
|
52 |
|
53 |
== Screenshots ==
|
54 |
|
55 |
+
1. Appearance of embedded viewer
|
56 |
2. Settings page
|
57 |
|
58 |
== Changelog ==
|
59 |
|
60 |
+
= 1.7.2 =
|
61 |
+
* Removed: toolbar button options (Google prevents this from working, sorry)
|
62 |
+
|
63 |
= 1.7.1 =
|
64 |
* Fixed: Misleading error message if file= attribute not used
|
65 |
* Fixed: Bug in curl header may cause false "not found" error
|
screenshot-2.png
CHANGED
Binary file
|
uninstall.php
CHANGED
@@ -8,4 +8,16 @@ foreach ($options as $opt => $val) {
|
|
8 |
delete_option($opt);
|
9 |
}
|
10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
?>
|
8 |
delete_option($opt);
|
9 |
}
|
10 |
|
11 |
+
// remove legacy options if present
|
12 |
+
|
13 |
+
$legacy_options = array(
|
14 |
+
"gde_xlogo" => 0,
|
15 |
+
"gde_xfull" => 0,
|
16 |
+
"gde_xpgup" => 0,
|
17 |
+
"gde_xzoom" => 0
|
18 |
+
);
|
19 |
+
foreach ($legacy_options as $lopt => $val) {
|
20 |
+
delete_option($lopt);
|
21 |
+
}
|
22 |
+
|
23 |
?>
|