Version Description
- Fixed: Options not saved in some instances due to variable collision (thanks gadgetto)
- Fixed: Options not saved when plugin is reactivated
- Changed: Default width now 100% (existing setting will be preserved)
- Added: Notification of beta versions - more info
Download this release
Release Info
Developer | k3davis |
Plugin | Google Doc Embedder |
Version | 1.9.1 |
Comparing to | |
See all releases |
Code changes from version 1.9 to 1.9.1
- functions.php +19 -6
- gviewer.php +76 -21
- options.php +39 -28
- readme.txt +8 -2
functions.php
CHANGED
@@ -3,12 +3,15 @@
|
|
3 |
// external urls (help, etc.)
|
4 |
@define('GDE_IE8_URL', 'http://davismetro.com/gde/ie8/');
|
5 |
@define('GDE_CONFLICT_URL', 'http://davismetro.com/gde/conflicts/');
|
|
|
|
|
|
|
6 |
|
7 |
function gde_init($reset = NULL) {
|
8 |
// define global default settings
|
9 |
$defaults = array(
|
10 |
-
'default_width' => '
|
11 |
-
'width_type' => '
|
12 |
'default_height' => '500',
|
13 |
'height_type' => 'px',
|
14 |
'show_dl' => 'yes',
|
@@ -17,11 +20,12 @@ function gde_init($reset = NULL) {
|
|
17 |
'link_func' => 'default',
|
18 |
'ie8_warn' => 'no',
|
19 |
'bypass_check' => 'no',
|
20 |
-
'ignore_conflicts' => 'no'
|
|
|
21 |
);
|
22 |
|
23 |
if (!$exists = get_option('gde_options')) {
|
24 |
-
foreach($defaults as $key => $value) {
|
25 |
// convert old settings if found
|
26 |
$currvalue = get_option('gde_' . $key);
|
27 |
if ($currvalue || $currvalue === "0" || $currvalue === "1") {
|
@@ -35,6 +39,15 @@ function gde_init($reset = NULL) {
|
|
35 |
}
|
36 |
add_option('gde_options', $defaults);
|
37 |
} else {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
update_option('gde_options', $defaults);
|
39 |
}
|
40 |
return $defaults;
|
@@ -152,11 +165,11 @@ function gde_sanitizeOpt($value, $type) {
|
|
152 |
}
|
153 |
|
154 |
function gde_shortUrl($u) {
|
155 |
-
return
|
156 |
}
|
157 |
|
158 |
function gde_warnText($u) {
|
159 |
-
return
|
160 |
}
|
161 |
|
162 |
function gde_conflict_check() {
|
3 |
// external urls (help, etc.)
|
4 |
@define('GDE_IE8_URL', 'http://davismetro.com/gde/ie8/');
|
5 |
@define('GDE_CONFLICT_URL', 'http://davismetro.com/gde/conflicts/');
|
6 |
+
@define('GDE_SUPPORT_URL', 'http://davismetro.com/gde/contact/');
|
7 |
+
@define('GDE_BETA_URL', 'http://davismetro.com/gde/beta-program/');
|
8 |
+
@define('GDE_BETA_CHKFILE', 'http://davismetro.com/gde/beta/gde-beta.chk');
|
9 |
|
10 |
function gde_init($reset = NULL) {
|
11 |
// define global default settings
|
12 |
$defaults = array(
|
13 |
+
'default_width' => '100',
|
14 |
+
'width_type' => 'pc',
|
15 |
'default_height' => '500',
|
16 |
'height_type' => 'px',
|
17 |
'show_dl' => 'yes',
|
20 |
'link_func' => 'default',
|
21 |
'ie8_warn' => 'no',
|
22 |
'bypass_check' => 'no',
|
23 |
+
'ignore_conflicts' => 'no',
|
24 |
+
'suppress_beta' => 'no'
|
25 |
);
|
26 |
|
27 |
if (!$exists = get_option('gde_options')) {
|
28 |
+
foreach ($defaults as $key => $value) {
|
29 |
// convert old settings if found
|
30 |
$currvalue = get_option('gde_' . $key);
|
31 |
if ($currvalue || $currvalue === "0" || $currvalue === "1") {
|
39 |
}
|
40 |
add_option('gde_options', $defaults);
|
41 |
} else {
|
42 |
+
$gdeoptions = get_option('gde_options');
|
43 |
+
if ($reset !== "reset") {
|
44 |
+
// maintain existing settings
|
45 |
+
foreach ($defaults as $key => $value) {
|
46 |
+
if($gdeoptions[$key]) {
|
47 |
+
$defaults[$key] = $gdeoptions[$key];
|
48 |
+
}
|
49 |
+
}
|
50 |
+
}
|
51 |
update_option('gde_options', $defaults);
|
52 |
}
|
53 |
return $defaults;
|
165 |
}
|
166 |
|
167 |
function gde_shortUrl($u) {
|
168 |
+
return wp_remote_fopen('http://tinyurl.com/api-create.php?url='.$u);
|
169 |
}
|
170 |
|
171 |
function gde_warnText($u) {
|
172 |
+
return wp_remote_fopen($u."/ie-warn.txt");
|
173 |
}
|
174 |
|
175 |
function gde_conflict_check() {
|
gviewer.php
CHANGED
@@ -5,9 +5,11 @@ 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 |
/**
|
12 |
* LICENSE
|
13 |
* This file is part of Google Doc Embedder.
|
@@ -30,39 +32,39 @@ Version: 1.9
|
|
30 |
* @author Kevin Davis <kev@tnw.org>
|
31 |
* @copyright Copyright 2009 Kevin Davis
|
32 |
* @license http://www.gnu.org/licenses/gpl.txt GPL 2.0
|
33 |
-
* @version 1.9
|
34 |
* @link http://davismetro.com/gde/
|
35 |
*/
|
36 |
|
37 |
include_once('wpframe.php');
|
38 |
include_once('functions.php');
|
39 |
-
$
|
|
|
40 |
|
41 |
// basic usage: [gview file="http://path.to/file.pdf"]
|
42 |
function gde_gviewer_func($atts) {
|
43 |
|
44 |
// current settings
|
45 |
-
global $
|
46 |
|
47 |
extract(shortcode_atts(array(
|
48 |
'file' => '',
|
49 |
-
'save' => $
|
50 |
'width' => '',
|
51 |
'height' => '',
|
52 |
-
'force' => $
|
53 |
), $atts));
|
54 |
|
55 |
$width = str_replace("px", "", trim($width));
|
56 |
if (!$width || !preg_match("/^\d+%?$/", $width)) {
|
57 |
-
$width = $
|
58 |
-
if ($
|
59 |
$width .= "%";
|
60 |
}
|
61 |
}
|
62 |
$height = str_replace("px", "", trim($height));
|
63 |
if (!$height || !preg_match("/^\d+%?$/", $height)) {
|
64 |
-
$height = $
|
65 |
-
if ($
|
66 |
$height .= "%";
|
67 |
}
|
68 |
}
|
@@ -76,7 +78,6 @@ function gde_gviewer_func($atts) {
|
|
76 |
$code = "\n<!-- GDE EMBED ERROR: $status -->\n";
|
77 |
} else {
|
78 |
$code = "";
|
79 |
-
$pUrl = plugins_url(plugin_basename(dirname(__FILE__)));
|
80 |
|
81 |
$fn = basename($file);
|
82 |
$fnp = gde_splitFilename($fn);
|
@@ -94,7 +95,7 @@ HERE;
|
|
94 |
|
95 |
if ($save == "yes" || $save == "1") {
|
96 |
|
97 |
-
$dlMethod = $
|
98 |
if ($fnp[1] == "PDF") {
|
99 |
if ($dlMethod == "force" or $dlMethod == "force-mask") {
|
100 |
$dlFile = $pUrl;
|
@@ -117,16 +118,16 @@ HERE;
|
|
117 |
$dlFile = $file;
|
118 |
$target = "_self";
|
119 |
}
|
120 |
-
$txt = $
|
121 |
$linkcode .= "<p class=\"gde-text\"><a href=\"$dlFile\" target=\"$target\" class=\"gde-link\">$txt</a></p>";
|
122 |
}
|
123 |
|
124 |
-
if ($
|
125 |
$warn = gde_warnText($pUrl);
|
126 |
$linkcode .= "\n<!--[if gte IE 7]>\n<p class=\"gde-iewarn\">".$warn."</p>\n<![endif]-->\n";
|
127 |
}
|
128 |
|
129 |
-
if ($
|
130 |
$code = str_replace("%A%", $linkcode, $code);
|
131 |
$code = str_replace("%B%", '', $code);
|
132 |
} else {
|
@@ -167,27 +168,81 @@ function gde_options() {
|
|
167 |
add_action('in_admin_footer', 'gde_admin_footer');
|
168 |
}
|
169 |
|
170 |
-
// add additional
|
171 |
$plugin = plugin_basename(__FILE__);
|
172 |
-
function gde_actlinks(
|
173 |
$settings_link = '<a href="options-general.php?page=gviewer.php">Settings</a>';
|
174 |
array_unshift($links, $settings_link);
|
175 |
return $links;
|
176 |
}
|
177 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
178 |
|
179 |
// activate shortcode
|
180 |
add_shortcode('gview', 'gde_gviewer_func');
|
181 |
|
182 |
// display any conflict warnings (admin)
|
183 |
-
if (($
|
184 |
add_action('plugins_loaded', 'gde_conflict_check');
|
185 |
}
|
186 |
|
187 |
// footer credit
|
188 |
function gde_admin_footer() {
|
189 |
-
$
|
190 |
-
printf('%1$s plugin | Version %2$s<br />', $
|
191 |
}
|
192 |
|
193 |
?>
|
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.1
|
9 |
*/
|
10 |
|
11 |
+
$gde_ver = "1.9.1.99";
|
12 |
+
|
13 |
/**
|
14 |
* LICENSE
|
15 |
* This file is part of Google Doc Embedder.
|
32 |
* @author Kevin Davis <kev@tnw.org>
|
33 |
* @copyright Copyright 2009 Kevin Davis
|
34 |
* @license http://www.gnu.org/licenses/gpl.txt GPL 2.0
|
|
|
35 |
* @link http://davismetro.com/gde/
|
36 |
*/
|
37 |
|
38 |
include_once('wpframe.php');
|
39 |
include_once('functions.php');
|
40 |
+
$gdeoptions = get_option('gde_options');
|
41 |
+
$pUrl = plugins_url(plugin_basename(dirname(__FILE__)));
|
42 |
|
43 |
// basic usage: [gview file="http://path.to/file.pdf"]
|
44 |
function gde_gviewer_func($atts) {
|
45 |
|
46 |
// current settings
|
47 |
+
global $gdeoptions, $exts, $pUrl;
|
48 |
|
49 |
extract(shortcode_atts(array(
|
50 |
'file' => '',
|
51 |
+
'save' => $gdeoptions['show_dl'],
|
52 |
'width' => '',
|
53 |
'height' => '',
|
54 |
+
'force' => $gdeoptions['bypass_check']
|
55 |
), $atts));
|
56 |
|
57 |
$width = str_replace("px", "", trim($width));
|
58 |
if (!$width || !preg_match("/^\d+%?$/", $width)) {
|
59 |
+
$width = $gdeoptions['default_width'];
|
60 |
+
if ($gdeoptions['width_type'] == "pc") {
|
61 |
$width .= "%";
|
62 |
}
|
63 |
}
|
64 |
$height = str_replace("px", "", trim($height));
|
65 |
if (!$height || !preg_match("/^\d+%?$/", $height)) {
|
66 |
+
$height = $gdeoptions['default_height'];
|
67 |
+
if ($gdeoptions['height_type'] == "pc") {
|
68 |
$height .= "%";
|
69 |
}
|
70 |
}
|
78 |
$code = "\n<!-- GDE EMBED ERROR: $status -->\n";
|
79 |
} else {
|
80 |
$code = "";
|
|
|
81 |
|
82 |
$fn = basename($file);
|
83 |
$fnp = gde_splitFilename($fn);
|
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") {
|
101 |
$dlFile = $pUrl;
|
118 |
$dlFile = $file;
|
119 |
$target = "_self";
|
120 |
}
|
121 |
+
$txt = $gdeoptions['link_text'];
|
122 |
$linkcode .= "<p class=\"gde-text\"><a href=\"$dlFile\" target=\"$target\" class=\"gde-link\">$txt</a></p>";
|
123 |
}
|
124 |
|
125 |
+
if ($gdeoptions['ie8_warn'] == "yes") {
|
126 |
$warn = gde_warnText($pUrl);
|
127 |
$linkcode .= "\n<!--[if gte IE 7]>\n<p class=\"gde-iewarn\">".$warn."</p>\n<![endif]-->\n";
|
128 |
}
|
129 |
|
130 |
+
if ($gdeoptions['link_pos'] == "above") {
|
131 |
$code = str_replace("%A%", $linkcode, $code);
|
132 |
$code = str_replace("%B%", '', $code);
|
133 |
} else {
|
168 |
add_action('in_admin_footer', 'gde_admin_footer');
|
169 |
}
|
170 |
|
171 |
+
// add additional links, for convenience
|
172 |
$plugin = plugin_basename(__FILE__);
|
173 |
+
function gde_actlinks($links) {
|
174 |
$settings_link = '<a href="options-general.php?page=gviewer.php">Settings</a>';
|
175 |
array_unshift($links, $settings_link);
|
176 |
return $links;
|
177 |
}
|
178 |
+
function gde_metalinks($links, $file) {
|
179 |
+
global $debug;
|
180 |
+
$plugin = plugin_basename(__FILE__);
|
181 |
+
if ($file == $plugin) {
|
182 |
+
$support_link = '<a href="'.GDE_SUPPORT_URL.'">Support</a>';
|
183 |
+
$links[] = $support_link;
|
184 |
+
}
|
185 |
+
return $links;
|
186 |
+
}
|
187 |
+
add_filter("plugin_action_links_$plugin", 'gde_actlinks');
|
188 |
+
add_filter("plugin_row_meta", 'gde_metalinks', 10, 2);
|
189 |
+
|
190 |
+
// check for beta, if enabled
|
191 |
+
function gde_checkforBeta($plugin) {
|
192 |
+
global $gde_ver, $pUrl;
|
193 |
+
|
194 |
+
$pdata = get_plugin_data(__FILE__);
|
195 |
+
if (preg_match('/-dev$/i', $pdata['Version'])) { $isbeta = 1; }
|
196 |
+
|
197 |
+
if (strpos($pUrl.'/gviewer.php', $plugin) !== false) {
|
198 |
+
$vcheck = wp_remote_fopen(GDE_BETA_CHKFILE);
|
199 |
+
if ($vcheck) {
|
200 |
+
$lver = $gde_ver;
|
201 |
+
|
202 |
+
$status = explode('@', $vcheck);
|
203 |
+
$rver = $status[1];
|
204 |
+
$message = $status[3];
|
205 |
+
|
206 |
+
if ($isbeta) {
|
207 |
+
$titleStr = "Updated beta";
|
208 |
+
$msgStr = "A newer beta has been released. Please deactivate the plug-in and install the current version. Thanks for your help!";
|
209 |
+
} else {
|
210 |
+
$titleStr = "Beta";
|
211 |
+
$msgStr = "Please deactivate the plug-in and install the current version if you wish to participate. Otherwise, you can turn off beta version checking in GDE Settings. Testers appreciated!";
|
212 |
+
}
|
213 |
+
$message = str_replace("%msg", $msgStr, $message);
|
214 |
+
|
215 |
+
if ((version_compare(strval($rver), strval($lver), '>') == 1)) {
|
216 |
+
$msg = __("$titleStr version available: ", "gde").'<strong>v'.$rver.'</strong> - '.$message;
|
217 |
+
echo '<td colspan="5" class="plugin-update" style="line-height:1.2em; font-size:11px; padding:1px;"><div style="background:#A2F099;border:1px solid #4FE23F; padding:2px; font-weight:bold;">'.__("$titleStr version available.", "gde").' <a href="javascript:void(0);" onclick="jQuery(\'#gde-beta-msg\').toggle();">'.__("(more info)", "gde").'</a></div><div id="gde-beta-msg" style="display:none; padding:10px; text-align:center;" >'.$msg.'</div></td>';
|
218 |
+
} elseif ($isbeta) {
|
219 |
+
$msg = __("Thank you for running a test version of Google Doc Embedder. You are running the most current beta version. Please give feedback on this version using the "Support" link above. Thanks for your help!", "gde");
|
220 |
+
echo '<td colspan="5" class="plugin-update" style="line-height:1.2em; font-size:11px; padding:1px;"><div style="border:1px solid; padding:2px; font-weight:bold;">'.__("You're running a beta version. Please give feedback.", "gde").' <a href="javascript:void(0);" onclick="jQuery(\'#gde-beta-msg\').toggle();">'.__("(more info)", "gde").'</a></div><div id="gde-beta-msg" style="display:none; padding:10px; text-align:center;" >'.$msg.'</div></td>';
|
221 |
+
} else {
|
222 |
+
return;
|
223 |
+
}
|
224 |
+
} elseif ($isbeta) {
|
225 |
+
$msg = __("Thank you for running a test version of Google Doc Embedder. You are running the most current beta version. Please give feedback on this version using the "Support" link above. Thanks for your help!", "gde");
|
226 |
+
echo '<td colspan="5" class="plugin-update" style="line-height:1.2em; font-size:11px; padding:1px;"><div style="border:1px solid; padding:2px; font-weight:bold;">'.__("You're running a beta version. Please give feedback.", "gde").' <a href="javascript:void(0);" onclick="jQuery(\'#gde-beta-msg\').toggle();">'.__("(more info)", "gde").'</a></div><div id="gde-beta-msg" style="display:none; padding:10px; text-align:center;" >'.$msg.'</div></td>';
|
227 |
+
}
|
228 |
+
}
|
229 |
+
}
|
230 |
+
if ($gdeoptions['suppress_beta'] !== "yes") {
|
231 |
+
add_action('after_plugin_row', 'gde_checkforBeta');
|
232 |
+
}
|
233 |
|
234 |
// activate shortcode
|
235 |
add_shortcode('gview', 'gde_gviewer_func');
|
236 |
|
237 |
// display any conflict warnings (admin)
|
238 |
+
if (($gdeoptions['ignore_conflicts'] !== "yes") && (!isset($_REQUEST['submit']))) {
|
239 |
add_action('plugins_loaded', 'gde_conflict_check');
|
240 |
}
|
241 |
|
242 |
// footer credit
|
243 |
function gde_admin_footer() {
|
244 |
+
$pdata = get_plugin_data(__FILE__);
|
245 |
+
printf('%1$s plugin | Version %2$s<br />', $pdata['Title'], $pdata['Version']);
|
246 |
}
|
247 |
|
248 |
?>
|
options.php
CHANGED
@@ -3,63 +3,70 @@ include_once('wpframe.php');
|
|
3 |
include_once('functions.php');
|
4 |
|
5 |
$ie8_link = GDE_IE8_URL;
|
6 |
-
|
|
|
|
|
7 |
|
8 |
if(isset($_REQUEST['defaults'])) {
|
9 |
|
10 |
$set = gde_init('reset');
|
11 |
-
$
|
12 |
showMessage("Options reset to defaults");
|
13 |
|
14 |
} elseif(isset($_REQUEST['submit'])) {
|
15 |
|
16 |
// change user defaults
|
17 |
if(isset($_POST['show_dl'])) {
|
18 |
-
$
|
19 |
} else {
|
20 |
-
$
|
21 |
}
|
22 |
if(isset($_POST['default_width'])) {
|
23 |
$neww = $_POST['default_width'];
|
24 |
-
if (strlen($neww) > 0) $
|
25 |
}
|
26 |
if(isset($_POST['width_type'])) {
|
27 |
-
$
|
28 |
}
|
29 |
if(isset($_POST['default_height'])) {
|
30 |
$newh = $_POST['default_height'];
|
31 |
-
if (strlen($newh) > 0) $
|
32 |
}
|
33 |
if(isset($_POST['height_type'])) {
|
34 |
-
$
|
35 |
}
|
36 |
if(isset($_POST['link_text'])) {
|
37 |
$newt = $_POST['link_text'];
|
38 |
-
if (strlen(utf8_decode($newt))) $
|
39 |
}
|
40 |
if(isset($_POST['link_pos'])) {
|
41 |
-
$
|
42 |
}
|
43 |
if(isset($_POST['link_func'])) {
|
44 |
-
$
|
45 |
}
|
46 |
if(isset($_POST['ie8_warn'])) {
|
47 |
-
$
|
48 |
} else {
|
49 |
-
$
|
50 |
}
|
51 |
if(isset($_POST['bypass_check'])) {
|
52 |
-
$
|
53 |
} else {
|
54 |
-
$
|
55 |
}
|
56 |
if(isset($_POST['ignore_conflicts'])) {
|
57 |
-
$
|
58 |
} else {
|
59 |
-
$
|
|
|
|
|
|
|
|
|
|
|
60 |
}
|
61 |
|
62 |
-
update_option('gde_options', $
|
63 |
showMessage("Options updated");
|
64 |
}
|
65 |
?>
|
@@ -78,14 +85,14 @@ To override size on individual posts, manually set in the post shortcode using (
|
|
78 |
</tr>
|
79 |
<tr valign="top">
|
80 |
<th scope="row">Default Width</th>
|
81 |
-
<td><input type="text" size="5" name="default_width" value="<?php echo $
|
82 |
<?php gde_showOption('px', 'width_type', t('px')); ?>
|
83 |
<?php gde_showOption('pc', 'width_type', t('%')); ?>
|
84 |
</select></td>
|
85 |
</tr>
|
86 |
<tr valign="top">
|
87 |
<th scope="row">Default Height</th>
|
88 |
-
<td><input type="text" size="5" name="default_height" value="<?php echo $
|
89 |
<?php gde_showOption('px', 'height_type', t('px')); ?>
|
90 |
<?php gde_showOption('pc', 'height_type', t('%')); ?>
|
91 |
</select></td>
|
@@ -99,7 +106,7 @@ To override display setting on an individual post, use <code>save="1"</code> (sh
|
|
99 |
</tr>
|
100 |
<tr valign="top">
|
101 |
<th scope="row">Link Text</th>
|
102 |
-
<td><input type="text" size="50" name="link_text" value="<?php echo $
|
103 |
<em>You can further customize text using these dynamic replacements:</em><br/>
|
104 |
<code>%FN</code> : filename
|
105 |
<code>%FT</code> : file type
|
@@ -125,9 +132,10 @@ To override display setting on an individual post, use <code>save="1"</code> (sh
|
|
125 |
<tr valign="top">
|
126 |
<td colspan="2"><strong><a style="text-decoration:none;" href="javascript:;" onmousedown="if(document.getElementById('advopt').style.display == 'none'){ document.getElementById('advopt').style.display = 'block'; }else{ document.getElementById('advopt').style.display = 'none'; }">[ + ]</a> Advanced Options</strong><br />
|
127 |
<div id="advopt" style="display:none;">
|
128 |
-
<?php gde_showCheck('ie8_warn', t('Show help message to IE8 users (<a href="'.$ie8_link.'" target="_blank">more info</a>)')); ?><br />
|
129 |
<?php gde_showCheck('bypass_check', t('Let Google Doc Viewer handle all errors (for individual files, use <code>force="1"</code>)')); ?><br />
|
130 |
-
<?php gde_showCheck('
|
|
|
|
|
131 |
</div></td>
|
132 |
</tr>
|
133 |
</tr>
|
@@ -145,18 +153,21 @@ To override display setting on an individual post, use <code>save="1"</code> (sh
|
|
145 |
</div>
|
146 |
|
147 |
<?php
|
148 |
-
function gde_showCheck($option, $title) {
|
149 |
-
global $
|
150 |
-
if ($
|
151 |
?>
|
152 |
<input type="checkbox" name="<?php echo $option; ?>" value="1" id="<?php echo $option; ?>"<?php echo $chk; ?> />
|
153 |
<label for="<?php echo $option; ?>"><?php e($title) ?></label>
|
154 |
<?php
|
|
|
|
|
|
|
155 |
}
|
156 |
|
157 |
function gde_showOption($value, $option, $title) {
|
158 |
-
global $
|
159 |
-
if ($
|
160 |
?>
|
161 |
<option value="<?php echo $value; ?>"<?php echo $chk; ?>><?php echo $title; ?></option>
|
162 |
<?php
|
3 |
include_once('functions.php');
|
4 |
|
5 |
$ie8_link = GDE_IE8_URL;
|
6 |
+
$conflict_link = GDE_CONFLICT_URL;
|
7 |
+
$beta_link = GDE_BETA_URL;
|
8 |
+
global $gdeoptions;
|
9 |
|
10 |
if(isset($_REQUEST['defaults'])) {
|
11 |
|
12 |
$set = gde_init('reset');
|
13 |
+
$gdeoptions = get_option('gde_options');
|
14 |
showMessage("Options reset to defaults");
|
15 |
|
16 |
} elseif(isset($_REQUEST['submit'])) {
|
17 |
|
18 |
// change user defaults
|
19 |
if(isset($_POST['show_dl'])) {
|
20 |
+
$gdeoptions['show_dl'] = "yes";
|
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']);
|
27 |
}
|
28 |
if(isset($_POST['width_type'])) {
|
29 |
+
$gdeoptions['width_type'] = $_POST['width_type'];
|
30 |
}
|
31 |
if(isset($_POST['default_height'])) {
|
32 |
$newh = $_POST['default_height'];
|
33 |
+
if (strlen($newh) > 0) $gdeoptions['default_height'] = gde_sanitizeOpt($newh, $_POST['height_type']);
|
34 |
}
|
35 |
if(isset($_POST['height_type'])) {
|
36 |
+
$gdeoptions['height_type'] = $_POST['height_type'];
|
37 |
}
|
38 |
if(isset($_POST['link_text'])) {
|
39 |
$newt = $_POST['link_text'];
|
40 |
+
if (strlen(utf8_decode($newt))) $gdeoptions['link_text'] = $newt;
|
41 |
}
|
42 |
if(isset($_POST['link_pos'])) {
|
43 |
+
$gdeoptions['link_pos'] = $_POST['link_pos'];
|
44 |
}
|
45 |
if(isset($_POST['link_func'])) {
|
46 |
+
$gdeoptions['link_func'] = $_POST['link_func'];
|
47 |
}
|
48 |
if(isset($_POST['ie8_warn'])) {
|
49 |
+
$gdeoptions['ie8_warn'] = "yes";
|
50 |
} else {
|
51 |
+
$gdeoptions['ie8_warn'] = "no";
|
52 |
}
|
53 |
if(isset($_POST['bypass_check'])) {
|
54 |
+
$gdeoptions['bypass_check'] = "yes";
|
55 |
} else {
|
56 |
+
$gdeoptions['bypass_check'] = "no";
|
57 |
}
|
58 |
if(isset($_POST['ignore_conflicts'])) {
|
59 |
+
$gdeoptions['ignore_conflicts'] = "yes";
|
60 |
} else {
|
61 |
+
$gdeoptions['ignore_conflicts'] = "no";
|
62 |
+
}
|
63 |
+
if(isset($_POST['suppress_beta'])) {
|
64 |
+
$gdeoptions['suppress_beta'] = "yes";
|
65 |
+
} else {
|
66 |
+
$gdeoptions['suppress_beta'] = "no";
|
67 |
}
|
68 |
|
69 |
+
update_option('gde_options', $gdeoptions);
|
70 |
showMessage("Options updated");
|
71 |
}
|
72 |
?>
|
85 |
</tr>
|
86 |
<tr valign="top">
|
87 |
<th scope="row">Default Width</th>
|
88 |
+
<td><input type="text" size="5" name="default_width" value="<?php echo $gdeoptions['default_width']; ?>" /> <select name="width_type">
|
89 |
<?php gde_showOption('px', 'width_type', t('px')); ?>
|
90 |
<?php gde_showOption('pc', 'width_type', t('%')); ?>
|
91 |
</select></td>
|
92 |
</tr>
|
93 |
<tr valign="top">
|
94 |
<th scope="row">Default Height</th>
|
95 |
+
<td><input type="text" size="5" name="default_height" value="<?php echo $gdeoptions['default_height']; ?>" /> <select name="height_type">
|
96 |
<?php gde_showOption('px', 'height_type', t('px')); ?>
|
97 |
<?php gde_showOption('pc', 'height_type', t('%')); ?>
|
98 |
</select></td>
|
106 |
</tr>
|
107 |
<tr valign="top">
|
108 |
<th scope="row">Link Text</th>
|
109 |
+
<td><input type="text" size="50" name="link_text" value="<?php echo $gdeoptions['link_text']; ?>" /><br/>
|
110 |
<em>You can further customize text using these dynamic replacements:</em><br/>
|
111 |
<code>%FN</code> : filename
|
112 |
<code>%FT</code> : file type
|
132 |
<tr valign="top">
|
133 |
<td colspan="2"><strong><a style="text-decoration:none;" href="javascript:;" onmousedown="if(document.getElementById('advopt').style.display == 'none'){ document.getElementById('advopt').style.display = 'block'; }else{ document.getElementById('advopt').style.display = 'none'; }">[ + ]</a> Advanced Options</strong><br />
|
134 |
<div id="advopt" style="display:none;">
|
|
|
135 |
<?php gde_showCheck('bypass_check', t('Let Google Doc Viewer handle all errors (for individual files, use <code>force="1"</code>)')); ?><br />
|
136 |
+
<?php gde_showCheck('ie8_warn', t('Show help message to IE8 users'), $ie8_link); ?><br />
|
137 |
+
<?php gde_showCheck('ignore_conflicts', t('Turn off plugin conflict warnings'), $conflict_link); ?><br />
|
138 |
+
<?php gde_showCheck('suppress_beta', t('Turn off beta version notifications'), $beta_link); ?>
|
139 |
</div></td>
|
140 |
</tr>
|
141 |
</tr>
|
153 |
</div>
|
154 |
|
155 |
<?php
|
156 |
+
function gde_showCheck($option, $title, $link = NULL) {
|
157 |
+
global $gdeoptions;
|
158 |
+
if ($gdeoptions[$option] == "yes") { $chk = ' checked="checked"'; }
|
159 |
?>
|
160 |
<input type="checkbox" name="<?php echo $option; ?>" value="1" id="<?php echo $option; ?>"<?php echo $chk; ?> />
|
161 |
<label for="<?php echo $option; ?>"><?php e($title) ?></label>
|
162 |
<?php
|
163 |
+
if ($link) {
|
164 |
+
echo ' (<a href="'.$link.'" target="_blank">info</a>)';
|
165 |
+
}
|
166 |
}
|
167 |
|
168 |
function gde_showOption($value, $option, $title) {
|
169 |
+
global $gdeoptions;
|
170 |
+
if ($gdeoptions[$option] == $value) { $chk = ' selected="yes"'; }
|
171 |
?>
|
172 |
<option value="<?php echo $value; ?>"<?php echo $chk; ?>><?php echo $title; ?></option>
|
173 |
<?php
|
readme.txt
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
Contributors: k3davis
|
3 |
Donate link: http://pledgie.com/campaigns/6048
|
4 |
Tags: pdf, ppt, tiff, powerpoint, google, embed, google docs, document
|
5 |
-
Requires at least: 2.
|
6 |
Tested up to: 2.9-rare
|
7 |
Stable tag: trunk
|
8 |
|
@@ -60,11 +60,17 @@ That's not a question ;) but if you have any particular ideas on further develop
|
|
60 |
|
61 |
== Changelog ==
|
62 |
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
= 1.9 =
|
64 |
* Added: Revealed more troubleshooting options (under "Advanced Options")
|
65 |
* Fixed: No longer relies on cURL for any function
|
66 |
* Changed: Function overhaul for general efficiency and reduced database calls
|
67 |
-
* Removed: WP 2.5 compatibility. Now requires WordPress 2.
|
68 |
|
69 |
= 1.8.2 =
|
70 |
* Fixed: Fatal PHP error if cURL library not active (WAMPServer, etc.)
|
2 |
Contributors: k3davis
|
3 |
Donate link: http://pledgie.com/campaigns/6048
|
4 |
Tags: pdf, ppt, tiff, powerpoint, google, embed, google docs, document
|
5 |
+
Requires at least: 2.8
|
6 |
Tested up to: 2.9-rare
|
7 |
Stable tag: trunk
|
8 |
|
60 |
|
61 |
== Changelog ==
|
62 |
|
63 |
+
= 1.9.1 =
|
64 |
+
* Fixed: Options not saved in some instances due to variable collision (thanks gadgetto)
|
65 |
+
* Fixed: Options not saved when plugin is reactivated
|
66 |
+
* Changed: Default width now 100% (existing setting will be preserved)
|
67 |
+
* Added: Notification of beta versions - <a href="http://davismetro.com/gde/beta-program" target="_blank">more info</a>
|
68 |
+
|
69 |
= 1.9 =
|
70 |
* Added: Revealed more troubleshooting options (under "Advanced Options")
|
71 |
* Fixed: No longer relies on cURL for any function
|
72 |
* Changed: Function overhaul for general efficiency and reduced database calls
|
73 |
+
* Removed: WP 2.5 compatibility. Now requires WordPress 2.8+.
|
74 |
|
75 |
= 1.8.2 =
|
76 |
* Fixed: Fatal PHP error if cURL library not active (WAMPServer, etc.)
|