Google Doc Embedder - Version 1.9.5

Version Description

  • Added: Support for Word documents (DOC, DOCX)
  • Added: Default language option for viewer
  • Added: Revived ability to hide selected viewer toolbar buttons (from 1.7)
  • Changed: IE now supported by "enhanced viewer" proxy option (ie-warn removed)
  • Changed: Improved options organization
  • Fixed: Filenames with spaces wouldn't load
  • Fixed: Suppress beta notification option not honored
Download this release

Release Info

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

Code changes from version 1.9.4 to 1.9.5

Files changed (9) hide show
  1. functions.php +13 -7
  2. gviewer.php +20 -15
  3. help.png +0 -0
  4. ie-warn.txt +0 -1
  5. options.php +186 -41
  6. proxy.php +80 -0
  7. readme.txt +23 -7
  8. screenshot-2.png +0 -0
  9. wpframe.php +0 -51
functions.php CHANGED
@@ -1,8 +1,9 @@
1
  <?php
2
 
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');
@@ -14,12 +15,14 @@ function gde_init($reset = NULL) {
14
  'width_type' => 'pc',
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',
22
- 'ie8_warn' => 'no',
23
  'bypass_check' => 'no',
24
  'ignore_conflicts' => 'no',
25
  'suppress_beta' => 'no'
@@ -172,10 +175,6 @@ function gde_shortUrl($u) {
172
  return wp_remote_fopen('http://tinyurl.com/api-create.php?url='.$u);
173
  }
174
 
175
- function gde_warnText($u) {
176
- return wp_remote_fopen($u."/ie-warn.txt");
177
- }
178
-
179
  function gde_conflict_check() {
180
  global $gde_conflict_list;
181
 
@@ -196,4 +195,11 @@ function gde_admin_warning() {
196
  ";
197
  }
198
 
 
 
 
 
 
 
 
199
  ?>
1
  <?php
2
 
3
  // external urls (help, etc.)
4
+ @define('GDE_VIEWOPT_URL', 'http://davismetro.com/gde/settings/viewer-options/');
5
+ @define('GDE_LINKOPT_URL', 'http://davismetro.com/gde/settings/download-link-options/');
6
+ @define('GDE_ADVOPT_URL', 'http://davismetro.com/gde/settings/advanced-options/');
7
  @define('GDE_SUPPORT_URL', 'http://davismetro.com/gde/contact/');
8
  @define('GDE_BETA_URL', 'http://davismetro.com/gde/beta-program/');
9
  @define('GDE_BETA_CHKFILE', 'http://davismetro.com/gde/beta/gde-beta.chk');
15
  'width_type' => 'pc',
16
  'default_height' => '500',
17
  'height_type' => 'px',
18
+ 'default_lang' => 'en_US',
19
+ 'restrict_tb' => '',
20
  'show_dl' => 'yes',
21
  'restrict_dl' => 'no',
22
  'link_text' => 'Download (%FT, %FS)',
23
  'link_pos' => 'below',
24
  'link_func' => 'default',
25
+ 'disable_proxy' => 'no',
26
  'bypass_check' => 'no',
27
  'ignore_conflicts' => 'no',
28
  'suppress_beta' => 'no'
175
  return wp_remote_fopen('http://tinyurl.com/api-create.php?url='.$u);
176
  }
177
 
 
 
 
 
178
  function gde_conflict_check() {
179
  global $gde_conflict_list;
180
 
195
  ";
196
  }
197
 
198
+ function gde_t($message) {
199
+ return __($message, basename(dirname(__FILE__)));
200
+ }
201
+
202
+ function gde_e($message) {
203
+ _e($message, basename(dirname(__FILE__)));
204
+ }
205
  ?>
gviewer.php CHANGED
@@ -3,12 +3,12 @@
3
  /*
4
  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.4
9
  */
10
 
11
- $gde_ver = "1.9.4.99";
12
 
13
  /**
14
  * LICENSE
@@ -30,12 +30,11 @@ $gde_ver = "1.9.4.99";
30
  *
31
  * @package google-document-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__)));
@@ -51,9 +50,15 @@ function gde_gviewer_func($atts) {
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'];
@@ -70,7 +75,7 @@ function gde_gviewer_func($atts) {
70
  }
71
 
72
  // supported file types - list acceptable extensions separated by |
73
- $exts = "pdf|ppt|pps|tif|tiff";
74
 
75
  // check link for validity
76
  $status = gde_validTests($file, $force);
@@ -90,7 +95,12 @@ function gde_gviewer_func($atts) {
90
  %B%
91
  HERE;
92
 
93
- $lnk = "http://docs.google.com/viewer?url=".urlencode($file)."&embedded=true";
 
 
 
 
 
94
  $linkcode = "";
95
 
96
  get_currentuserinfo();
@@ -128,11 +138,6 @@ HERE;
128
  $txt = $gdeoptions['link_text'];
129
  $linkcode .= "<p class=\"gde-text\"><a href=\"$dlFile\" target=\"$target\" class=\"gde-link\">$txt</a></p>";
130
  }
131
-
132
- if ($gdeoptions['ie8_warn'] == "yes") {
133
- $warn = gde_warnText($pUrl);
134
- $linkcode .= "\n<!--[if gte IE 7]>\n<p class=\"gde-iewarn\">".$warn."</p>\n<![endif]-->\n";
135
- }
136
 
137
  if ($gdeoptions['link_pos'] == "above") {
138
  $code = str_replace("%A%", $linkcode, $code);
@@ -165,11 +170,11 @@ function gde_activate() {
165
  // add an option page
166
  add_action('admin_menu', 'gde_option_page');
167
  function gde_option_page() {
168
- add_options_page(t('GDE Settings'), t('GDE Settings'), 'administrator', basename(__FILE__), 'gde_options');
169
  }
170
  function gde_options() {
171
  if ( function_exists('current_user_can') && !current_user_can('manage_options') ) die(t('An error occurred.'));
172
- if (! user_can_access_admin_page()) wp_die( t('You do not have sufficient permissions to access this page') );
173
 
174
  require(ABSPATH. '/wp-content/plugins/google-document-embedder/options.php');
175
  add_action('in_admin_footer', 'gde_admin_footer');
@@ -196,7 +201,7 @@ add_filter("plugin_row_meta", 'gde_metalinks', 10, 2);
196
 
197
  // check for beta, if enabled
198
  function gde_checkforBeta($plugin) {
199
- global $gde_ver, $pUrl;
200
 
201
  $pdata = get_plugin_data(__FILE__);
202
  if (preg_match('/-dev$/i', $pdata['Version'])) { $isbeta = 1; }
3
  /*
4
  Plugin Name: Google Doc Embedder
5
  Plugin URI: http://davismetro.com/gde/
6
+ Description: Lets you embed Word Documents, 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.5
9
  */
10
 
11
+ $gde_ver = "1.9.5.98";
12
 
13
  /**
14
  * LICENSE
30
  *
31
  * @package google-document-embedder
32
  * @author Kevin Davis <kev@tnw.org>
33
+ * @copyright Copyright 2010 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('functions.php');
39
  $gdeoptions = get_option('gde_options');
40
  $pUrl = plugins_url(plugin_basename(dirname(__FILE__)));
50
  'save' => $gdeoptions['show_dl'],
51
  'width' => '',
52
  'height' => '',
53
+ 'lang' => $gdeoptions['default_lang'],
54
  'force' => $gdeoptions['bypass_check']
55
  ), $atts));
56
 
57
+ // translate nasty filenames with spaces
58
+ if (strpos($file, " ")) {
59
+ $file = str_replace(" ", "%20", $file);
60
+ }
61
+
62
  $width = str_replace("px", "", trim($width));
63
  if (!$width || !preg_match("/^\d+%?$/", $width)) {
64
  $width = $gdeoptions['default_width'];
75
  }
76
 
77
  // supported file types - list acceptable extensions separated by |
78
+ $exts = "doc|docx|pdf|ppt|pps|tif|tiff";
79
 
80
  // check link for validity
81
  $status = gde_validTests($file, $force);
95
  %B%
96
  HERE;
97
 
98
+ if ($gdeoptions['disable_proxy'] == "no") {
99
+ $gdet = $gdeoptions['restrict_tb'];
100
+ $lnk = $pUrl."/proxy.php?url=".urlencode($file)."&hl=".$lang."&gdet=".$gdet."&embedded=true";
101
+ } else {
102
+ $lnk = "http://docs.google.com/viewer?url=".urlencode($file)."&hl=".$lang."&embedded=true";
103
+ }
104
  $linkcode = "";
105
 
106
  get_currentuserinfo();
138
  $txt = $gdeoptions['link_text'];
139
  $linkcode .= "<p class=\"gde-text\"><a href=\"$dlFile\" target=\"$target\" class=\"gde-link\">$txt</a></p>";
140
  }
 
 
 
 
 
141
 
142
  if ($gdeoptions['link_pos'] == "above") {
143
  $code = str_replace("%A%", $linkcode, $code);
170
  // add an option page
171
  add_action('admin_menu', 'gde_option_page');
172
  function gde_option_page() {
173
+ add_options_page(gde_t('GDE Settings'), gde_t('GDE Settings'), 'administrator', basename(__FILE__), 'gde_options');
174
  }
175
  function gde_options() {
176
  if ( function_exists('current_user_can') && !current_user_can('manage_options') ) die(t('An error occurred.'));
177
+ if (! user_can_access_admin_page()) wp_die( gde_t('You do not have sufficient permissions to access this page') );
178
 
179
  require(ABSPATH. '/wp-content/plugins/google-document-embedder/options.php');
180
  add_action('in_admin_footer', 'gde_admin_footer');
201
 
202
  // check for beta, if enabled
203
  function gde_checkforBeta($plugin) {
204
+ global $gde_ver, $pUrl, $gdeoptions;
205
 
206
  $pdata = get_plugin_data(__FILE__);
207
  if (preg_match('/-dev$/i', $pdata['Version'])) { $isbeta = 1; }
help.png ADDED
Binary file
ie-warn.txt DELETED
@@ -1 +0,0 @@
1
- IE User: If you're having trouble viewing this document, click the right most button on the viewer toolbar ("Open in a New Window").
 
options.php CHANGED
@@ -1,17 +1,14 @@
1
- <?php
2
- include_once('wpframe.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
 
@@ -40,6 +37,14 @@ if(isset($_REQUEST['defaults'])) {
40
  if(isset($_POST['height_type'])) {
41
  $gdeoptions['height_type'] = $_POST['height_type'];
42
  }
 
 
 
 
 
 
 
 
43
  if(isset($_POST['link_text'])) {
44
  $newt = $_POST['link_text'];
45
  if (strlen(utf8_decode($newt))) $gdeoptions['link_text'] = $newt;
@@ -50,10 +55,8 @@ if(isset($_REQUEST['defaults'])) {
50
  if(isset($_POST['link_func'])) {
51
  $gdeoptions['link_func'] = $_POST['link_func'];
52
  }
53
- if(isset($_POST['ie8_warn'])) {
54
- $gdeoptions['ie8_warn'] = "yes";
55
- } else {
56
- $gdeoptions['ie8_warn'] = "no";
57
  }
58
  if(isset($_POST['bypass_check'])) {
59
  $gdeoptions['bypass_check'] = "yes";
@@ -72,7 +75,7 @@ if(isset($_REQUEST['defaults'])) {
72
  }
73
 
74
  update_option('gde_options', $gdeoptions);
75
- showMessage("Options updated");
76
  }
77
  ?>
78
  <div class="wrap">
@@ -83,32 +86,132 @@ echo "<h2>".__('Google Doc Embedder Settings')."</h2>";
83
  <form action="" method="post">
84
  <?php wp_nonce_field('update-options'); ?>
85
 
86
- <table class="form-table">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
87
  <tr valign="top">
88
- <td colspan="2"><strong>Global Viewer Options</strong><br/>
89
- To override size on individual posts, manually set in the post shortcode using (for example) <code>height="400"</code> (px) or <code>width="80%"</code>.</td>
 
 
 
 
90
  </tr>
91
  <tr valign="top">
92
- <th scope="row">Default Width</th>
93
- <td><input type="text" size="5" name="default_width" value="<?php echo $gdeoptions['default_width']; ?>" /> <select name="width_type">
94
- <?php gde_showOption('px', 'width_type', t('px')); ?>
95
- <?php gde_showOption('pc', 'width_type', t('%')); ?>
 
 
 
 
96
  </select></td>
97
  </tr>
98
  <tr valign="top">
99
- <th scope="row">Default Height</th>
100
- <td><input type="text" size="5" name="default_height" value="<?php echo $gdeoptions['default_height']; ?>" /> <select name="height_type">
101
- <?php gde_showOption('px', 'height_type', t('px')); ?>
102
- <?php gde_showOption('pc', 'height_type', t('%')); ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
103
  </select></td>
104
  </tr>
 
 
 
105
  <tr valign="top">
106
- <td colspan="2"><strong>Download Link Options</strong><br/>
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>
@@ -121,37 +224,47 @@ To override display setting on an individual post, use <code>save="1"</code> (sh
121
  <tr valign="top">
122
  <th scope="row">Link Position</th>
123
  <td><select name="link_pos">
124
- <?php gde_showOption('above', 'link_pos', t('Above Viewer')); ?>
125
- <?php gde_showOption('below', 'link_pos', t('Below Viewer')); ?>
126
  </select>
127
  </td>
128
  </tr>
129
  <r valign="top">
130
  <th scope="row">Link Behavior</th>
131
  <td><select name="link_func">
132
- <?php gde_showOption('default', 'link_func', t('Browser Default')); ?>
133
- <?php gde_showOption('force', 'link_func', t('Force Download')); ?>
134
- <?php gde_showOption('force-mask', 'link_func', t('Force Download (Mask URL)')); ?>
135
  </select>
136
  </td>
137
  </tr>
138
  <tr valign="top">
139
- <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 />
140
- <div id="advopt" style="display:none;">
141
- <?php gde_showCheck('bypass_check', t('Let Google Doc Viewer handle all errors (for individual files, use <code>force="1"</code>)')); ?><br />
142
- <?php gde_showCheck('ie8_warn', t('Show help message to IE8 users'), $ie8_link); ?><br />
143
- <?php gde_showCheck('ignore_conflicts', t('Turn off plugin conflict warnings'), $conflict_link); ?><br />
144
- <?php gde_showCheck('suppress_beta', t('Turn off beta version notifications'), $beta_link); ?>
145
  </div></td>
146
  </tr>
147
  </tr>
148
  </table>
149
- <p class="submit" style="padding-bottom:0;">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
150
  <input type="hidden" id="user-id" name="user_ID" value="<?php echo (int) $user_ID ?>" />
151
  <span id="autosave"></span>
152
- <input class="button-primary" type="submit" name="submit" value="<?php e('Save Options') ?>" />
153
  &nbsp;&nbsp;&nbsp;
154
- <input class="button-secondary" type="submit" name="defaults" value="<?php e('Reset to Defaults') ?>" onClick="javascript:return confirm('Are you sure you want to reset all settings to defaults?')" />
155
  </p>
156
 
157
  </form>
@@ -159,18 +272,41 @@ To override display setting on an individual post, use <code>save="1"</code> (sh
159
  </div>
160
 
161
  <?php
 
 
 
 
 
 
 
 
 
 
162
  function gde_showCheck($option, $title, $link = NULL) {
163
  global $gdeoptions;
164
  if ($gdeoptions[$option] == "yes") { $chk = ' checked="checked"'; }
165
  ?>
166
  <input type="checkbox" name="<?php echo $option; ?>" value="1" id="<?php echo $option; ?>"<?php echo $chk; ?> />
167
- <label for="<?php echo $option; ?>"><?php e($title) ?></label>
168
  <?php
169
  if ($link) {
170
  echo ' (<a href="'.$link.'" target="_blank">info</a>)';
171
  }
172
  }
173
 
 
 
 
 
 
 
 
 
 
 
 
 
 
174
  function gde_showOption($value, $option, $title) {
175
  global $gdeoptions;
176
  if ($gdeoptions[$option] == $value) { $chk = ' selected="yes"'; }
@@ -178,4 +314,13 @@ function gde_showOption($value, $option, $title) {
178
  <option value="<?php echo $value; ?>"<?php echo $chk; ?>><?php echo $title; ?></option>
179
  <?php
180
  }
 
 
 
 
 
 
 
 
 
181
  ?>
1
+ <?php
 
2
  include_once('functions.php');
3
 
 
 
 
4
  global $gdeoptions;
5
+ $himg = plugins_url(plugin_basename(dirname(__FILE__))).'/help.png';
6
 
7
  if(isset($_REQUEST['defaults'])) {
8
 
9
  $set = gde_init('reset');
10
  $gdeoptions = get_option('gde_options');
11
+ gde_showMessage("Options reset to defaults");
12
 
13
  } elseif(isset($_REQUEST['submit'])) {
14
 
37
  if(isset($_POST['height_type'])) {
38
  $gdeoptions['height_type'] = $_POST['height_type'];
39
  }
40
+ if(isset($_POST['default_lang'])) {
41
+ $gdeoptions['default_lang'] = $_POST['default_lang'];
42
+ }
43
+ if(isset($_POST['gdet_i'])) { $newgdet .= "i"; }
44
+ if(isset($_POST['gdet_p'])) { $newgdet .= "p"; }
45
+ if(isset($_POST['gdet_z'])) { $newgdet .= "z"; }
46
+ if(isset($_POST['gdet_n'])) { $newgdet .= "n"; }
47
+ $gdeoptions['restrict_tb'] = $newgdet;
48
  if(isset($_POST['link_text'])) {
49
  $newt = $_POST['link_text'];
50
  if (strlen(utf8_decode($newt))) $gdeoptions['link_text'] = $newt;
55
  if(isset($_POST['link_func'])) {
56
  $gdeoptions['link_func'] = $_POST['link_func'];
57
  }
58
+ if(isset($_POST['disable_proxy'])) {
59
+ $gdeoptions['disable_proxy'] = $_POST['disable_proxy'];
 
 
60
  }
61
  if(isset($_POST['bypass_check'])) {
62
  $gdeoptions['bypass_check'] = "yes";
75
  }
76
 
77
  update_option('gde_options', $gdeoptions);
78
+ gde_showMessage("Options updated");
79
  }
80
  ?>
81
  <div class="wrap">
86
  <form action="" method="post">
87
  <?php wp_nonce_field('update-options'); ?>
88
 
89
+ <div id="poststuff" class="metabox-holder has-right-sidebar">
90
+ <!--div class="inner-sidebar">
91
+ <div id="side-sortables" class="meta-box-sortabless ui-sortable" style="position:relative;">
92
+
93
+
94
+ <div id="sm_pnres" class="postbox">
95
+ <h3 class="hndle"><span>About Plugin</span></h3>
96
+
97
+ <div class="inside">
98
+ Beta version
99
+ </div>
100
+ </div>
101
+ </div>
102
+ </div-->
103
+ <div class="has-sidebar sm-padded" >
104
+
105
+ <div id="post-body-content" class="has-sidebar-content">
106
+
107
+ <div class="meta-box-sortabless">
108
+ <div id="gde_vieweroptions" class="postbox">
109
+
110
+ <h3 class="hndle"><span>Viewer Options</span></h3>
111
+ <div class="inside">
112
+
113
+ <table class="form-table">
114
  <tr valign="top">
115
+ <th scope="row">Viewer Selection</th>
116
+ <td><div style="float:right;"><a href="<?php echo GDE_VIEWOPT_URL; ?>" target="_blank" title="Help"><img src="<?php echo $himg; ?>"></a></div><?php gde_showRadio('no', 'dp1', 'disable_proxy', gde_t('Enhanced Viewer')); ?><br />
117
+ <em>Use this option to improve IE compatibility and enable toolbar customization.</em><br/>
118
+ <?php gde_showRadio('yes', 'dp2', 'disable_proxy', gde_t('Google Standard Viewer')); ?><br />
119
+ <em>Use this option if you experience problems with the Enhanced Viewer.</em>
120
+ </td>
121
  </tr>
122
  <tr valign="top">
123
+ <th scope="row">Default Size</th>
124
+ <td><strong>Width </strong><input type="text" size="5" name="default_width" value="<?php echo $gdeoptions['default_width']; ?>" /> <select name="width_type">
125
+ <?php gde_showOption('px', 'width_type', gde_t('px')); ?>
126
+ <?php gde_showOption('pc', 'width_type', gde_t('%')); ?>
127
+ </select> &nbsp;&nbsp;&nbsp;&nbsp;
128
+ <strong>Height </strong><input type="text" size="5" name="default_height" value="<?php echo $gdeoptions['default_height']; ?>" /> <select name="height_type">
129
+ <?php gde_showOption('px', 'height_type', gde_t('px')); ?>
130
+ <?php gde_showOption('pc', 'height_type', gde_t('%')); ?>
131
  </select></td>
132
  </tr>
133
  <tr valign="top">
134
+ <th scope="row">Default Language</th>
135
+ <td><select name="default_lang">
136
+
137
+ <?php gde_showOption('cs', 'default_lang', gde_t('&#268;esky')); ?>
138
+ <?php gde_showOption('sr', 'default_lang', gde_t('&#x0421;&#x0440;&#x043F;&#x0441;&#x043A;&#x0438;')); ?>
139
+ <?php gde_showOption('uk', 'default_lang', gde_t('&#x0423;&#x043A;&#x0440;&#x0430;&#x0457;&#x043D;&#x0441;&#x044C;&#x043A;&#x0430;')); ?>
140
+ <?php gde_showOption('el', 'default_lang', gde_t('&Epsilon;&lambda;&lambda;&eta;&nu;&iota;&kappa;ά')); ?>
141
+ <?php gde_showOption('ar', 'default_lang', gde_t('Arabic')); ?>
142
+ <?php gde_showOption('in', 'default_lang', gde_t('Bahasa Indonesia')); ?>
143
+ <?php gde_showOption('ca', 'default_lang', gde_t('Catal&agrave;')); ?>
144
+ <?php gde_showOption('da', 'default_lang', gde_t('Dansk')); ?>
145
+ <?php gde_showOption('de', 'default_lang', gde_t('Deutsch')); ?>
146
+ <?php gde_showOption('en_GB', 'default_lang', gde_t('English (UK)')); ?>
147
+ <?php gde_showOption('en_US', 'default_lang', gde_t('English (US)')); ?>
148
+ <?php gde_showOption('es', 'default_lang', gde_t('Espa&ntilde;ol')); ?>
149
+ <?php gde_showOption('fil', 'default_lang', gde_t('Filipino')); ?>
150
+ <?php gde_showOption('fr', 'default_lang', gde_t('Fran&ccedil;ais')); ?>
151
+ <?php gde_showOption('iw', 'default_lang', gde_t('Hebrew')); ?>
152
+ <?php gde_showOption('hr', 'default_lang', gde_t('Hrvatski')); ?>
153
+ <?php gde_showOption('it', 'default_lang', gde_t('Italiano')); ?>
154
+ <?php gde_showOption('lv', 'default_lang', gde_t('Latvie&scaron;u')); ?>
155
+ <?php gde_showOption('lt', 'default_lang', gde_t('Lietuvių')); ?>
156
+ <?php gde_showOption('hu', 'default_lang', gde_t('Magyar')); ?>
157
+ <?php gde_showOption('nl', 'default_lang', gde_t('Nederlands')); ?>
158
+ <?php gde_showOption('no', 'default_lang', gde_t('Norsk (bokmål)')); ?>
159
+ <?php gde_showOption('pl', 'default_lang', gde_t('Polski')); ?>
160
+ <?php gde_showOption('pt_BR', 'default_lang', gde_t('Portugu&ecirc;s (Brasil)')); ?>
161
+ <?php gde_showOption('pt_PT', 'default_lang', gde_t('Portugu&ecirc;s (Portugal)')); ?>
162
+ <?php gde_showOption('ro', 'default_lang', gde_t('Rom&acirc;n&#x0103;')); ?>
163
+ <?php gde_showOption('sl', 'default_lang', gde_t('Sloven&#x0161;&#x010D;ina')); ?>
164
+ <?php gde_showOption('sk', 'default_lang', gde_t('Slovensk&yacute;')); ?>
165
+ <?php gde_showOption('fi', 'default_lang', gde_t('Suomi')); ?>
166
+ <?php gde_showOption('sv', 'default_lang', gde_t('Svenska')); ?>
167
+ <?php gde_showOption('tr', 'default_lang', gde_t('T&uuml;rk&ccedil;e')); ?>
168
+ <?php gde_showOption('vi', 'default_lang', gde_t('Tiếng Việt')); ?>
169
+ <?php gde_showOption('ru', 'default_lang', gde_t('Русский')); ?>
170
+ <?php gde_showOption('bg', 'default_lang', gde_t('български')); ?>
171
+ <?php gde_showOption('mr', 'default_lang', gde_t('मराठी')); ?>
172
+ <?php gde_showOption('hi', 'default_lang', gde_t('हिन्दी')); ?>
173
+ <?php gde_showOption('bn', 'default_lang', gde_t('বাংলা')); ?>
174
+ <?php gde_showOption('gu', 'default_lang', gde_t('ગુજરાતી')); ?>
175
+ <?php gde_showOption('or', 'default_lang', gde_t('ଓଡିଆ')); ?>
176
+ <?php gde_showOption('ta', 'default_lang', gde_t('தமிழ்')); ?>
177
+ <?php gde_showOption('te', 'default_lang', gde_t('తెలుగు')); ?>
178
+ <?php gde_showOption('kn', 'default_lang', gde_t('ಕನ್ನಡ')); ?>
179
+ <?php gde_showOption('ml', 'default_lang', gde_t('മലയാളം')); ?>
180
+ <?php gde_showOption('th', 'default_lang', gde_t('ภาษาไทย')); ?>
181
+ <?php gde_showOption('zh_CN', 'default_lang', gde_t('中文(简体)')); ?>
182
+ <?php gde_showOption('zh_TW', 'default_lang', gde_t('中文(繁體)')); ?>
183
+ <?php gde_showOption('ja', 'default_lang', gde_t('日本語')); ?>
184
+ <?php gde_showOption('ko', 'default_lang', gde_t('한국어')); ?>
185
+
186
  </select></td>
187
  </tr>
188
+ <?php
189
+ if ($gdeoptions['disable_proxy'] == "no") {
190
+ ?>
191
  <tr valign="top">
192
+ <th scope="row">Hide Toolbar Buttons</th>
193
+ <td><?php gde_showCheckTb('gdet_i', gde_t('Google Logo')); ?>
194
+ <?php gde_showCheckTb('gdet_p', gde_t('Single/Double Page View')); ?>
195
+ <?php gde_showCheckTb('gdet_z', gde_t('Zoom In/Out')); ?>
196
+ <?php gde_showCheckTb('gdet_n', gde_t('Open in New Window')); ?>
197
+ </td>
198
  </tr>
199
+ <? } ?>
200
+ </table>
201
+
202
+ </div>
203
+ </div>
204
+ </div>
205
+
206
+
207
+ <div id="gde_linkoptions" class="postbox">
208
+
209
+ <h3 class="hndle"><span>Download Link Options</span></h3>
210
+ <div class="inside">
211
+ <table class="form-table">
212
  <tr valign="top">
213
+ <td colspan="2"><div style="float:right;"><a href="<?php echo GDE_LINKOPT_URL; ?>" target="_blank" title="Help"><img src="<?php echo $himg; ?>"></a></div><?php gde_showCheck('show_dl', gde_t('Display the download link by default')); ?><br/>
214
+ <?php gde_showCheck('restrict_dl', gde_t('Only display download link to logged in users')); ?></td>
215
  </tr>
216
  <tr valign="top">
217
  <th scope="row">Link Text</th>
224
  <tr valign="top">
225
  <th scope="row">Link Position</th>
226
  <td><select name="link_pos">
227
+ <?php gde_showOption('above', 'link_pos', gde_t('Above Viewer')); ?>
228
+ <?php gde_showOption('below', 'link_pos', gde_t('Below Viewer')); ?>
229
  </select>
230
  </td>
231
  </tr>
232
  <r valign="top">
233
  <th scope="row">Link Behavior</th>
234
  <td><select name="link_func">
235
+ <?php gde_showOption('default', 'link_func', gde_t('Browser Default')); ?>
236
+ <?php gde_showOption('force', 'link_func', gde_t('Force Download')); ?>
237
+ <?php gde_showOption('force-mask', 'link_func', gde_t('Force Download (Mask URL)')); ?>
238
  </select>
239
  </td>
240
  </tr>
241
  <tr valign="top">
242
+ <td colspan="2">
 
 
 
 
 
243
  </div></td>
244
  </tr>
245
  </tr>
246
  </table>
247
+ </div>
248
+ </div>
249
+ </div>
250
+ </div>
251
+ </div>
252
+
253
+ <p class="submit" style="padding-bottom:10px;">
254
+ <div style="font-size:11px;margin-top:-40px;padding-bottom:20px;padding-left:5px;">
255
+ <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> <a href="<?php echo GDE_ADVOPT_URL; ?>" target="_blank"><img src="<?php echo $himg; ?>"></a><br />
256
+ <div id="advopt" style="display:none;">
257
+ <?php gde_showCheck('bypass_check', gde_t('Disable internal error checking')); ?><br />
258
+ <?php gde_showCheck('ignore_conflicts', gde_t('Disable plugin conflict warnings')); ?><br />
259
+ <?php gde_showCheck('suppress_beta', gde_t('Disable beta version notifications')); ?>
260
+ </div>
261
+ </div>
262
+
263
  <input type="hidden" id="user-id" name="user_ID" value="<?php echo (int) $user_ID ?>" />
264
  <span id="autosave"></span>
265
+ <input class="button-primary" type="submit" name="submit" value="<?php gde_e('Save Options') ?>" />
266
  &nbsp;&nbsp;&nbsp;
267
+ <input class="button-secondary" type="submit" name="defaults" value="<?php gde_e('Reset to Defaults') ?>" onClick="javascript:return confirm('Are you sure you want to reset all settings to defaults?')" />
268
  </p>
269
 
270
  </form>
272
  </div>
273
 
274
  <?php
275
+
276
+ function gde_showRadio($value, $id, $option, $title) {
277
+ global $gdeoptions;
278
+ if ($gdeoptions[$option] == $value) { $chk = ' checked="checked"'; }
279
+ ?>
280
+ <input type="radio" name="<?php echo $option; ?>" value="<?php echo $value; ?>" id="<?php echo $id; ?>"<?php echo $chk; ?> />
281
+ <label for="<?php echo $id; ?>"><strong><?php gde_e($title) ?></strong></label>
282
+ <?php
283
+ }
284
+
285
  function gde_showCheck($option, $title, $link = NULL) {
286
  global $gdeoptions;
287
  if ($gdeoptions[$option] == "yes") { $chk = ' checked="checked"'; }
288
  ?>
289
  <input type="checkbox" name="<?php echo $option; ?>" value="1" id="<?php echo $option; ?>"<?php echo $chk; ?> />
290
+ <label for="<?php echo $option; ?>"><?php gde_e($title) ?></label>
291
  <?php
292
  if ($link) {
293
  echo ' (<a href="'.$link.'" target="_blank">info</a>)';
294
  }
295
  }
296
 
297
+ function gde_showCheckTb($option, $title) {
298
+ global $gdeoptions;
299
+ $gdet = $gdeoptions['restrict_tb'];
300
+
301
+ $option = str_replace("gdet_", "", $option);
302
+
303
+ if (strstr($gdet, $option) !== false) { $chk = ' checked="checked"'; }
304
+ ?>
305
+ <input type="checkbox" name="gdet_<?php echo $option; ?>" value="1" id="gdet_<?php echo $option; ?>"<?php echo $chk; ?> />
306
+ <label for="gdet_<?php echo $option; ?>"><?php gde_e($title) ?></label>
307
+ <?php
308
+ }
309
+
310
  function gde_showOption($value, $option, $title) {
311
  global $gdeoptions;
312
  if ($gdeoptions[$option] == $value) { $chk = ' selected="yes"'; }
314
  <option value="<?php echo $value; ?>"<?php echo $chk; ?>><?php echo $title; ?></option>
315
  <?php
316
  }
317
+
318
+ function gde_showMessage($message, $type='updated') {
319
+ if($type == 'updated') $class = 'updated fade';
320
+ elseif($type == 'error') $class = 'updated error';
321
+ else $class = $type;
322
+
323
+ print '<div id="message" class="'.$class.'"><p>' . __($message, basename(dirname(__FILE__))) . '</p></div>';
324
+ }
325
+
326
  ?>
proxy.php ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ # This proxy code is a bypass for an existing flaw in Google Docs Viewer that breaks the functionality
4
+ # for IE users. If you do not wish to use this code, you can disable it in GDE Advanced Options. Note
5
+ # that viewer toolbar customization options depend on this proxy workaround remaining enabled.
6
+ #
7
+ # The problem this code addresses is discussed at length on Google's Help Forum:
8
+ # http://www.google.com/support/forum/p/Google+Docs/thread?tid=22d92671afd5b9b7&hl=en
9
+ #
10
+ # This code is based on the work of Peter Chen. For more information, see:
11
+ # http://peterchenadded.herobo.com/gview/
12
+
13
+ if (isset($_GET['embedded'])) {
14
+ // get the src page, change relative to absolute and don't remove 'chan' param in get requests
15
+ $code = file_get_contents("http://docs.google.com/gview?" . $_SERVER['QUERY_STRING']);
16
+
17
+ $search = array("/gview/images", "gview/resources_gview/client/js");
18
+ $replace = array("http://docs.google.com/gview/images", "?jsfile=gview/resources_gview/client/js");
19
+
20
+ if (isset($_GET['gdet'])) {
21
+ $gdet = $_GET['gdet'];
22
+
23
+ # hide google icon (i)
24
+ if (strstr($gdet, 'i') !== false) {
25
+ $search[] = ".goog-logo-small {";
26
+ $replace[] = ".goog-logo-small { display: none !important;";
27
+ }
28
+ # hide single/double page view (p)
29
+ if (strstr($gdet, 'p') !== false) {
30
+ $search[] = ".controlbar-two-up-image {";
31
+ $replace[] = ".controlbar-two-up-image { display: none !important;";
32
+ $search[] = ".controlbar-one-up-image {";
33
+ $replace[] = ".controlbar-one-up-image { display: none !important;";
34
+ }
35
+ # hide zoom in/out (z)
36
+ if (strstr($gdet, 'z') !== false) {
37
+ $search[] = ".controlbar-minus-image {";
38
+ $replace[] = ".controlbar-minus-image { display: none !important;";
39
+ $search[] = ".controlbar-plus-image {";
40
+ $replace[] = ".controlbar-plus-image { display: none !important;";
41
+ }
42
+ # hide open in new window (n)
43
+ if (strstr($gdet, 'n') !== false) {
44
+ $search[] = ".controlbar-open-in-viewer-image {";
45
+ $replace[] = ".controlbar-open-in-viewer-image { display: none !important;";
46
+ }
47
+ }
48
+
49
+ $code = str_replace($search, $replace, $code);
50
+
51
+ header('Content-type: text/html');
52
+ echo $code;
53
+
54
+ } else if (isset($_GET['a']) && $_GET['a'] == 'gt') {
55
+ // get text coordinates file, can not redirect because of same origin policy
56
+ $code = file_get_contents("http://docs.google.com/gview?" . $_SERVER['QUERY_STRING']);
57
+ header('Content-type: text/xml; charset=UTF-8');
58
+ echo $code;
59
+
60
+ } else if (isset($_GET['a']) && $_GET['a'] == 'bi') {
61
+ // redirect to images
62
+ header("Location: http://docs.google.com/gview?" . $_SERVER['QUERY_STRING']);
63
+ header('Content-type: image/png');
64
+
65
+ } else if (isset($_GET['jsfile'])) {
66
+ // proxy javascript files and replace navigator.cookieEnabled with false
67
+ $code = file_get_contents("http://docs.google.com/" . $_GET['jsfile']);
68
+
69
+ $search = array("navigator.cookieEnabled");
70
+ $replace = array("false");
71
+ $code = str_replace($search, $replace, $code);
72
+
73
+ header('Content-type: text/javascript');
74
+ echo $code;
75
+
76
+ } else {
77
+ // everything else, of which there isn't!
78
+ header("Location: http://docs.google.com/gview?" . $_SERVER['QUERY_STRING']);
79
+ }
80
+ ?>
readme.txt CHANGED
@@ -1,20 +1,25 @@
1
  === Google Doc Embedder ===
2
  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: 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).
10
 
11
  == Description ==
12
 
13
- Google Doc Embedder 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).
14
 
15
- Similar to services like Scribd, Google Doc Embedder will allow you to embed a PDF, PowerPoint (PPT, PPS), or TIFF file directly into your page or post, not requiring the user to have Adobe Reader, PowerPoint, or other software 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.
 
 
 
16
 
17
- Note: While previously the functionality of this plug-in relied upon an undocumented feature of the Google Docs Viewer, this feature is now "official" and presumably reliable in the long term. However, use of this plug-in now does imply your agreement with Google's published <a href="http://docs.google.com/viewer/TOS?hl=en" target="_blank">Terms of Service</a>.
 
 
18
 
19
  == Installation ==
20
 
@@ -29,7 +34,7 @@ Go to "GDE Settings" (under "Settings" in the admin panel) to change defaults, o
29
  == Frequently Asked Questions ==
30
 
31
  = What file types can be embedded? =
32
- This plug-in can embed PDF, PowerPoint (PPT), or TIFF files only. The file to embed must first be publicly 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.
33
 
34
  = How do I embed a file in my page or post? =
35
  Use the custom shortcode `[gview]` to embed the file, as shown:
@@ -44,6 +49,8 @@ Optional attributes:
44
  * `width=` : To override the default width of the viewer, enter a new width value - e.g., "400" (px) or "80%"
45
  * `height=` : To override the default height of the viewer, enter a new height value - e.g., "400" (px) or "80%"
46
 
 
 
47
  = Will it embed files that are password-protected or stored in protected folders/sites? =
48
  Most likely, no. If your file requires a login to view - such as being saved in a password-protected directory, or behind a firewall (on your intranet, etc.), the viewer will probably not be able to access the file. For files stored on Google Docs, the viewer will prompt you to log in first, which most users presumably couldn't do. This is what is meant above, that the document should be "publicly available." Please save the file in a publicly accessible location for best results.
49
 
@@ -55,11 +62,20 @@ That's not a question ;) but if you have any particular ideas on further develop
55
 
56
  == Screenshots ==
57
 
58
- 1. Appearance of embedded viewer
59
  2. Settings page
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
1
  === Google Doc Embedder ===
2
  Contributors: k3davis
3
  Donate link: http://pledgie.com/campaigns/6048
4
+ Tags: doc, docx, pdf, pps, ppt, tiff, word, powerpoint, google, embed, google docs
5
  Requires at least: 2.8
6
  Tested up to: 3.0
7
  Stable tag: trunk
8
 
9
+ Lets you embed Word documents (DOC, DOCX), PDF files, PowerPoint presentations (PPT, PPS), and TIFF images in a web page using the Google Docs Viewer (no Flash or PDF browser plug-ins required).
10
 
11
  == Description ==
12
 
13
+ Google Doc Embedder lets you embed several types of files into your WordPress pages using the Google Docs Viewer - allowing inline viewing (and optional downloading) of the following file types, with no Flash or PDF browser plug-ins required:
14
 
15
+ * DOC/DOCX
16
+ * PDF
17
+ * PPT/PPS
18
+ * TIFF
19
 
20
+ Similar to services like Scribd, Google Doc Embedder will allow you to embed these files directly into your page or post, not requiring the user to have Microsoft Word, Adobe Reader, PowerPoint, or other software 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 publicly accessible on your site or the internet.
21
+
22
+ Note: Uuse of this plug-in now implies your agreement with Google's published <a href="http://docs.google.com/viewer/TOS?hl=en" target="_blank">Terms of Service</a>.
23
 
24
  == Installation ==
25
 
34
  == Frequently Asked Questions ==
35
 
36
  = What file types can be embedded? =
37
+ This plug-in currently can embed Microsoft Word (DOC/DOCX), PDF, PowerPoint (PPT/PPS), or TIFF files only. The file to embed must first be publicly 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.
38
 
39
  = How do I embed a file in my page or post? =
40
  Use the custom shortcode `[gview]` to embed the file, as shown:
49
  * `width=` : To override the default width of the viewer, enter a new width value - e.g., "400" (px) or "80%"
50
  * `height=` : To override the default height of the viewer, enter a new height value - e.g., "400" (px) or "80%"
51
 
52
+ For a list of all available attributes, see <a href="http://www.davismetro.com/gde/usage/">Usage</a>.
53
+
54
  = Will it embed files that are password-protected or stored in protected folders/sites? =
55
  Most likely, no. If your file requires a login to view - such as being saved in a password-protected directory, or behind a firewall (on your intranet, etc.), the viewer will probably not be able to access the file. For files stored on Google Docs, the viewer will prompt you to log in first, which most users presumably couldn't do. This is what is meant above, that the document should be "publicly available." Please save the file in a publicly accessible location for best results.
56
 
62
 
63
  == Screenshots ==
64
 
65
+ 1. Default appearance of embedded viewer
66
  2. Settings page
67
 
68
  == Changelog ==
69
 
70
+ = 1.9.5 =
71
+ * Added: Support for Word documents (DOC, DOCX)
72
+ * Added: Default language option for viewer
73
+ * Added: Revived ability to hide selected viewer toolbar buttons (from 1.7)
74
+ * Changed: IE now supported by "enhanced viewer" proxy option (ie-warn removed)
75
+ * Changed: Improved options organization
76
+ * Fixed: Filenames with spaces wouldn't load
77
+ * Fixed: Suppress beta notification option not honored
78
+
79
  = 1.9.4 =
80
  * Added: Option to restrict download link to logged in users (thanks kris)
81
  * Added: Compatibility with WP 3.0
screenshot-2.png CHANGED
Binary file
wpframe.php DELETED
@@ -1,51 +0,0 @@
1
- <?php
2
- /**
3
- * WPFrame
4
- * A simple framework to make WP Plugin development easier.
5
- */
6
-
7
- $GLOBALS['wpframe_home'] = get_option('home');
8
- $GLOBALS['wpframe_wordpress'] = $GLOBALS['wpframe_siteurl'] = get_option('siteurl');
9
- if(!$GLOBALS['wpframe_wordpress']) $GLOBALS['wpframe_wordpress'] = $GLOBALS['wpframe_home'];
10
- $GLOBALS['wpframe_plugin_name'] = basename(dirname(__FILE__));
11
- $GLOBALS['wpframe_plugin_folder'] = $GLOBALS['wpframe_siteurl'] . '/wp-content/plugins/' . $GLOBALS['wpframe_plugin_name'];
12
- //$GLOBALS['wpframe_plugin_data'] = get_plugin_data($GLOBALS['wpframe_plugin_name'] . '.php');
13
- //* :DEBUG: */ $GLOBALS['wpdb']->show_errors();
14
-
15
- if(!function_exists('stopDirectCall')) { //Make sure multiple plugins can be created using WPFrame
16
-
17
- /// Need to register a page to use it in a plugin in WP2.8.1+. THIS IS A HACK.
18
- function wpf_register_pages($pages, $folder) {
19
- foreach($pages as $p) wpf_register_page($folder . DIRECTORY_SEPARATOR . $p);
20
- }
21
- function wpf_register_page($file) {
22
- global $_registered_pages;
23
- $hookname = get_plugin_page_hookname($file, '' );
24
- $_registered_pages[$hookname] = true;
25
- }
26
-
27
- /// Make sure that the user don't call this file directly - forces the use of the WP interface
28
- function stopDirectCall($file) {
29
- if(preg_match('#' . basename($file) . '#', $_SERVER['PHP_SELF'])) die('Don\'t call this page directly.'); // Stop direct call
30
- }
31
-
32
- /// Shows a message in the admin interface of Wordpress
33
- function showMessage($message, $type='updated') {
34
- if($type == 'updated') $class = 'updated fade';
35
- elseif($type == 'error') $class = 'updated error';
36
- else $class = $type;
37
-
38
- print '<div id="message" class="'.$class.'"><p>' . __($message, $GLOBALS['wpframe_plugin_name']) . '</p></div>';
39
- }
40
-
41
- /// Globalization function - Returns the transilated string
42
- function t($message) {
43
- return __($message, $GLOBALS['wpframe_plugin_name']);
44
- }
45
-
46
- /// Globalization function - prints the transilated string
47
- function e($message) {
48
- _e($message, $GLOBALS['wpframe_plugin_name']);
49
- }
50
-
51
- }