Google Doc Embedder - Version 2.5.20

Version Description

Download this release

Release Info

Developer danlester
Plugin Icon wp plugin Google Doc Embedder
Version 2.5.20
Comparing to
See all releases

Code changes from version 2.5.18 to 2.5.20

Files changed (48) hide show
  1. functions-admin.php +46 -35
  2. functions.php +14 -14
  3. gviewer.php +17 -17
  4. img/index.php +1 -1
  5. js/editor_plugin.js +3 -3
  6. js/gde-quicktags.js +1 -1
  7. js/index.php +1 -1
  8. js/tb-newwin.php +3 -3
  9. languages/{gde-cs_CZ.mo → google-document-embedder-cs_CZ.mo} +0 -0
  10. languages/{gde-cs_CZ.po → google-document-embedder-cs_CZ.po} +0 -0
  11. languages/{gde-en_US.mo → google-document-embedder-en_US.mo} +0 -0
  12. languages/{gde-en_US.po → google-document-embedder-en_US.po} +0 -0
  13. languages/{gde-es_ES.mo → google-document-embedder-es_ES.mo} +0 -0
  14. languages/{gde-es_ES.po → google-document-embedder-es_ES.po} +0 -0
  15. languages/{gde-fr_FR.mo → google-document-embedder-fr_FR.mo} +0 -0
  16. languages/{gde-fr_FR.po → google-document-embedder-fr_FR.po} +0 -0
  17. languages/{gde-hu_HU.mo → google-document-embedder-hu_HU.mo} +0 -0
  18. languages/{gde-hu_HU.po → google-document-embedder-hu_HU.po} +0 -0
  19. languages/{gde-it_IT.mo → google-document-embedder-it_IT.mo} +0 -0
  20. languages/{gde-it_IT.po → google-document-embedder-it_IT.po} +0 -0
  21. languages/{gde-nl_NL.mo → google-document-embedder-nl_NL.mo} +0 -0
  22. languages/{gde-nl_NL.po → google-document-embedder-nl_NL.po} +0 -0
  23. languages/{gde-ru_RU.mo → google-document-embedder-ru_RU.mo} +0 -0
  24. languages/{gde-ru_RU.po → google-document-embedder-ru_RU.po} +0 -0
  25. languages/{gde-tr_TR.mo → google-document-embedder-tr_TR.mo} +0 -0
  26. languages/{gde-tr_TR.po → google-document-embedder-tr_TR.po} +0 -0
  27. languages/{gde-uk.mo → google-document-embedder-uk.mo} +0 -0
  28. languages/{gde-uk.po → google-document-embedder-uk.po} +0 -0
  29. languages/{gde.pot → google-document-embedder.pot} +0 -0
  30. libs/lib-bootstrap.php +1 -1
  31. libs/lib-eddialog.php +23 -23
  32. libs/lib-exts.php +1 -1
  33. libs/lib-formsubmit.php +1 -1
  34. libs/lib-langs.php +1 -1
  35. libs/lib-mobilecheck.php +1 -1
  36. libs/lib-profile.php +64 -64
  37. libs/lib-secure.php +1 -1
  38. libs/lib-service.php +1 -1
  39. libs/lib-setup.php +6 -6
  40. libs/tab-advanced.php +38 -38
  41. libs/tab-general.php +1 -1
  42. libs/tab-profiles.php +18 -18
  43. libs/tab-support.php +25 -25
  44. load.php +6 -6
  45. options.php +44 -48
  46. readme.txt +25 -19
  47. uninstall.php +1 -1
  48. ~view.php +0 -452
functions-admin.php CHANGED
@@ -263,7 +263,7 @@ function gde_overwrite_profile( $sourceid ) {
263
  * @return void
264
  */
265
  function gde_import( $data ) {
266
- $label = __('Import', 'gde');
267
  $status = array();
268
 
269
  echo '
@@ -274,67 +274,67 @@ function gde_import( $data ) {
274
 
275
  if ( isset( $data['profiles'] ) || isset( $data['profiles'] ) ) {
276
  // full import
277
- echo "<p>" . __('Performing full import...', 'gde') . "</p>\n";
278
 
279
  // profiles import
280
  if ( isset( $data['profiles'] ) ) {
281
- echo "<p>" . __('Importing profiles', 'gde');
282
 
283
  $success = gde_import_profiles( $data['profiles'] );
284
  $total = count( $data['profiles'] );
285
  echo " ($success/$total)... ";
286
  if ( $success == $total ) {
287
- echo __('done', 'gde') . ".</p>\n";
288
  } else {
289
  $status[] = "fail";
290
- echo "<strong>" . __('failed', 'gde') . ".</strong></p>\n";
291
  }
292
  }
293
 
294
  // settings import
295
  if ( isset( $data['settings'] ) ) {
296
- echo "<p>" . __('Importing settings', 'gde') . "... ";
297
  if ( ! gde_import_settings( $data['settings'] ) ) {
298
  $status[] = "fail";
299
- echo "<strong>" . __('failed', 'gde') . ".</strong></p>\n";
300
  } else {
301
- echo __('done', 'gde') . ".</p>\n";
302
  }
303
  }
304
  } elseif ( isset( $data[0]['profile_id'] ) ) {
305
  // profile import
306
- echo "<p>" . __('Importing profiles', 'gde');
307
 
308
  $success = gde_import_profiles( $data );
309
  $total = count( $data );
310
  echo " ($success/$total)... ";
311
  if ( $success == $total ) {
312
- echo __('done', 'gde') . ".</p>\n";
313
  } else {
314
  $status[] = "fail";
315
- echo "<strong>" . __('failed', 'gde') . ".</strong></p>\n";
316
  }
317
  } elseif ( isset( $data['ed_disable'] ) ) {
318
  // settings import
319
- echo "<p>" . __('Importing settings... ', 'gde');
320
 
321
  if ( ! gde_import_settings( $data ) ) {
322
  $status[] = "fail";
323
- echo "<strong>" . __('failed', 'gde') . ".</strong></p>\n";
324
  } else {
325
- echo __('done', 'gde') . ".</p>\n";
326
  }
327
  } else {
328
- echo "<p>" . __('Please select a valid export file to import.', 'gde') . "</p>\n";
329
  }
330
 
331
  if ( in_array( 'fail', $status ) ) {
332
- echo "<p>" . __('All or part of the import failed. See above for information.', 'gde') . "</p>\n";
333
  } else {
334
- echo "<p>" . __('Import completed successfully.', 'gde') . "</p>\n";
335
  }
336
 
337
- echo "<p><a href=''>" . __('Return to GDE Settings', 'gde') . "</a></p>\n";
338
  echo "</div>\n";
339
  }
340
 
@@ -410,7 +410,7 @@ function gde_get_locale() {
410
  function gde_option_page() {
411
  global $gde_settings_page, $gdeoptions;
412
 
413
- $gde_settings_page = add_options_page( 'GDE '.__('Settings', 'gde'), 'GDE '.__('Settings', 'gde'), 'manage_options', 'gde-settings', 'gde_options' );
414
 
415
  // enable custom styles and settings jQuery
416
  add_action( 'admin_print_styles', 'gde_admin_custom_css' );
@@ -419,7 +419,7 @@ function gde_option_page() {
419
 
420
  function gde_options() {
421
  if (! current_user_can('manage_options') ) wp_die('You don\'t have access to this page.');
422
- if (! user_can_access_admin_page()) wp_die( __('You do not have sufficient permissions to access this page', 'gde') );
423
 
424
  require( GDE_PLUGIN_DIR . 'options.php' );
425
  add_action('in_admin_footer', 'gde_admin_footer');
@@ -429,7 +429,7 @@ function gde_options() {
429
  function gde_site_option_page() {
430
  global $gde_global_page;
431
 
432
- $gde_global_page = add_submenu_page( 'settings.php', 'GDE '.__('Settings', 'gde'), 'GDE '.__('Settings', 'gde'), 'manage_network_options', basename(__FILE__), 'gde_site_options' );
433
 
434
  // enable custom styles and settings jQuery
435
  //add_action( 'admin_print_styles', 'gde_admin_custom_css' );
@@ -438,7 +438,7 @@ function gde_site_option_page() {
438
 
439
  function gde_site_options() {
440
  //if ( function_exists('current_user_can') && !current_user_can('manage_options') ) wp_die('You don\'t have access to this page.');
441
- //if (! user_can_access_admin_page()) wp_die( __('You do not have sufficient permissions to access this page', 'gde') );
442
 
443
  require( GDE_PLUGIN_DIR . 'site-options.php' );
444
  add_action( 'in_admin_footer', 'gde_admin_footer' );
@@ -533,8 +533,8 @@ function gde_admin_custom_css( $hook ) {
533
  function gde_admin_footer() {
534
  global $pdata;
535
 
536
- $plugin_str = __('plugin', 'gde');
537
- $version_str = __('Version', 'gde');
538
  printf( '%1$s %2$s | %3$s %4$s<br />', $pdata['Title'], $plugin_str, $version_str, $pdata['Version'] );
539
  }
540
 
@@ -545,7 +545,7 @@ function gde_show_msg( $message, $error = false ) {
545
 
546
  // add additional links, for convenience
547
  function gde_actlinks( $links ) {
548
- $settings_link = '<a href="options-general.php?page=gde-settings">' . __('Settings', 'gde') . '</a>';
549
  array_unshift( $links, $settings_link );
550
  return $links;
551
  }
@@ -569,14 +569,14 @@ function gde_admin_custom_js( $hook ) {
569
  // internal use
570
  'gde_url' => GDE_PLUGIN_URL,
571
  // profiles tab
572
- 'delete' => __('This profile will be permanently deleted.', 'gde') . "\n\n" . __('Are you sure?', 'gde'),
573
- 'default' => __('Settings for this profile will overwrite the default profile.', 'gde') . "\n\n" . __('Are you sure?', 'gde'),
574
- 'reset' => __('Your profile list will be reset to its original state. All changes will be lost.', 'gde') . "\n\n" . __('Are you sure?', 'gde'),
575
  // advanced tab
576
- 'badimport' => __('Please select a valid export file to import.', 'gde'),
577
- 'warnimport' => __('Any settings or duplicate profile names in this import will overwrite the current values.', 'gde') . "\n\n" . __('Are you sure?', 'gde'),
578
  // support tab
579
- 'baddebug' => __('Please include a shortcode or message to request support.', 'gde')
580
  )
581
  );
582
  }
@@ -593,9 +593,20 @@ function gde_admin_custom_js( $hook ) {
593
  */
594
  function gde_media_insert( $html, $id, $attachment ) {
595
  global $gdeoptions;
 
 
 
 
 
 
 
 
 
 
 
596
 
597
- if ( gde_valid_type( $attachment['url'] ) && $gdeoptions['ed_embed_sc'] == "yes" ) {
598
- return '[gview file="' . $attachment['url'] . '"]';
599
  } else {
600
  return $html;
601
  }
@@ -712,7 +723,7 @@ function gde_warn_on_plugin_page( $plugin_file ) {
712
  }
713
 
714
  if ( gde_is_beta() ) {
715
- $message[] = __('You are running a pre-release version of Google Doc Embedder. Please watch this space for important updates.', 'gde');
716
  } else {
717
  $message = array();
718
  }
@@ -759,4 +770,4 @@ function gde_log_available() {
759
  return $log;
760
  }
761
 
762
- ?>
263
  * @return void
264
  */
265
  function gde_import( $data ) {
266
+ $label = __('Import', 'google-document-embedder');
267
  $status = array();
268
 
269
  echo '
274
 
275
  if ( isset( $data['profiles'] ) || isset( $data['profiles'] ) ) {
276
  // full import
277
+ echo "<p>" . __('Performing full import...', 'google-document-embedder') . "</p>\n";
278
 
279
  // profiles import
280
  if ( isset( $data['profiles'] ) ) {
281
+ echo "<p>" . __('Importing profiles', 'google-document-embedder');
282
 
283
  $success = gde_import_profiles( $data['profiles'] );
284
  $total = count( $data['profiles'] );
285
  echo " ($success/$total)... ";
286
  if ( $success == $total ) {
287
+ echo __('done', 'google-document-embedder') . ".</p>\n";
288
  } else {
289
  $status[] = "fail";
290
+ echo "<strong>" . __('failed', 'google-document-embedder') . ".</strong></p>\n";
291
  }
292
  }
293
 
294
  // settings import
295
  if ( isset( $data['settings'] ) ) {
296
+ echo "<p>" . __('Importing settings', 'google-document-embedder') . "... ";
297
  if ( ! gde_import_settings( $data['settings'] ) ) {
298
  $status[] = "fail";
299
+ echo "<strong>" . __('failed', 'google-document-embedder') . ".</strong></p>\n";
300
  } else {
301
+ echo __('done', 'google-document-embedder') . ".</p>\n";
302
  }
303
  }
304
  } elseif ( isset( $data[0]['profile_id'] ) ) {
305
  // profile import
306
+ echo "<p>" . __('Importing profiles', 'google-document-embedder');
307
 
308
  $success = gde_import_profiles( $data );
309
  $total = count( $data );
310
  echo " ($success/$total)... ";
311
  if ( $success == $total ) {
312
+ echo __('done', 'google-document-embedder') . ".</p>\n";
313
  } else {
314
  $status[] = "fail";
315
+ echo "<strong>" . __('failed', 'google-document-embedder') . ".</strong></p>\n";
316
  }
317
  } elseif ( isset( $data['ed_disable'] ) ) {
318
  // settings import
319
+ echo "<p>" . __('Importing settings... ', 'google-document-embedder');
320
 
321
  if ( ! gde_import_settings( $data ) ) {
322
  $status[] = "fail";
323
+ echo "<strong>" . __('failed', 'google-document-embedder') . ".</strong></p>\n";
324
  } else {
325
+ echo __('done', 'google-document-embedder') . ".</p>\n";
326
  }
327
  } else {
328
+ echo "<p>" . __('Please select a valid export file to import.', 'google-document-embedder') . "</p>\n";
329
  }
330
 
331
  if ( in_array( 'fail', $status ) ) {
332
+ echo "<p>" . __('All or part of the import failed. See above for information.', 'google-document-embedder') . "</p>\n";
333
  } else {
334
+ echo "<p>" . __('Import completed successfully.', 'google-document-embedder') . "</p>\n";
335
  }
336
 
337
+ echo "<p><a href=''>" . __('Return to GDE Settings', 'google-document-embedder') . "</a></p>\n";
338
  echo "</div>\n";
339
  }
340
 
410
  function gde_option_page() {
411
  global $gde_settings_page, $gdeoptions;
412
 
413
+ $gde_settings_page = add_options_page( 'GDE '.__('Settings', 'google-document-embedder'), 'GDE '.__('Settings', 'google-document-embedder'), 'manage_options', 'gde-settings', 'gde_options' );
414
 
415
  // enable custom styles and settings jQuery
416
  add_action( 'admin_print_styles', 'gde_admin_custom_css' );
419
 
420
  function gde_options() {
421
  if (! current_user_can('manage_options') ) wp_die('You don\'t have access to this page.');
422
+ if (! user_can_access_admin_page()) wp_die( __('You do not have sufficient permissions to access this page', 'google-document-embedder') );
423
 
424
  require( GDE_PLUGIN_DIR . 'options.php' );
425
  add_action('in_admin_footer', 'gde_admin_footer');
429
  function gde_site_option_page() {
430
  global $gde_global_page;
431
 
432
+ $gde_global_page = add_submenu_page( 'settings.php', 'GDE '.__('Settings', 'google-document-embedder'), 'GDE '.__('Settings', 'google-document-embedder'), 'manage_network_options', basename(__FILE__), 'gde_site_options' );
433
 
434
  // enable custom styles and settings jQuery
435
  //add_action( 'admin_print_styles', 'gde_admin_custom_css' );
438
 
439
  function gde_site_options() {
440
  //if ( function_exists('current_user_can') && !current_user_can('manage_options') ) wp_die('You don\'t have access to this page.');
441
+ //if (! user_can_access_admin_page()) wp_die( __('You do not have sufficient permissions to access this page', 'google-document-embedder') );
442
 
443
  require( GDE_PLUGIN_DIR . 'site-options.php' );
444
  add_action( 'in_admin_footer', 'gde_admin_footer' );
533
  function gde_admin_footer() {
534
  global $pdata;
535
 
536
+ $plugin_str = __('plugin', 'google-document-embedder');
537
+ $version_str = __('Version', 'google-document-embedder');
538
  printf( '%1$s %2$s | %3$s %4$s<br />', $pdata['Title'], $plugin_str, $version_str, $pdata['Version'] );
539
  }
540
 
545
 
546
  // add additional links, for convenience
547
  function gde_actlinks( $links ) {
548
+ $settings_link = '<a href="options-general.php?page=gde-settings">' . __('Settings', 'google-document-embedder') . '</a>';
549
  array_unshift( $links, $settings_link );
550
  return $links;
551
  }
569
  // internal use
570
  'gde_url' => GDE_PLUGIN_URL,
571
  // profiles tab
572
+ 'delete' => __('This profile will be permanently deleted.', 'google-document-embedder') . "\n\n" . __('Are you sure?', 'google-document-embedder'),
573
+ 'default' => __('Settings for this profile will overwrite the default profile.', 'google-document-embedder') . "\n\n" . __('Are you sure?', 'google-document-embedder'),
574
+ 'reset' => __('Your profile list will be reset to its original state. All changes will be lost.', 'google-document-embedder') . "\n\n" . __('Are you sure?', 'google-document-embedder'),
575
  // advanced tab
576
+ 'badimport' => __('Please select a valid export file to import.', 'google-document-embedder'),
577
+ 'warnimport' => __('Any settings or duplicate profile names in this import will overwrite the current values.', 'google-document-embedder') . "\n\n" . __('Are you sure?', 'google-document-embedder'),
578
  // support tab
579
+ 'baddebug' => __('Please include a shortcode or message to request support.', 'google-document-embedder')
580
  )
581
  );
582
  }
593
  */
594
  function gde_media_insert( $html, $id, $attachment ) {
595
  global $gdeoptions;
596
+
597
+ $gdoc_url = '';
598
+ if (isset($attachment['url'])) {
599
+ $gdoc_url = $attachment['url'];
600
+ }
601
+ elseif ($id > 0) {
602
+ $post = get_post($id);
603
+ if ($post) {
604
+ $gdoc_url = wp_get_attachment_url($id);
605
+ }
606
+ }
607
 
608
+ if ($gdoc_url != '' && gde_valid_type( $gdoc_url ) && $gdeoptions['ed_embed_sc'] == "yes" ) {
609
+ return '[gview file="' . $gdoc_url . '"]';
610
  } else {
611
  return $html;
612
  }
723
  }
724
 
725
  if ( gde_is_beta() ) {
726
+ $message[] = __('You are running a pre-release version of Google Doc Embedder. Please watch this space for important updates.', 'google-document-embedder');
727
  } else {
728
  $message = array();
729
  }
770
  return $log;
771
  }
772
 
773
+ ?>
functions.php CHANGED
@@ -18,10 +18,10 @@ if ( ! defined( 'ABSPATH' ) ) { exit; }
18
  @define( 'GDE_PLUGIN_URL', trailingslashit( plugin_dir_url( __FILE__ ) ) );
19
 
20
  // help links
21
- @define( 'GDE_STDOPT_URL', 'http://www.davistribe.org/gde/settings/viewer-options/' );
22
- @define( 'GDE_ENHOPT_URL', 'http://www.davistribe.org/gde/settings/enhanced-options/' );
23
- @define( 'GDE_PROOPT_URL', 'http://www.davistribe.org/gde/settings/viewer-profiles/' );
24
- @define( 'GDE_ADVOPT_URL', 'http://www.davistribe.org/gde/settings/advanced-options/' );
25
  @define( 'GDE_FORUM_URL', 'http://wordpress.org/support/plugin/google-document-embedder' );
26
  @define( 'GDE_WP_URL', 'http://wordpress.org/extend/plugins/google-document-embedder/' );
27
 
@@ -100,11 +100,11 @@ function gde_get_profiles( $ident = '', $include_id = true, $include_desc = fals
100
  function gde_validate_file( $file = NULL, $force ) {
101
 
102
  // error messages
103
- $nofile = __('File not specified, check shortcode syntax', 'gde');
104
- $badlink = __('Requested URL is invalid', 'gde');
105
- $badtype = __('Unsupported File Type', 'gde') . " (%e)";
106
- $unktype = __('Unable to determine file type from URL', 'gde');
107
- $notfound = __('Error retrieving file - if necessary turn off error checking', 'gde') . " (%e)";
108
 
109
  if ( ! $file ) {
110
  return $nofile;
@@ -228,9 +228,9 @@ function gde_split_filename( $filename ) {
228
 
229
  function gde_format_bytes( $bytes, $precision = 2 ) {
230
  if ( ! is_numeric( $bytes ) || $bytes < 1 ) {
231
- return __('Unknown', 'gde');
232
  } else {
233
- $units = array( 'B', 'KB', __('MB', 'gde'), 'GB', 'TB' );
234
 
235
  $bytes = max( $bytes, 0 );
236
  $pow = floor( ( $bytes ? log( $bytes ) : 0 ) / log( 1024 ) );
@@ -366,7 +366,7 @@ function gde_ga_event( $file ) {
366
  $label = "this.href";
367
  } else {
368
  $category = "'" . addslashes( $gdeoptions['ga_category'] ) . "'";
369
- $action = "'" . __('Download', 'gde') . "'";
370
  if ( $gdeoptions['ga_label'] == "url" ) {
371
  $label = "this.href";
372
  } else {
@@ -505,7 +505,7 @@ function gde_save_error() {
505
  function gde_show_error( $status ) {
506
  global $gdeoptions;
507
 
508
- $error = "GDE " . __('Error', 'gde') . ": " . $status;
509
  if ( $gdeoptions['error_display'] == "no" ) {
510
  $code = "\n<!-- $error -->\n";
511
  } else {
@@ -557,4 +557,4 @@ function gde_debug_tables( $table = array('gde_profiles', 'gde_secure'), $verbos
557
  }
558
  }
559
 
560
- ?>
18
  @define( 'GDE_PLUGIN_URL', trailingslashit( plugin_dir_url( __FILE__ ) ) );
19
 
20
  // help links
21
+ @define( 'GDE_STDOPT_URL', 'https://wordpress.org/plugins/google-document-embedder/' );
22
+ @define( 'GDE_ENHOPT_URL', 'https://wordpress.org/plugins/google-document-embedder/' );
23
+ @define( 'GDE_PROOPT_URL', 'https://wordpress.org/plugins/google-document-embedder/' );
24
+ @define( 'GDE_ADVOPT_URL', 'https://wordpress.org/plugins/google-document-embedder/' );
25
  @define( 'GDE_FORUM_URL', 'http://wordpress.org/support/plugin/google-document-embedder' );
26
  @define( 'GDE_WP_URL', 'http://wordpress.org/extend/plugins/google-document-embedder/' );
27
 
100
  function gde_validate_file( $file = NULL, $force ) {
101
 
102
  // error messages
103
+ $nofile = __('File not specified, check shortcode syntax', 'google-document-embedder');
104
+ $badlink = __('Requested URL is invalid', 'google-document-embedder');
105
+ $badtype = __('Unsupported File Type', 'google-document-embedder') . " (%e)";
106
+ $unktype = __('Unable to determine file type from URL', 'google-document-embedder');
107
+ $notfound = __('Error retrieving file - if necessary turn off error checking', 'google-document-embedder') . " (%e)";
108
 
109
  if ( ! $file ) {
110
  return $nofile;
228
 
229
  function gde_format_bytes( $bytes, $precision = 2 ) {
230
  if ( ! is_numeric( $bytes ) || $bytes < 1 ) {
231
+ return __('Unknown', 'google-document-embedder');
232
  } else {
233
+ $units = array( 'B', 'KB', __('MB', 'google-document-embedder'), 'GB', 'TB' );
234
 
235
  $bytes = max( $bytes, 0 );
236
  $pow = floor( ( $bytes ? log( $bytes ) : 0 ) / log( 1024 ) );
366
  $label = "this.href";
367
  } else {
368
  $category = "'" . addslashes( $gdeoptions['ga_category'] ) . "'";
369
+ $action = "'" . __('Download', 'google-document-embedder') . "'";
370
  if ( $gdeoptions['ga_label'] == "url" ) {
371
  $label = "this.href";
372
  } else {
505
  function gde_show_error( $status ) {
506
  global $gdeoptions;
507
 
508
+ $error = "GDE " . __('Error', 'google-document-embedder') . ": " . $status;
509
  if ( $gdeoptions['error_display'] == "no" ) {
510
  $code = "\n<!-- $error -->\n";
511
  } else {
557
  }
558
  }
559
 
560
+ ?>
gviewer.php CHANGED
@@ -2,13 +2,13 @@
2
 
3
  /*
4
  Plugin Name: Google Doc Embedder
5
- Plugin URI: http://www.davistribe.org/gde/
6
  Description: Lets you embed PDF, MS Office, TIFF, and many other file types in a web page using the Google Docs Viewer (no Flash or PDF browser plug-ins required).
7
- Author: Kevin Davis
8
- Author URI: http://www.davistribe.org/
9
- Text Domain: gde
10
  Domain Path: /languages/
11
- Version: 2.5.18
12
  License: GPLv2
13
  */
14
 
@@ -34,11 +34,11 @@ License: GPLv2
34
  * @author Kevin Davis <wpp@tnw.org>
35
  * @copyright Copyright 2014 Kevin Davis
36
  * @license http://www.gnu.org/licenses/gpl.txt GPL 2.0
37
- * @link http://www.davistribe.org/gde/
38
  */
39
 
40
  // boring init junk
41
- $gde_ver = "2.5.17.98";
42
  $gde_db_ver = "1.2"; // update also in gde_activate()
43
 
44
  require_once( plugin_dir_path( __FILE__ ) . 'functions.php' );
@@ -75,7 +75,7 @@ function gde_do_shortcode( $atts ) {
75
  // check profile table health
76
  if ( ! $healthy ) {
77
  delete_option('gde_db_version');
78
- return gde_show_error( __('Unable to load profile settings', 'gde') );
79
  }
80
 
81
  // handle global setting overrides - not active in this release
@@ -106,7 +106,7 @@ function gde_do_shortcode( $atts ) {
106
  if ( ! $profile = gde_get_profiles( $term ) ) {
107
  gde_dx_log("Loading default profile instead");
108
  if ( ! $profile = gde_get_profiles( 1 ) ) {
109
- return gde_show_error( __('Unable to load requested profile.', 'gde') );
110
  } else {
111
  $pid = 1;
112
  }
@@ -118,7 +118,7 @@ function gde_do_shortcode( $atts ) {
118
  if ( ! $profile = gde_get_profiles( strtolower( $term ) ) ) {
119
  gde_dx_log("Loading default profile instead");
120
  if ( ! $profile = gde_get_profiles( 1 ) ) {
121
- return gde_show_error( __('Unable to load requested profile.', 'gde') );
122
  } else {
123
  $pid = 1;
124
  }
@@ -177,7 +177,7 @@ function gde_do_shortcode( $atts ) {
177
 
178
  // check for missing required field
179
  if ( ! $file ) {
180
- return gde_show_error( __('File not specified, check shortcode syntax', 'gde') );
181
  }
182
 
183
  // file validation
@@ -234,7 +234,7 @@ function gde_do_shortcode( $atts ) {
234
 
235
  // check for failed secure doc
236
  if ( empty( $links[0] ) && empty( $links[1] ) ) {
237
- $code = gde_show_error( __('Unable to secure document', 'gde') );
238
  } else {
239
 
240
  // which viewer?
@@ -302,7 +302,7 @@ function gde_do_shortcode( $atts ) {
302
 
303
  // link text
304
  if ( empty( $profile['link_text'] ) ) {
305
- $profile['link_text'] = __('Download', 'gde');
306
  }
307
 
308
  $dltext = str_replace( "%FILE", $fn, $profile['link_text'] );
@@ -351,7 +351,7 @@ if ( is_admin() ) {
351
  }
352
 
353
  // add local settings page
354
- add_action( 'admin_menu', 'gde_option_page' );
355
 
356
  //if ( is_multisite() ) {
357
  // add global settings page
@@ -387,7 +387,7 @@ function gde_activate( $network_wide ) {
387
  gde_setup();
388
  } else {
389
  gde_dx_log("Table creation failed; setup halted");
390
- wp_die( __("Setup wasn't able to create the required database tables.", 'gde') );
391
  }
392
  }
393
 
@@ -417,7 +417,7 @@ function gde_deactivate() {
417
  */
418
  function gde_load() {
419
  // localization
420
- load_plugin_textdomain( 'gde', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
421
  }
422
 
423
- ?>
2
 
3
  /*
4
  Plugin Name: Google Doc Embedder
5
+ Plugin URI: https://wordpress.org/plugins/google-document-embedder/
6
  Description: Lets you embed PDF, MS Office, TIFF, and many other file types in a web page using the Google Docs Viewer (no Flash or PDF browser plug-ins required).
7
+ Author: Kevin Davis, Dan Lester
8
+ Author URI: https://wordpress.org/plugins/google-document-embedder/
9
+ Text Domain: google-document-embedder
10
  Domain Path: /languages/
11
+ Version: 2.5.20
12
  License: GPLv2
13
  */
14
 
34
  * @author Kevin Davis <wpp@tnw.org>
35
  * @copyright Copyright 2014 Kevin Davis
36
  * @license http://www.gnu.org/licenses/gpl.txt GPL 2.0
37
+ * @link https://wordpress.org/plugins/google-document-embedder/
38
  */
39
 
40
  // boring init junk
41
+ $gde_ver = "2.5.20";
42
  $gde_db_ver = "1.2"; // update also in gde_activate()
43
 
44
  require_once( plugin_dir_path( __FILE__ ) . 'functions.php' );
75
  // check profile table health
76
  if ( ! $healthy ) {
77
  delete_option('gde_db_version');
78
+ return gde_show_error( __('Unable to load profile settings', 'google-document-embedder') );
79
  }
80
 
81
  // handle global setting overrides - not active in this release
106
  if ( ! $profile = gde_get_profiles( $term ) ) {
107
  gde_dx_log("Loading default profile instead");
108
  if ( ! $profile = gde_get_profiles( 1 ) ) {
109
+ return gde_show_error( __('Unable to load requested profile.', 'google-document-embedder') );
110
  } else {
111
  $pid = 1;
112
  }
118
  if ( ! $profile = gde_get_profiles( strtolower( $term ) ) ) {
119
  gde_dx_log("Loading default profile instead");
120
  if ( ! $profile = gde_get_profiles( 1 ) ) {
121
+ return gde_show_error( __('Unable to load requested profile.', 'google-document-embedder') );
122
  } else {
123
  $pid = 1;
124
  }
177
 
178
  // check for missing required field
179
  if ( ! $file ) {
180
+ return gde_show_error( __('File not specified, check shortcode syntax', 'google-document-embedder') );
181
  }
182
 
183
  // file validation
234
 
235
  // check for failed secure doc
236
  if ( empty( $links[0] ) && empty( $links[1] ) ) {
237
+ $code = gde_show_error( __('Unable to secure document', 'google-document-embedder') );
238
  } else {
239
 
240
  // which viewer?
302
 
303
  // link text
304
  if ( empty( $profile['link_text'] ) ) {
305
+ $profile['link_text'] = __('Download', 'google-document-embedder');
306
  }
307
 
308
  $dltext = str_replace( "%FILE", $fn, $profile['link_text'] );
351
  }
352
 
353
  // add local settings page
354
+ add_action( 'admin_menu', 'gde_option_page' );
355
 
356
  //if ( is_multisite() ) {
357
  // add global settings page
387
  gde_setup();
388
  } else {
389
  gde_dx_log("Table creation failed; setup halted");
390
+ wp_die( __("Setup wasn't able to create the required database tables.", 'google-document-embedder') );
391
  }
392
  }
393
 
417
  */
418
  function gde_load() {
419
  // localization
420
+ load_plugin_textdomain( 'google-document-embedder', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
421
  }
422
 
423
+ ?>
img/index.php CHANGED
@@ -1,3 +1,3 @@
1
  <?php
2
  // mum's the word.
3
- ?>
1
  <?php
2
  // mum's the word.
3
+ ?>
js/editor_plugin.js CHANGED
@@ -14,7 +14,7 @@
14
  }
15
  )}
16
  );
17
- ed.addButton('gde', {
18
  title : 'Google Doc Embedder',
19
  cmd : 'gde_cmd',
20
  image : url + '/img/gde-button.png'
@@ -31,8 +31,8 @@
31
  return {
32
  longname : 'Google Doc Embedder',
33
  author : 'Kevin Davis',
34
- authorurl : 'http://www.davistribe.org/gde',
35
- infourl : 'http://www.davistribe.org/gde',
36
  version : "1.5"}
37
  }
38
  });
14
  }
15
  )}
16
  );
17
+ ed.addButton('gde', { /* LANGGDE */
18
  title : 'Google Doc Embedder',
19
  cmd : 'gde_cmd',
20
  image : url + '/img/gde-button.png'
31
  return {
32
  longname : 'Google Doc Embedder',
33
  author : 'Kevin Davis',
34
+ authorurl : 'https://wordpress.org/plugins/google-document-embedder/',
35
+ infourl : 'https://wordpress.org/plugins/google-document-embedder/',
36
  version : "1.5"}
37
  }
38
  });
js/gde-quicktags.js CHANGED
@@ -1,6 +1,6 @@
1
  edButtons[edButtons.length] =
2
  new edButton('ed_h1'
3
- ,'GDE'
4
  ,'[gview file="'
5
  ,'"]'
6
  ,'1'
1
  edButtons[edButtons.length] =
2
  new edButton('ed_h1'
3
+ ,'GDE' /* LANGGDE */
4
  ,'[gview file="'
5
  ,'"]'
6
  ,'1'
js/index.php CHANGED
@@ -1,3 +1,3 @@
1
  <?php
2
  // mum's the word.
3
- ?>
1
  <?php
2
  // mum's the word.
3
+ ?>
js/tb-newwin.php CHANGED
@@ -4,11 +4,11 @@
4
  require_once('../libs/lib-bootstrap.php');
5
 
6
  if ( isset( $_GET['a'] ) && $_GET['a'] == "fs" ) {
7
- $tip = __('View in full screen', 'gde');
8
  $func = "gdeFullScreen";
9
  $ico = "openFullScreenButtonIcon";
10
  } else {
11
- $tip = __('Open in new window', 'gde');
12
  $func = "gdeNewWin";
13
  $ico = "openInViewerButtonIcon";
14
  }
@@ -98,4 +98,4 @@ function gdeGetUrl() {
98
  }
99
  ?>
100
  return thisIFrame;
101
- }
4
  require_once('../libs/lib-bootstrap.php');
5
 
6
  if ( isset( $_GET['a'] ) && $_GET['a'] == "fs" ) {
7
+ $tip = __('View in full screen', 'google-document-embedder');
8
  $func = "gdeFullScreen";
9
  $ico = "openFullScreenButtonIcon";
10
  } else {
11
+ $tip = __('Open in new window', 'google-document-embedder');
12
  $func = "gdeNewWin";
13
  $ico = "openInViewerButtonIcon";
14
  }
98
  }
99
  ?>
100
  return thisIFrame;
101
+ }
languages/{gde-cs_CZ.mo → google-document-embedder-cs_CZ.mo} RENAMED
File without changes
languages/{gde-cs_CZ.po → google-document-embedder-cs_CZ.po} RENAMED
File without changes
languages/{gde-en_US.mo → google-document-embedder-en_US.mo} RENAMED
File without changes
languages/{gde-en_US.po → google-document-embedder-en_US.po} RENAMED
File without changes
languages/{gde-es_ES.mo → google-document-embedder-es_ES.mo} RENAMED
File without changes
languages/{gde-es_ES.po → google-document-embedder-es_ES.po} RENAMED
File without changes
languages/{gde-fr_FR.mo → google-document-embedder-fr_FR.mo} RENAMED
File without changes
languages/{gde-fr_FR.po → google-document-embedder-fr_FR.po} RENAMED
File without changes
languages/{gde-hu_HU.mo → google-document-embedder-hu_HU.mo} RENAMED
File without changes
languages/{gde-hu_HU.po → google-document-embedder-hu_HU.po} RENAMED
File without changes
languages/{gde-it_IT.mo → google-document-embedder-it_IT.mo} RENAMED
File without changes
languages/{gde-it_IT.po → google-document-embedder-it_IT.po} RENAMED
File without changes
languages/{gde-nl_NL.mo → google-document-embedder-nl_NL.mo} RENAMED
File without changes
languages/{gde-nl_NL.po → google-document-embedder-nl_NL.po} RENAMED
File without changes
languages/{gde-ru_RU.mo → google-document-embedder-ru_RU.mo} RENAMED
File without changes
languages/{gde-ru_RU.po → google-document-embedder-ru_RU.po} RENAMED
File without changes
languages/{gde-tr_TR.mo → google-document-embedder-tr_TR.mo} RENAMED
File without changes
languages/{gde-tr_TR.po → google-document-embedder-tr_TR.po} RENAMED
File without changes
languages/{gde-uk.mo → google-document-embedder-uk.mo} RENAMED
File without changes
languages/{gde-uk.po → google-document-embedder-uk.po} RENAMED
File without changes
languages/{gde.pot → google-document-embedder.pot} RENAMED
File without changes
libs/lib-bootstrap.php CHANGED
@@ -23,4 +23,4 @@ if ( ! defined( 'WP_LOAD_PATH' ) ) {
23
  // load wp-load.php
24
  require_once( WP_LOAD_PATH . 'wp-load.php' );
25
 
26
- ?>
23
  // load wp-load.php
24
  require_once( WP_LOAD_PATH . 'wp-load.php' );
25
 
26
+ ?>
libs/lib-eddialog.php CHANGED
@@ -8,7 +8,7 @@ require_once( dirname( __FILE__ ) . '/lib-bootstrap.php');
8
 
9
  // no access if parent plugin is disabled
10
  if ( ! function_exists( 'gde_do_shortcode' ) ) {
11
- wp_die( __('Access denied.', 'gde') );
12
  }
13
 
14
  // get profiles
@@ -52,29 +52,29 @@ $profiles = gde_get_profiles();
52
 
53
  <form onsubmit="GDEInsertDialog.insert();return false;" action="#" id="gdedialog">
54
 
55
- <p><strong><?php _e('Insert Google Doc Embedder Shortcode', 'gde'); ?></strong></p>
56
 
57
  <fieldset>
58
- <legend class="gray dwl_gray"><?php _e('Required', 'gde'); ?></legend>
59
  <table width="100%" border="0" cellspacing="0" cellpadding="5">
60
  <tr>
61
  <td align="right" class="gray dwl_gray" style="width:40%;">
62
- <strong><?php _e('URL or Filename', 'gde'); ?></strong><br />
63
- <span class="note"><?php _e('Full URL or filename to append to profile Base URL', 'gde'); ?></span>
64
  </td>
65
  <td valign="top">
66
  <input name="url" type="text" class="opt dwl" id="url" style="width:220px;" /><br/>
67
  <span id="uri-note-base" style="display:none;color:#2B6FB6;">
68
- <?php _e('Profile Base URL will be prefixed', 'gde'); ?>
69
  </span>
70
  <span id="uri-note-file" style="display:none;color:red;">
71
- <?php _e('Unsupported file type', 'gde'); ?>
72
  </span>
73
  </td>
74
  </tr>
75
  <tr>
76
  <td align="right" valign="top" class="gray dwl_gray">
77
- <strong><?php _e('Profile', 'gde'); ?></strong>
78
  </td>
79
  <td valign="top">
80
  <select name="profile" id="profile">
@@ -85,7 +85,7 @@ $profiles = gde_get_profiles();
85
  ?>
86
  </select>
87
  <br/>
88
- <span class="note"><?php _e('Select the GDE viewer profile to use', 'gde'); ?></span>
89
  </td>
90
  </tr>
91
  </table>
@@ -93,28 +93,28 @@ $profiles = gde_get_profiles();
93
 
94
  <br/>
95
  <fieldset>
96
- <legend class="gray dwl_gray"><?php _e('Optional (Override Profile Settings)', 'gde'); ?></legend>
97
  <table width="100%" border="0" cellspacing="0" cellpadding="5">
98
  <!--tr class="switch">
99
  <td colspan="2" class="gray dwl_gray">
100
  <input name="use_defaults" type="checkbox" value="-1" class="use_defaults dwl opt" />
101
- <?php _e('Use selected profile settings', 'gde'); ?>
102
  </td>
103
  </tr-->
104
  <tr class="ovrride">
105
  <td align="right" valign="top" class="gray dwl_gray" style="width:40%">
106
- <strong><?php _e('Height', 'gde'); ?></strong>
107
  </td>
108
  <td valign="top">
109
  <input name="height" type="text" class="opt dwl" id="height" size="6" />
110
  &nbsp;&nbsp;&nbsp;
111
- <strong><?php _e('Width', 'gde'); ?></strong> <input name="width" type="text" class="opt dwl" id="width" size="6" /><br />
112
- <span class="note"><?php _e('Format: 40% or 300px', 'gde'); ?></span>
113
  </td>
114
  </tr>
115
  <!--tr class="ovrride">
116
  <td align="right" class="gray dwl_gray">
117
- <strong><?php _e('Start Page #', 'gde'); ?></strong>
118
  </td>
119
  <td valign="top">
120
  <input name="page" type="text" class="opt dwl" id="page" size="6" value="1" />
@@ -122,17 +122,17 @@ $profiles = gde_get_profiles();
122
  </tr-->
123
  <tr class="ovrride">
124
  <td align="right" class="gray dwl_gray">
125
- <strong><?php _e('Show Download Link', 'gde'); ?></strong>
126
  </td>
127
  <td valign="top" class="gray dwl_gray">
128
- <input name="save" type="radio" class="opt dwl save" value="1" /> <?php _e('Yes', 'gde'); ?>
129
- <input name="save" type="radio" class="opt dwl save" value="0" /> <?php _e('No', 'gde'); ?>
130
  </td>
131
  </tr>
132
  <tr class="ovrride">
133
  <td colspan="2" class="gray dwl_gray">
134
  <input name="disable_cache" type="checkbox" value="-1" class="disable_cache dwl opt" />
135
- <?php _e('Disable caching (this document is frequently overwritten)', 'gde'); ?>
136
  </td>
137
  </tr>
138
  </span>
@@ -143,7 +143,7 @@ $profiles = gde_get_profiles();
143
  <tr>
144
  <td colspan="2">
145
  <br />
146
- <strong><?php _e('Shortcode Preview', 'gde'); ?></strong><br/>
147
  <textarea name="shortcode" style="width:100%" id="shortcode" readonly="readonly"></textarea>
148
  </td>
149
  </tr>
@@ -151,14 +151,14 @@ $profiles = gde_get_profiles();
151
 
152
  <div class="mceActionPanel">
153
  <div style="float: left">
154
- <input type="button" id="insert" name="insert" value="<?php _e('Insert', 'gde'); ?>" onclick="GDEInsertDialog.insert();" style="color:#222;" class="disabled" disabled="disabled" />
155
  </div>
156
 
157
  <div style="float: right">
158
- <input type="button" id="cancel" name="cancel" value="<?php _e('Cancel', 'gde'); ?>" onclick="tinyMCEPopup.close();" />
159
  </div>
160
  </div>
161
  </form>
162
 
163
  </body>
164
- </html>
8
 
9
  // no access if parent plugin is disabled
10
  if ( ! function_exists( 'gde_do_shortcode' ) ) {
11
+ wp_die( __('Access denied.', 'google-document-embedder') );
12
  }
13
 
14
  // get profiles
52
 
53
  <form onsubmit="GDEInsertDialog.insert();return false;" action="#" id="gdedialog">
54
 
55
+ <p><strong><?php _e('Insert Google Doc Embedder Shortcode', 'google-document-embedder'); ?></strong></p>
56
 
57
  <fieldset>
58
+ <legend class="gray dwl_gray"><?php _e('Required', 'google-document-embedder'); ?></legend>
59
  <table width="100%" border="0" cellspacing="0" cellpadding="5">
60
  <tr>
61
  <td align="right" class="gray dwl_gray" style="width:40%;">
62
+ <strong><?php _e('URL or Filename', 'google-document-embedder'); ?></strong><br />
63
+ <span class="note"><?php _e('Full URL or filename to append to profile Base URL', 'google-document-embedder'); ?></span>
64
  </td>
65
  <td valign="top">
66
  <input name="url" type="text" class="opt dwl" id="url" style="width:220px;" /><br/>
67
  <span id="uri-note-base" style="display:none;color:#2B6FB6;">
68
+ <?php _e('Profile Base URL will be prefixed', 'google-document-embedder'); ?>
69
  </span>
70
  <span id="uri-note-file" style="display:none;color:red;">
71
+ <?php _e('Unsupported file type', 'google-document-embedder'); ?>
72
  </span>
73
  </td>
74
  </tr>
75
  <tr>
76
  <td align="right" valign="top" class="gray dwl_gray">
77
+ <strong><?php _e('Profile', 'google-document-embedder'); ?></strong>
78
  </td>
79
  <td valign="top">
80
  <select name="profile" id="profile">
85
  ?>
86
  </select>
87
  <br/>
88
+ <span class="note"><?php _e('Select the GDE viewer profile to use', 'google-document-embedder'); ?></span>
89
  </td>
90
  </tr>
91
  </table>
93
 
94
  <br/>
95
  <fieldset>
96
+ <legend class="gray dwl_gray"><?php _e('Optional (Override Profile Settings)', 'google-document-embedder'); ?></legend>
97
  <table width="100%" border="0" cellspacing="0" cellpadding="5">
98
  <!--tr class="switch">
99
  <td colspan="2" class="gray dwl_gray">
100
  <input name="use_defaults" type="checkbox" value="-1" class="use_defaults dwl opt" />
101
+ <?php _e('Use selected profile settings', 'google-document-embedder'); ?>
102
  </td>
103
  </tr-->
104
  <tr class="ovrride">
105
  <td align="right" valign="top" class="gray dwl_gray" style="width:40%">
106
+ <strong><?php _e('Height', 'google-document-embedder'); ?></strong>
107
  </td>
108
  <td valign="top">
109
  <input name="height" type="text" class="opt dwl" id="height" size="6" />
110
  &nbsp;&nbsp;&nbsp;
111
+ <strong><?php _e('Width', 'google-document-embedder'); ?></strong> <input name="width" type="text" class="opt dwl" id="width" size="6" /><br />
112
+ <span class="note"><?php _e('Format: 40% or 300px', 'google-document-embedder'); ?></span>
113
  </td>
114
  </tr>
115
  <!--tr class="ovrride">
116
  <td align="right" class="gray dwl_gray">
117
+ <strong><?php _e('Start Page #', 'google-document-embedder'); ?></strong>
118
  </td>
119
  <td valign="top">
120
  <input name="page" type="text" class="opt dwl" id="page" size="6" value="1" />
122
  </tr-->
123
  <tr class="ovrride">
124
  <td align="right" class="gray dwl_gray">
125
+ <strong><?php _e('Show Download Link', 'google-document-embedder'); ?></strong>
126
  </td>
127
  <td valign="top" class="gray dwl_gray">
128
+ <input name="save" type="radio" class="opt dwl save" value="1" /> <?php _e('Yes', 'google-document-embedder'); ?>
129
+ <input name="save" type="radio" class="opt dwl save" value="0" /> <?php _e('No', 'google-document-embedder'); ?>
130
  </td>
131
  </tr>
132
  <tr class="ovrride">
133
  <td colspan="2" class="gray dwl_gray">
134
  <input name="disable_cache" type="checkbox" value="-1" class="disable_cache dwl opt" />
135
+ <?php _e('Disable caching (this document is frequently overwritten)', 'google-document-embedder'); ?>
136
  </td>
137
  </tr>
138
  </span>
143
  <tr>
144
  <td colspan="2">
145
  <br />
146
+ <strong><?php _e('Shortcode Preview', 'google-document-embedder'); ?></strong><br/>
147
  <textarea name="shortcode" style="width:100%" id="shortcode" readonly="readonly"></textarea>
148
  </td>
149
  </tr>
151
 
152
  <div class="mceActionPanel">
153
  <div style="float: left">
154
+ <input type="button" id="insert" name="insert" value="<?php _e('Insert', 'google-document-embedder'); ?>" onclick="GDEInsertDialog.insert();" style="color:#222;" class="disabled" disabled="disabled" />
155
  </div>
156
 
157
  <div style="float: right">
158
+ <input type="button" id="cancel" name="cancel" value="<?php _e('Cancel', 'google-document-embedder'); ?>" onclick="tinyMCEPopup.close();" />
159
  </div>
160
  </div>
161
  </form>
162
 
163
  </body>
164
+ </html>
libs/lib-exts.php CHANGED
@@ -40,4 +40,4 @@ if ( ! isset( $no_output ) ) {
40
  echo $json;
41
  }
42
 
43
- ?>
40
  echo $json;
41
  }
42
 
43
+ ?>
libs/lib-formsubmit.php CHANGED
@@ -111,4 +111,4 @@ if ( ! function_exists('gde_activate') ) {
111
  }
112
  }
113
 
114
- ?>
111
  }
112
  }
113
 
114
+ ?>
libs/lib-langs.php CHANGED
@@ -122,4 +122,4 @@ function gde_mapped_langs( $locale = '' ) {
122
  }
123
  }
124
 
125
- ?>
122
  }
123
  }
124
 
125
+ ?>
libs/lib-mobilecheck.php CHANGED
@@ -16,4 +16,4 @@ function gde_is_mobile_browser() {
16
  }
17
  }
18
 
19
- ?>
16
  }
17
  }
18
 
19
+ ?>
libs/lib-profile.php CHANGED
@@ -9,7 +9,7 @@ function gde_profile_form( $id = 1 ) {
9
 
10
  // get requested profile
11
  if ( ! $healthy ) {
12
- echo "<p>" . gde_show_error( __('Unable to load profile settings. Please re-activate GDE and if the problem persists, request help using the "Support" tab.', 'gde') ) . "</p>\n";
13
  } else {
14
  $p = gde_get_profiles( $id );
15
 
@@ -22,12 +22,12 @@ function gde_profile_form( $id = 1 ) {
22
 
23
  // setup title & nonce
24
  if ( $id == 1 ) {
25
- $title = __('Default Settings', 'gde');
26
- $desc = __('These settings define the default viewer profile, which is used when no other profile is specified.', 'gde');
27
  $naction = "update-default-opts";
28
  $nname = "_general_default";
29
  } else {
30
- $title = __('Edit Profile', 'gde');
31
  $naction = "update-profile-opts";
32
  $nname = "_profile_edit";
33
  }
@@ -37,22 +37,22 @@ function gde_profile_form( $id = 1 ) {
37
 
38
  <form action="" method="post">
39
  <?php wp_nonce_field($naction, $nname); ?>
40
- <input type="hidden" name="profile_id" value="<?php echo $id; ?>">
41
 
42
  <?php gde_help_link( GDE_STDOPT_URL, 'right' ); ?>
43
  <h3><?php echo $title; ?></h3>
44
 
45
- <?php if ( isset( $desc ) ) { echo $desc; } ?>
46
 
47
  <table class="form-table">
48
  <tbody>
49
  <tr valign="top">
50
- <th scope="row"><?php _e('Viewer Mode', 'gde'); ?></th>
51
  <td>
52
  <select name="viewer" id="viewer">
53
  <?php
54
- gde_profile_option( $p['viewer'], 'standard', __('Standard Viewer', 'gde'), __('Embed the basic viewer only', 'gde') );
55
- //gde_profile_option( $p['viewer'], 'enhanced', __('Enhanced Viewer', 'gde'), __('Enable extended viewer options', 'gde') );
56
  ?>
57
  </select><br/>
58
  <span class="gde-fnote" id="viewer-h"></span>
@@ -66,96 +66,96 @@ function gde_profile_form( $id = 1 ) {
66
  </table>
67
  <!--
68
  <fieldset class="gde-inner<?php echo $hideenh; ?>" id="gde-enh-fs">
69
- <legend><?php _e('Enhanced Viewer Settings', 'gde'); ?></legend>
70
  <table class="form-table">
71
  <tbody>
72
  <tr valign="top">
73
- <th scope="row"><?php _e('Toolbar', 'gde'); ?></th>
74
  <td>
75
  <?php gde_help_link( GDE_ENHOPT_URL, 'right' ); ?>
76
  <?php
77
- gde_profile_checkbox( $p['tb_flags'], 'gdet_h', __('Remove Toolbar', 'gde') );
78
  ?>
79
  </td>
80
  </tr>
81
  <tr valign="top" id="mobiletb">
82
- <th scope="row"><?php _e('Use Mobile Toolbar', 'gde'); ?></th>
83
  <td>
84
  <select name="tb_mobile" id="tb_mobile">
85
  <?php
86
- gde_profile_option( $p['tb_mobile'], 'default', __('Mobile Devices Only (Default)', 'gde'), __('Use mobile toolbar when mobile device detected', 'gde') );
87
- gde_profile_option( $p['tb_mobile'], 'always', __('Always', 'gde'), __('Use mobile toolbar for all visitors', 'gde') );
88
- gde_profile_option( $p['tb_mobile'], 'never', __('Never', 'gde'), __('Never use mobile toolbar', 'gde') );
89
  ?>
90
  </select><br/>
91
  <span class="gde-fnote" id="mobile-h"></span>
92
  </td>
93
  </tr>
94
  <tr valign="top" id="toolbuttons">
95
- <th scope="row"><?php _e('Toolbar Items', 'gde'); ?></th>
96
  <td>
97
  <?php
98
- gde_profile_checkbox( $p['tb_flags'], 'gdet_p', __('Page Numbers', 'gde') );
99
- gde_profile_checkbox( $p['tb_flags'], 'gdet_r', __('Previous/Next Page', 'gde') );
100
- gde_profile_checkbox( $p['tb_flags'], 'gdet_z', __('Zoom In/Out', 'gde') );
101
- gde_profile_checkbox( $p['tb_flags'], 'gdet_n', __('Full Screen/New Window', 'gde'), 'allowNewWin' );
102
  ?>
103
  <br/>
104
- <span class="gde-fnote"><?php _e('Uncheck items to remove from toolbar. Buttons will vary based on file type and device used.', 'gde'); ?></span>
105
  </td>
106
  </tr>
107
  <tr valign="top" id="fullscreen">
108
- <th scope="row"><?php _e('Full Screen Behavior', 'gde'); ?></th>
109
  <td>
110
  <select name="tb_fullscr" id="tb_fullscr">
111
  <?php
112
- gde_profile_option( $p['tb_fullscr'], 'default', __('Google-Hosted Page (Default)', 'gde') );
113
- //gde_profile_option( $p['tb_fullscr'], 'branded', __('Custom-Branded Page', 'gde') );
114
- gde_profile_option( $p['tb_fullscr'], 'viewer', __('Full Screen Viewer', 'gde') );
115
  ?>
116
  </select><br/>
117
 
118
  <?php
119
- gde_profile_checkbox( $p['tb_fullwin'], 'fs_win', __('Open in New Window', 'gde') );
120
- gde_profile_checkbox( $p['tb_fulluser'], 'fs_user', __('Allow Logged-in Users Only', 'gde'), 'blockAnon' );
121
- //gde_profile_checkbox( $p['tb_print'], 'fs_print', __('Allow Printing', 'gde'), 'allowPrint' );
122
  ?>
123
  </td>
124
  </tr>
125
  <tr valign="top" id="bgcolor">
126
- <th scope="row"><?php _e('Page Area Background Color', 'gde'); ?></th>
127
  <td>
128
  <?php
129
  gde_profile_text( $p['vw_bgcolor'], 'vw_bgcolor', 'gde-color-field', 10 );
130
- gde_profile_checkbox( $p['vw_flags'], 'gdev_t', __('None (Transparent)', 'gde') );
131
  ?>
132
  </td>
133
  </tr>
134
  <tr valign="top" id="pbcolor">
135
- <th scope="row"><?php _e('Page Border Color', 'gde'); ?></th>
136
  <td>
137
  <?php
138
  gde_profile_text( $p['vw_pbcolor'], 'vw_pbcolor', 'gde-color-field', 10 );
139
- gde_profile_checkbox( $p['vw_flags'], 'gdev_b', __('No Border', 'gde') );
140
  ?>
141
  </td>
142
  </tr>
143
  <tr valign="top" id="cssfile">
144
- <th scope="row"><?php _e('Custom CSS File', 'gde'); ?></th>
145
  <td>
146
  <?php
147
  @gde_profile_text( $p['vw_css'], 'vw_css', '', '65' );
148
  ?>
149
  <br/>
150
- <span class="gde-fnote"><?php _e('URL of custom CSS file (may override some of the above options)', 'gde'); ?></span>
151
  </td>
152
  </tr>
153
  <tr valign="top" id="docsec">
154
- <th scope="row"><?php _e('Security', 'gde'); ?></th>
155
  <td>
156
  <?php
157
- gde_profile_checkbox( $p['vw_flags'], 'gdev_x', __('Hide ability to select/copy/paste text', 'gde'), 'hideselect', 1 );
158
- gde_profile_checkbox( $p['link_block'], 'block', __('Block all download requests for file', 'gde'), 'linkblock', 1 );
159
  ?>
160
  </td>
161
  </tr>
@@ -166,7 +166,7 @@ function gde_profile_form( $id = 1 ) {
166
  <table class="form-table">
167
  <tbody>
168
  <tr valign="top">
169
- <th scope="row"><?php _e('Default Language', 'gde'); ?></th>
170
  <td>
171
  <select name="language" id="language">
172
  <?php
@@ -178,74 +178,74 @@ function gde_profile_form( $id = 1 ) {
178
  }
179
  ?>
180
  </select><br/>
181
- <span class="gde-fnote"><?php _e('Language of toolbar button tips', 'gde'); ?></span>
182
  </td>
183
  </tr>
184
  <tr valign="top">
185
- <th scope="row"><?php _e('Default Size', 'gde'); ?></th>
186
  <td>
187
- &nbsp;<?php _e('Width', 'gde'); ?>
188
  <?php
189
  gde_profile_text( $p['default_width'], 'default_width', '', '5' );
190
  ?>
191
- &nbsp;&nbsp;&nbsp;&nbsp;<?php _e('Height', 'gde'); ?>
192
  <?php
193
  gde_profile_text( $p['default_height'], 'default_height', '', '5' );
194
  ?>
195
  <br/>
196
- <span class="gde-fnote"><?php _e('Enter as pixels or percentage (example: 500px or 100%)', 'gde'); ?></span>
197
  </td>
198
  </tr>
199
  <tr valign="top">
200
- <th scope="row"><?php _e('File Base URL', 'gde'); ?></th>
201
  <td>
202
  <?php
203
  gde_profile_text( $p['base_url'], 'base_url', '', '65' );
204
  ?>
205
  <br/>
206
- <span class="gde-fnote"><?php _e('Any file not starting with <code>http</code> will be prefixed by this value', 'gde'); ?></span>
207
  </td>
208
  </tr>
209
  <tr valign="top">
210
- <th scope="row"><?php _e('Download Link', 'gde'); ?></th>
211
  <td>
212
  <select name="link_show" id="link_show">
213
  <?php
214
- gde_profile_option( $p['link_show'], 'all', __('All Users', 'gde'), __('Download link visible to everyone by default', 'gde') );
215
- gde_profile_option( $p['link_show'], 'users', __('Logged-in Users', 'gde'), __('Download link visible to logged-in users', 'gde') );
216
- gde_profile_option( $p['link_show'], 'none', __('None', 'gde'), __('Download link is not visible by default', 'gde') );
217
  ?>
218
  </select><br/>
219
  <span class="gde-fnote" id="linkshow-h"></span>
220
  </td>
221
  </tr>
222
  <tr valign="top" id="linktext">
223
- <th scope="row"><?php _e('Link Text', 'gde'); ?></th>
224
  <td>
225
- <input size="50" name="link_text" value="<?php echo $p['link_text']; ?>" type="text"><br/>
226
- <span class="gde-fnote"><?php _e('You can further customize text using these dynamic replacements:', 'gde'); ?></span><br>
227
- <code>%FILE</code> : <?php _e('filename', 'gde'); ?> &nbsp;&nbsp;&nbsp;
228
- <code>%TYPE</code> : <?php _e('file type', 'gde'); ?> &nbsp;&nbsp;&nbsp;
229
- <code>%SIZE</code> : <?php _e('file size', 'gde'); ?>
230
  </td>
231
  </tr>
232
  <tr valign="top" id="linkpos">
233
- <th scope="row"><?php _e('Link Position', 'gde'); ?></th>
234
  <td>
235
  <select name="link_pos">
236
  <?php
237
- gde_profile_option( $p['link_pos'], 'above', __('Above Viewer', 'gde') );
238
- gde_profile_option( $p['link_pos'], 'below', __('Below Viewer', 'gde') );
239
  ?>
240
  </select>
241
  </td>
242
  </tr>
243
  <tr valign="top" id="linkbehavior">
244
- <th scope="row"><?php _e('Link Behavior', 'gde'); ?></th>
245
  <td>
246
  <?php
247
- gde_profile_checkbox( $p['link_force'], 'force', __('Force download (bypass browser plugins)', 'gde'), 'linkforce', 1 );
248
- //gde_profile_checkbox( $p['link_mask'], 'mask', __('Shorten URL', 'gde'), 'linkmask', 1 );
249
  ?>
250
  </td>
251
  </tr>
@@ -253,7 +253,7 @@ function gde_profile_form( $id = 1 ) {
253
  </table>
254
 
255
  <p class="gde-submit">
256
- <input id="pro-submit" class="button-primary" type="submit" value="<?php _e('Save Changes', 'gde'); ?>" name="submit">
257
  </p>
258
 
259
  </form>
@@ -263,4 +263,4 @@ function gde_profile_form( $id = 1 ) {
263
  <?php
264
  }
265
  }
266
- ?>
9
 
10
  // get requested profile
11
  if ( ! $healthy ) {
12
+ echo "<p>" . gde_show_error( __('Unable to load profile settings. Please re-activate GDE and if the problem persists, request help using the "Support" tab.', 'google-document-embedder') ) . "</p>\n";
13
  } else {
14
  $p = gde_get_profiles( $id );
15
 
22
 
23
  // setup title & nonce
24
  if ( $id == 1 ) {
25
+ $title = __('Default Settings', 'google-document-embedder');
26
+ $desc = __('These settings define the default viewer profile, which is used when no other profile is specified.', 'google-document-embedder');
27
  $naction = "update-default-opts";
28
  $nname = "_general_default";
29
  } else {
30
+ $title = __('Edit Profile', 'google-document-embedder');
31
  $naction = "update-profile-opts";
32
  $nname = "_profile_edit";
33
  }
37
 
38
  <form action="" method="post">
39
  <?php wp_nonce_field($naction, $nname); ?>
40
+ <input type="hidden" name="profile_id" value="<?php echo esc_attr($id); ?>">
41
 
42
  <?php gde_help_link( GDE_STDOPT_URL, 'right' ); ?>
43
  <h3><?php echo $title; ?></h3>
44
 
45
+ <?php if ( isset( $desc ) ) { echo htmlentities($desc); } ?>
46
 
47
  <table class="form-table">
48
  <tbody>
49
  <tr valign="top">
50
+ <th scope="row"><?php _e('Viewer Mode', 'google-document-embedder'); ?></th>
51
  <td>
52
  <select name="viewer" id="viewer">
53
  <?php
54
+ gde_profile_option( $p['viewer'], 'standard', __('Standard Viewer', 'google-document-embedder'), __('Embed the basic viewer only', 'google-document-embedder') );
55
+ //gde_profile_option( $p['viewer'], 'enhanced', __('Enhanced Viewer', 'google-document-embedder'), __('Enable extended viewer options', 'google-document-embedder') );
56
  ?>
57
  </select><br/>
58
  <span class="gde-fnote" id="viewer-h"></span>
66
  </table>
67
  <!--
68
  <fieldset class="gde-inner<?php echo $hideenh; ?>" id="gde-enh-fs">
69
+ <legend><?php _e('Enhanced Viewer Settings', 'google-document-embedder'); ?></legend>
70
  <table class="form-table">
71
  <tbody>
72
  <tr valign="top">
73
+ <th scope="row"><?php _e('Toolbar', 'google-document-embedder'); ?></th>
74
  <td>
75
  <?php gde_help_link( GDE_ENHOPT_URL, 'right' ); ?>
76
  <?php
77
+ gde_profile_checkbox( $p['tb_flags'], 'gdet_h', __('Remove Toolbar', 'google-document-embedder') );
78
  ?>
79
  </td>
80
  </tr>
81
  <tr valign="top" id="mobiletb">
82
+ <th scope="row"><?php _e('Use Mobile Toolbar', 'google-document-embedder'); ?></th>
83
  <td>
84
  <select name="tb_mobile" id="tb_mobile">
85
  <?php
86
+ gde_profile_option( $p['tb_mobile'], 'default', __('Mobile Devices Only (Default)', 'google-document-embedder'), __('Use mobile toolbar when mobile device detected', 'google-document-embedder') );
87
+ gde_profile_option( $p['tb_mobile'], 'always', __('Always', 'google-document-embedder'), __('Use mobile toolbar for all visitors', 'google-document-embedder') );
88
+ gde_profile_option( $p['tb_mobile'], 'never', __('Never', 'google-document-embedder'), __('Never use mobile toolbar', 'google-document-embedder') );
89
  ?>
90
  </select><br/>
91
  <span class="gde-fnote" id="mobile-h"></span>
92
  </td>
93
  </tr>
94
  <tr valign="top" id="toolbuttons">
95
+ <th scope="row"><?php _e('Toolbar Items', 'google-document-embedder'); ?></th>
96
  <td>
97
  <?php
98
+ gde_profile_checkbox( $p['tb_flags'], 'gdet_p', __('Page Numbers', 'google-document-embedder') );
99
+ gde_profile_checkbox( $p['tb_flags'], 'gdet_r', __('Previous/Next Page', 'google-document-embedder') );
100
+ gde_profile_checkbox( $p['tb_flags'], 'gdet_z', __('Zoom In/Out', 'google-document-embedder') );
101
+ gde_profile_checkbox( $p['tb_flags'], 'gdet_n', __('Full Screen/New Window', 'google-document-embedder'), 'allowNewWin' );
102
  ?>
103
  <br/>
104
+ <span class="gde-fnote"><?php _e('Uncheck items to remove from toolbar. Buttons will vary based on file type and device used.', 'google-document-embedder'); ?></span>
105
  </td>
106
  </tr>
107
  <tr valign="top" id="fullscreen">
108
+ <th scope="row"><?php _e('Full Screen Behavior', 'google-document-embedder'); ?></th>
109
  <td>
110
  <select name="tb_fullscr" id="tb_fullscr">
111
  <?php
112
+ gde_profile_option( $p['tb_fullscr'], 'default', __('Google-Hosted Page (Default)', 'google-document-embedder') );
113
+ //gde_profile_option( $p['tb_fullscr'], 'branded', __('Custom-Branded Page', 'google-document-embedder') );
114
+ gde_profile_option( $p['tb_fullscr'], 'viewer', __('Full Screen Viewer', 'google-document-embedder') );
115
  ?>
116
  </select><br/>
117
 
118
  <?php
119
+ gde_profile_checkbox( $p['tb_fullwin'], 'fs_win', __('Open in New Window', 'google-document-embedder') );
120
+ gde_profile_checkbox( $p['tb_fulluser'], 'fs_user', __('Allow Logged-in Users Only', 'google-document-embedder'), 'blockAnon' );
121
+ //gde_profile_checkbox( $p['tb_print'], 'fs_print', __('Allow Printing', 'google-document-embedder'), 'allowPrint' );
122
  ?>
123
  </td>
124
  </tr>
125
  <tr valign="top" id="bgcolor">
126
+ <th scope="row"><?php _e('Page Area Background Color', 'google-document-embedder'); ?></th>
127
  <td>
128
  <?php
129
  gde_profile_text( $p['vw_bgcolor'], 'vw_bgcolor', 'gde-color-field', 10 );
130
+ gde_profile_checkbox( $p['vw_flags'], 'gdev_t', __('None (Transparent)', 'google-document-embedder') );
131
  ?>
132
  </td>
133
  </tr>
134
  <tr valign="top" id="pbcolor">
135
+ <th scope="row"><?php _e('Page Border Color', 'google-document-embedder'); ?></th>
136
  <td>
137
  <?php
138
  gde_profile_text( $p['vw_pbcolor'], 'vw_pbcolor', 'gde-color-field', 10 );
139
+ gde_profile_checkbox( $p['vw_flags'], 'gdev_b', __('No Border', 'google-document-embedder') );
140
  ?>
141
  </td>
142
  </tr>
143
  <tr valign="top" id="cssfile">
144
+ <th scope="row"><?php _e('Custom CSS File', 'google-document-embedder'); ?></th>
145
  <td>
146
  <?php
147
  @gde_profile_text( $p['vw_css'], 'vw_css', '', '65' );
148
  ?>
149
  <br/>
150
+ <span class="gde-fnote"><?php _e('URL of custom CSS file (may override some of the above options)', 'google-document-embedder'); ?></span>
151
  </td>
152
  </tr>
153
  <tr valign="top" id="docsec">
154
+ <th scope="row"><?php _e('Security', 'google-document-embedder'); ?></th>
155
  <td>
156
  <?php
157
+ gde_profile_checkbox( $p['vw_flags'], 'gdev_x', __('Hide ability to select/copy/paste text', 'google-document-embedder'), 'hideselect', 1 );
158
+ gde_profile_checkbox( $p['link_block'], 'block', __('Block all download requests for file', 'google-document-embedder'), 'linkblock', 1 );
159
  ?>
160
  </td>
161
  </tr>
166
  <table class="form-table">
167
  <tbody>
168
  <tr valign="top">
169
+ <th scope="row"><?php _e('Default Language', 'google-document-embedder'); ?></th>
170
  <td>
171
  <select name="language" id="language">
172
  <?php
178
  }
179
  ?>
180
  </select><br/>
181
+ <span class="gde-fnote"><?php _e('Language of toolbar button tips', 'google-document-embedder'); ?></span>
182
  </td>
183
  </tr>
184
  <tr valign="top">
185
+ <th scope="row"><?php _e('Default Size', 'google-document-embedder'); ?></th>
186
  <td>
187
+ &nbsp;<?php _e('Width', 'google-document-embedder'); ?>
188
  <?php
189
  gde_profile_text( $p['default_width'], 'default_width', '', '5' );
190
  ?>
191
+ &nbsp;&nbsp;&nbsp;&nbsp;<?php _e('Height', 'google-document-embedder'); ?>
192
  <?php
193
  gde_profile_text( $p['default_height'], 'default_height', '', '5' );
194
  ?>
195
  <br/>
196
+ <span class="gde-fnote"><?php _e('Enter as pixels or percentage (example: 500px or 100%)', 'google-document-embedder'); ?></span>
197
  </td>
198
  </tr>
199
  <tr valign="top">
200
+ <th scope="row"><?php _e('File Base URL', 'google-document-embedder'); ?></th>
201
  <td>
202
  <?php
203
  gde_profile_text( $p['base_url'], 'base_url', '', '65' );
204
  ?>
205
  <br/>
206
+ <span class="gde-fnote"><?php _e('Any file not starting with <code>http</code> will be prefixed by this value', 'google-document-embedder'); ?></span>
207
  </td>
208
  </tr>
209
  <tr valign="top">
210
+ <th scope="row"><?php _e('Download Link', 'google-document-embedder'); ?></th>
211
  <td>
212
  <select name="link_show" id="link_show">
213
  <?php
214
+ gde_profile_option( $p['link_show'], 'all', __('All Users', 'google-document-embedder'), __('Download link visible to everyone by default', 'google-document-embedder') );
215
+ gde_profile_option( $p['link_show'], 'users', __('Logged-in Users', 'google-document-embedder'), __('Download link visible to logged-in users', 'google-document-embedder') );
216
+ gde_profile_option( $p['link_show'], 'none', __('None', 'google-document-embedder'), __('Download link is not visible by default', 'google-document-embedder') );
217
  ?>
218
  </select><br/>
219
  <span class="gde-fnote" id="linkshow-h"></span>
220
  </td>
221
  </tr>
222
  <tr valign="top" id="linktext">
223
+ <th scope="row"><?php _e('Link Text', 'google-document-embedder'); ?></th>
224
  <td>
225
+ <input size="50" name="link_text" value="<?php echo esc_attr($p['link_text']); ?>" type="text"><br/>
226
+ <span class="gde-fnote"><?php _e('You can further customize text using these dynamic replacements:', 'google-document-embedder'); ?></span><br>
227
+ <code>%FILE</code> : <?php _e('filename', 'google-document-embedder'); ?> &nbsp;&nbsp;&nbsp;
228
+ <code>%TYPE</code> : <?php _e('file type', 'google-document-embedder'); ?> &nbsp;&nbsp;&nbsp;
229
+ <code>%SIZE</code> : <?php _e('file size', 'google-document-embedder'); ?>
230
  </td>
231
  </tr>
232
  <tr valign="top" id="linkpos">
233
+ <th scope="row"><?php _e('Link Position', 'google-document-embedder'); ?></th>
234
  <td>
235
  <select name="link_pos">
236
  <?php
237
+ gde_profile_option( $p['link_pos'], 'above', __('Above Viewer', 'google-document-embedder') );
238
+ gde_profile_option( $p['link_pos'], 'below', __('Below Viewer', 'google-document-embedder') );
239
  ?>
240
  </select>
241
  </td>
242
  </tr>
243
  <tr valign="top" id="linkbehavior">
244
+ <th scope="row"><?php _e('Link Behavior', 'google-document-embedder'); ?></th>
245
  <td>
246
  <?php
247
+ gde_profile_checkbox( $p['link_force'], 'force', __('Force download (bypass browser plugins)', 'google-document-embedder'), 'linkforce', 1 );
248
+ //gde_profile_checkbox( $p['link_mask'], 'mask', __('Shorten URL', 'google-document-embedder'), 'linkmask', 1 );
249
  ?>
250
  </td>
251
  </tr>
253
  </table>
254
 
255
  <p class="gde-submit">
256
+ <input id="pro-submit" class="button-primary" type="submit" value="<?php _e('Save Changes', 'google-document-embedder'); ?>" name="submit">
257
  </p>
258
 
259
  </form>
263
  <?php
264
  }
265
  }
266
+ ?>
libs/lib-secure.php CHANGED
@@ -75,4 +75,4 @@ function gde_secure_code( $length = 10 ) {
75
  return $code;
76
  }
77
 
78
- ?>
75
  return $code;
76
  }
77
 
78
+ ?>
libs/lib-service.php CHANGED
@@ -92,4 +92,4 @@ function gde_output_json( $json, $save = false, $file = '' ) {
92
  exit;
93
  }
94
 
95
- ?>
92
  exit;
93
  }
94
 
95
+ ?>
libs/lib-setup.php CHANGED
@@ -51,7 +51,7 @@ function gde_defaults( $type ) {
51
  // define default profile(s)
52
  $defpros = array(
53
  "default" => array(
54
- "desc" => __('This is the default profile, used when no profile is specified.', 'gde'),
55
  "viewer" => 'standard',
56
  "default_width" => '100%',
57
  "default_height" => '500px',
@@ -70,13 +70,13 @@ function gde_defaults( $type ) {
70
  "link_show" => 'all',
71
  "link_mask" => 'no',
72
  "link_block" => 'no',
73
- "link_text" => __('Download', 'gde') . ' (%TYPE, %SIZE)',
74
  "link_pos" => 'below',
75
  "link_force" => 'no',
76
  "cache" => 'on'
77
  ),
78
  "max-doc-security" => array(
79
- "desc" => __('Hide document location and text selection, prevent downloads', 'gde'),
80
  "viewer" => 'enhanced',
81
  "default_width" => '100%',
82
  "default_height" => '500px',
@@ -101,7 +101,7 @@ function gde_defaults( $type ) {
101
  "cache" => 'on'
102
  ),
103
  "dark" => array(
104
- "desc" => __('Dark-colored theme, example of custom CSS option', 'gde'),
105
  "viewer" => 'enhanced',
106
  "default_width" => '100%',
107
  "default_height" => '500px',
@@ -120,7 +120,7 @@ function gde_defaults( $type ) {
120
  "link_show" => 'all',
121
  "link_mask" => 'no',
122
  "link_block" => 'no',
123
- "link_text" => __('Download', 'gde') . ' (%TYPE, %SIZE)',
124
  "link_pos" => 'below',
125
  "link_force" => 'no',
126
  "cache" => 'on'
@@ -375,4 +375,4 @@ function gde_db_tables( $gde_db_ver ) {
375
  }
376
  }
377
 
378
- ?>
51
  // define default profile(s)
52
  $defpros = array(
53
  "default" => array(
54
+ "desc" => __('This is the default profile, used when no profile is specified.', 'google-document-embedder'),
55
  "viewer" => 'standard',
56
  "default_width" => '100%',
57
  "default_height" => '500px',
70
  "link_show" => 'all',
71
  "link_mask" => 'no',
72
  "link_block" => 'no',
73
+ "link_text" => __('Download', 'google-document-embedder') . ' (%TYPE, %SIZE)',
74
  "link_pos" => 'below',
75
  "link_force" => 'no',
76
  "cache" => 'on'
77
  ),
78
  "max-doc-security" => array(
79
+ "desc" => __('Hide document location and text selection, prevent downloads', 'google-document-embedder'),
80
  "viewer" => 'enhanced',
81
  "default_width" => '100%',
82
  "default_height" => '500px',
101
  "cache" => 'on'
102
  ),
103
  "dark" => array(
104
+ "desc" => __('Dark-colored theme, example of custom CSS option', 'google-document-embedder'),
105
  "viewer" => 'enhanced',
106
  "default_width" => '100%',
107
  "default_height" => '500px',
120
  "link_show" => 'all',
121
  "link_mask" => 'no',
122
  "link_block" => 'no',
123
+ "link_text" => __('Download', 'google-document-embedder') . ' (%TYPE, %SIZE)',
124
  "link_pos" => 'below',
125
  "link_force" => 'no',
126
  "cache" => 'on'
375
  }
376
  }
377
 
378
+ ?>
libs/tab-advanced.php CHANGED
@@ -16,53 +16,53 @@
16
  <?php wp_nonce_field('update-adv-opts', '_advanced'); ?>
17
 
18
  <?php gde_help_link( GDE_ADVOPT_URL, 'right' ); ?>
19
- <h3><?php _e('Plugin Behavior', 'gde'); ?></h3>
20
 
21
  <table class="form-table">
22
  <tbody>
23
  <tr valign="top">
24
- <th scope="row"><?php _e('Editor Integration', 'gde'); ?></th>
25
  <td>
26
  <?php
27
- gde_opts_checkbox( 'ed_disable', __('Disable all editor integration', 'gde'), '', 1 );
28
- gde_opts_checkbox( 'ed_embed_sc', __('Insert shortcode from Media Library by default', 'gde'), 'ed-embed', 1 );
29
- gde_opts_checkbox( 'ed_extend_upload', __('Allow uploads of all supported media types', 'gde'), 'ed-upload', 1 );
30
  ?>
31
  </td>
32
  </tr>
33
  <tr valign="top">
34
- <th scope="row"><?php _e('Maximum File Size', 'gde'); ?></th>
35
  <td>
36
  <?php
37
  gde_profile_text( $g['file_maxsize'], 'file_maxsize', '', 3 );
38
- echo " " . __('MB', 'gde') ."<br/>";
39
  ?>
40
- <span class="gde-fnote"><?php _e( "Very large files (typically 8-12MB) aren't supported by Google Doc Viewer", 'gde' ); ?></span>
41
  </td>
42
  </tr>
43
  <tr valign="top">
44
- <th scope="row"><?php _e('Error Handling', 'gde'); ?></th>
45
  <td>
46
  <?php
47
- gde_opts_checkbox( 'error_display', __('Show error messages inline (otherwise, they appear in HTML comments)', 'gde'), '', 1 );
48
- gde_opts_checkbox( 'error_check', __('Check for errors before loading viewer', 'gde'), '', 1 );
49
  if ( GDE_DX_LOGGING > 0 ) {
50
- gde_opts_checkbox( 'error_log', __('Enable extended diagnostic logging <em>(manually enabled)</em>', 'gde'), '', 0, true );
51
  } else {
52
- gde_opts_checkbox( 'error_log', __('Enable extended diagnostic logging', 'gde'), '', 0 );
53
 
54
- $tmp = __('clear log', 'gde'); // not implemented yet
55
  }
56
  if ( gde_log_available() ) {
57
  //$url = GDE_PLUGIN_URL . 'libs/lib-service.php?viewlog=all';
58
  echo '<span style="vertical-align:middle;">&nbsp;&nbsp; <a href="#viewlog" class="gde-viewlog" id="log-2">' .
59
- __('show log', 'gde') . '</a>';
60
  }
61
  ?>
62
  </td>
63
  </tr>
64
  <tr valign="top" style="display:none;">
65
- <th scope="row"><?php _e('Version Notifications', 'gde'); ?></th>
66
  <td>
67
  <input type="hidden" name="beta_check" value="no">
68
  <span class="gde-fnote" id="beta-h"></span>
@@ -71,28 +71,28 @@
71
  </tbody>
72
  </table>
73
 
74
- <h3><?php _e('Google Analytics', 'gde'); ?></h3>
75
 
76
- <?php _e('To use Google Analytics integration, the GA tracking code must already be installed on your site.', 'gde'); ?>
77
- <a href="https://developers.google.com/analytics/devguides/collection/gajs/asyncTracking" target="_blank"><?php _e('More Info', 'gde'); ?></a>
78
 
79
  <table class="form-table">
80
  <tbody>
81
  <tr valign="top">
82
- <th scope="row"><?php _e('Event Tracking', 'gde'); ?></th>
83
  <td>
84
  <select name="ga_enable" id="ga_enable">
85
  <?php
86
- gde_profile_option( $g['ga_enable'], 'yes', __('Enabled', 'gde'), __('Track events in Google Analytics', 'gde') );
87
- gde_profile_option( $g['ga_enable'], 'compat', __('Enabled (Compatibility Mode)', 'gde'), __('Track events using older GDE format (< 2.5)', 'gde') );
88
- gde_profile_option( $g['ga_enable'], 'no', __('None', 'gde'), __('Disable Google Analytics integration', 'gde') );
89
  ?>
90
- </select><br/>
91
  <span class="gde-fnote" id="ga-h"></span>
92
  </td>
93
  </tr>
94
  <tr valign="top" id="ga-cat">
95
- <th scope="row"><?php _e('Category', 'gde'); ?></th>
96
  <td>
97
  <?php
98
  gde_profile_text( $g['ga_category'], 'ga_category', '', 35 );
@@ -100,12 +100,12 @@
100
  </td>
101
  </tr>
102
  <tr valign="top" id="ga-label">
103
- <th scope="row"><?php _e('Label', 'gde'); ?></th>
104
  <td>
105
  <select name="ga_label" id="ga_label">
106
  <?php
107
- gde_profile_option( $g['ga_label'], 'url', __('Document URL', 'gde') );
108
- gde_profile_option( $g['ga_label'], 'file', __('Document Filename', 'gde') );
109
  ?>
110
  </select>
111
  </td>
@@ -114,7 +114,7 @@
114
  </table>
115
 
116
  <p class="gde-submit">
117
- <input id="adv-submit" class="button-primary" type="submit" value="<?php _e('Save Changes', 'gde'); ?>" name="submit">
118
  </p>
119
 
120
  </form>
@@ -122,24 +122,24 @@
122
  <br/>
123
  <form action="" method="post" id="gde-backup">
124
 
125
- <h3><?php _e('Backup and Import', 'gde'); ?></h3>
126
 
127
  <?php
128
  if ( ! $healthy ) {
129
- echo "<p>" . gde_show_error( __('Unable to load profile settings. Please re-activate GDE and if the problem persists, request help using the "Support" tab.', 'gde') ) . "</p>\n";
130
  } else {
131
  ?>
132
 
133
- <p><?php _e('Download a file to your computer containing your profiles, settings, or both, for backup or migration purposes.', 'gde'); ?></p>
134
 
135
  <p>
136
- <input type="radio" value="all" name="type" id="backup-all" checked="checked"><label for="backup-all"> <?php _e('All Profiles and Settings', 'gde'); ?></label> &nbsp;&nbsp;
137
- <input type="radio" value="profiles" name="type" id="backup-pro"><label for="backup-pro"> <?php _e('Profiles', 'gde'); ?></label> &nbsp;&nbsp;
138
- <input type="radio" value="settings" name="type" id="backup-set"><label for="backup-set"> <?php _e('Settings', 'gde'); ?></label>
139
  </p>
140
 
141
  <p class="submit" style="padding-top: 0 !important;">
142
- <input type="submit" value="<?php _e('Download Export File', 'gde'); ?>" class="button-secondary" id="export-submit" name="submit">
143
  </p>
144
  </form>
145
 
@@ -147,13 +147,13 @@
147
  <?php wp_nonce_field('import-opts', '_advanced_import'); ?>
148
 
149
  <p>
150
- <label for="upload"><?php _e('To import, choose a file from your computer:', 'gde'); ?></label>
151
  <input type="hidden" name="MAX_FILE_SIZE" value="<?php echo wp_max_upload_size(); ?>" />
152
  <input type="file" id="upload" name="import" size="25" />
153
  </p>
154
 
155
  <p class="submit" style="padding-top: 0 !important;">
156
- <input type="submit" name="submit" id="import-submit" class="button" value="<?php _e('Upload File and Import', 'gde'); ?>" />
157
  </p>
158
 
159
  <?php
16
  <?php wp_nonce_field('update-adv-opts', '_advanced'); ?>
17
 
18
  <?php gde_help_link( GDE_ADVOPT_URL, 'right' ); ?>
19
+ <h3><?php _e('Plugin Behavior', 'google-document-embedder'); ?></h3>
20
 
21
  <table class="form-table">
22
  <tbody>
23
  <tr valign="top">
24
+ <th scope="row"><?php _e('Editor Integration', 'google-document-embedder'); ?></th>
25
  <td>
26
  <?php
27
+ gde_opts_checkbox( 'ed_disable', __('Disable all editor integration', 'google-document-embedder'), '', 1 );
28
+ gde_opts_checkbox( 'ed_embed_sc', __('Insert shortcode from Media Library by default', 'google-document-embedder'), 'ed-embed', 1 );
29
+ gde_opts_checkbox( 'ed_extend_upload', __('Allow uploads of all supported media types', 'google-document-embedder'), 'ed-upload', 1 );
30
  ?>
31
  </td>
32
  </tr>
33
  <tr valign="top">
34
+ <th scope="row"><?php _e('Maximum File Size', 'google-document-embedder'); ?></th>
35
  <td>
36
  <?php
37
  gde_profile_text( $g['file_maxsize'], 'file_maxsize', '', 3 );
38
+ echo " " . __('MB', 'google-document-embedder') ."<br/>";
39
  ?>
40
+ <span class="gde-fnote"><?php _e( "Very large files (typically 8-12MB) aren't supported by Google Doc Viewer", 'google-document-embedder' ); ?></span>
41
  </td>
42
  </tr>
43
  <tr valign="top">
44
+ <th scope="row"><?php _e('Error Handling', 'google-document-embedder'); ?></th>
45
  <td>
46
  <?php
47
+ gde_opts_checkbox( 'error_display', __('Show error messages inline (otherwise, they appear in HTML comments)', 'google-document-embedder'), '', 1 );
48
+ gde_opts_checkbox( 'error_check', __('Check for errors before loading viewer', 'google-document-embedder'), '', 1 );
49
  if ( GDE_DX_LOGGING > 0 ) {
50
+ gde_opts_checkbox( 'error_log', __('Enable extended diagnostic logging <em>(manually enabled)</em>', 'google-document-embedder'), '', 0, true );
51
  } else {
52
+ gde_opts_checkbox( 'error_log', __('Enable extended diagnostic logging', 'google-document-embedder'), '', 0 );
53
 
54
+ $tmp = __('clear log', 'google-document-embedder'); // not implemented yet
55
  }
56
  if ( gde_log_available() ) {
57
  //$url = GDE_PLUGIN_URL . 'libs/lib-service.php?viewlog=all';
58
  echo '<span style="vertical-align:middle;">&nbsp;&nbsp; <a href="#viewlog" class="gde-viewlog" id="log-2">' .
59
+ __('show log', 'google-document-embedder') . '</a>';
60
  }
61
  ?>
62
  </td>
63
  </tr>
64
  <tr valign="top" style="display:none;">
65
+ <th scope="row"><?php _e('Version Notifications', 'google-document-embedder'); ?></th>
66
  <td>
67
  <input type="hidden" name="beta_check" value="no">
68
  <span class="gde-fnote" id="beta-h"></span>
71
  </tbody>
72
  </table>
73
 
74
+ <h3><?php _e('Google Analytics', 'google-document-embedder'); ?></h3>
75
 
76
+ <?php _e('To use Google Analytics integration, the GA tracking code must already be installed on your site.', 'google-document-embedder'); ?>
77
+ <a href="https://developers.google.com/analytics/devguides/collection/gajs/asyncTracking" target="_blank"><?php _e('More Info', 'google-document-embedder'); ?></a>
78
 
79
  <table class="form-table">
80
  <tbody>
81
  <tr valign="top">
82
+ <th scope="row"><?php _e('Event Tracking', 'google-document-embedder'); ?></th>
83
  <td>
84
  <select name="ga_enable" id="ga_enable">
85
  <?php
86
+ gde_profile_option( $g['ga_enable'], 'yes', __('Enabled', 'google-document-embedder'), __('Track events in Google Analytics (Note: does not support the latest Universal Analytics)', 'google-document-embedder') );
87
+ gde_profile_option( $g['ga_enable'], 'compat', __('Enabled (Compatibility Mode)', 'google-document-embedder'), __('Track events using older GDE format (< 2.5)', 'google-document-embedder') );
88
+ gde_profile_option( $g['ga_enable'], 'no', __('None', 'google-document-embedder'), __('Disable Google Analytics integration', 'google-document-embedder') );
89
  ?>
90
+ </select> <br/>
91
  <span class="gde-fnote" id="ga-h"></span>
92
  </td>
93
  </tr>
94
  <tr valign="top" id="ga-cat">
95
+ <th scope="row"><?php _e('Category', 'google-document-embedder'); ?></th>
96
  <td>
97
  <?php
98
  gde_profile_text( $g['ga_category'], 'ga_category', '', 35 );
100
  </td>
101
  </tr>
102
  <tr valign="top" id="ga-label">
103
+ <th scope="row"><?php _e('Label', 'google-document-embedder'); ?></th>
104
  <td>
105
  <select name="ga_label" id="ga_label">
106
  <?php
107
+ gde_profile_option( $g['ga_label'], 'url', __('Document URL', 'google-document-embedder') );
108
+ gde_profile_option( $g['ga_label'], 'file', __('Document Filename', 'google-document-embedder') );
109
  ?>
110
  </select>
111
  </td>
114
  </table>
115
 
116
  <p class="gde-submit">
117
+ <input id="adv-submit" class="button-primary" type="submit" value="<?php _e('Save Changes', 'google-document-embedder'); ?>" name="submit">
118
  </p>
119
 
120
  </form>
122
  <br/>
123
  <form action="" method="post" id="gde-backup">
124
 
125
+ <h3><?php _e('Backup and Import', 'google-document-embedder'); ?></h3>
126
 
127
  <?php
128
  if ( ! $healthy ) {
129
+ echo "<p>" . gde_show_error( __('Unable to load profile settings. Please re-activate GDE and if the problem persists, request help using the "Support" tab.', 'google-document-embedder') ) . "</p>\n";
130
  } else {
131
  ?>
132
 
133
+ <p><?php _e('Download a file to your computer containing your profiles, settings, or both, for backup or migration purposes.', 'google-document-embedder'); ?></p>
134
 
135
  <p>
136
+ <input type="radio" value="all" name="type" id="backup-all" checked="checked"><label for="backup-all"> <?php _e('All Profiles and Settings', 'google-document-embedder'); ?></label> &nbsp;&nbsp;
137
+ <input type="radio" value="profiles" name="type" id="backup-pro"><label for="backup-pro"> <?php _e('Profiles', 'google-document-embedder'); ?></label> &nbsp;&nbsp;
138
+ <input type="radio" value="settings" name="type" id="backup-set"><label for="backup-set"> <?php _e('Settings', 'google-document-embedder'); ?></label>
139
  </p>
140
 
141
  <p class="submit" style="padding-top: 0 !important;">
142
+ <input type="submit" value="<?php _e('Download Export File', 'google-document-embedder'); ?>" class="button-secondary" id="export-submit" name="submit">
143
  </p>
144
  </form>
145
 
147
  <?php wp_nonce_field('import-opts', '_advanced_import'); ?>
148
 
149
  <p>
150
+ <label for="upload"><?php _e('To import, choose a file from your computer:', 'google-document-embedder'); ?></label>
151
  <input type="hidden" name="MAX_FILE_SIZE" value="<?php echo wp_max_upload_size(); ?>" />
152
  <input type="file" id="upload" name="import" size="25" />
153
  </p>
154
 
155
  <p class="submit" style="padding-top: 0 !important;">
156
+ <input type="submit" name="submit" id="import-submit" class="button" value="<?php _e('Upload File and Import', 'google-document-embedder'); ?>" />
157
  </p>
158
 
159
  <?php
libs/tab-general.php CHANGED
@@ -10,4 +10,4 @@
10
 
11
  require_once( GDE_PLUGIN_DIR . "libs/lib-profile.php" );
12
  gde_profile_form();
13
- ?>
10
 
11
  require_once( GDE_PLUGIN_DIR . "libs/lib-profile.php" );
12
  gde_profile_form();
13
+ ?>
libs/tab-profiles.php CHANGED
@@ -17,7 +17,7 @@
17
 
18
  // check profile table health
19
  if ( ! $healthy ) {
20
- echo "<p>" . gde_show_error( __('Unable to load profile settings. Please re-activate GDE and if the problem persists, request help using the "Support" tab.', 'gde') ) . "</p>\n";
21
  } else {
22
  $profiles = gde_get_profiles();
23
 
@@ -31,26 +31,26 @@
31
  <thead>
32
  <tr>
33
  <th id="proid" class="manage-column column-proid" scope="col">
34
- <span><?php _e('ID', 'gde'); ?></span>
35
  </th>
36
  <th id="proname" class="manage-column column-name" scope="col">
37
- <span><?php _e('Name', 'gde'); ?></span>
38
  </th>
39
  <th id="description" class="manage-column column-description" scope="col">
40
- <span><?php _e('Description', 'gde'); ?></span>
41
  </th>
42
  </tr>
43
  </thead>
44
  <tfoot>
45
  <tr>
46
  <th class="manage-column column-proid" scope="col">
47
- <span><?php _e('ID', 'gde'); ?></span>
48
  </th>
49
  <th class="manage-column column-name" scope="col">
50
- <span><?php _e('Name', 'gde'); ?></span>
51
  </th>
52
  <th class="manage-column column-description" scope="col">
53
- <span><?php _e('Description', 'gde'); ?></span>
54
  </th>
55
  </tr>
56
  </tfoot>
@@ -80,7 +80,7 @@
80
  <?php echo $p['profile_name']; ?>
81
  </td>
82
  <td class="description column-description">
83
- <?php _e($p['profile_desc'], 'gde'); ?>
84
  </td>
85
  </tr>
86
  <?php
@@ -89,7 +89,7 @@
89
  </tbody>
90
  </table>
91
 
92
- <?php $tmp = __('Reset Profiles', 'gde'); // not implemented yet ?>
93
 
94
  </div>
95
  </div>
@@ -97,16 +97,16 @@
97
  <div class="col-wrap">
98
  <div class="form-wrap">
99
  <?php gde_help_link( GDE_PROOPT_URL, 'right' ); ?>
100
- <h3 class="gde-fix-h3"><?php _e('Add New Profile', 'gde'); ?></h3>
101
  <form action="" method="post">
102
  <?php wp_nonce_field('create-new-profile', '_profiles_new'); ?>
103
  <div class="form-field">
104
- <label for="profile-name"><?php _e('Name', 'gde'); ?></label>
105
  <input id="profile-name" type="text" style="width:45%;" value="" name="profile-name">
106
- <p><?php _e('The name (or ID number) is used to select the profile via the shortcode. It is all lowercase and contains only letters, numbers, and hyphens.', 'gde'); ?></p>
107
  </div>
108
  <div class="form-field">
109
- <label for="parent"><?php _e('Parent', 'gde'); ?></label>
110
  <select id="parent" class="postform" name="parent">
111
  <?php
112
  foreach ($profiles as $p) {
@@ -114,15 +114,15 @@
114
  }
115
  ?>
116
  </select>
117
- <p><?php _e('Select which profile to use as a starting point.', 'gde'); ?></p>
118
  </div>
119
  <div class="form-field">
120
- <label for="profile-description"><?php _e('Description', 'gde'); ?></label>
121
  <textarea id="profile-description" cols="25" rows="3" name="description"></textarea>
122
- <p><?php _e("Describe the profile's purpose, for your own reference (optional).", 'gde'); ?></p>
123
  </div>
124
  <p class="submit">
125
- <input id="profile-submit" class="button" type="submit" value="<?php _e('Add New Profile', 'gde'); ?>" name="submit">
126
  </p>
127
  </form>
128
  </div>
@@ -133,4 +133,4 @@
133
  <?php
134
  }
135
  }
136
- ?>
17
 
18
  // check profile table health
19
  if ( ! $healthy ) {
20
+ echo "<p>" . gde_show_error( __('Unable to load profile settings. Please re-activate GDE and if the problem persists, request help using the "Support" tab.', 'google-document-embedder') ) . "</p>\n";
21
  } else {
22
  $profiles = gde_get_profiles();
23
 
31
  <thead>
32
  <tr>
33
  <th id="proid" class="manage-column column-proid" scope="col">
34
+ <span><?php _e('ID', 'google-document-embedder'); ?></span>
35
  </th>
36
  <th id="proname" class="manage-column column-name" scope="col">
37
+ <span><?php _e('Name', 'google-document-embedder'); ?></span>
38
  </th>
39
  <th id="description" class="manage-column column-description" scope="col">
40
+ <span><?php _e('Description', 'google-document-embedder'); ?></span>
41
  </th>
42
  </tr>
43
  </thead>
44
  <tfoot>
45
  <tr>
46
  <th class="manage-column column-proid" scope="col">
47
+ <span><?php _e('ID', 'google-document-embedder'); ?></span>
48
  </th>
49
  <th class="manage-column column-name" scope="col">
50
+ <span><?php _e('Name', 'google-document-embedder'); ?></span>
51
  </th>
52
  <th class="manage-column column-description" scope="col">
53
+ <span><?php _e('Description', 'google-document-embedder'); ?></span>
54
  </th>
55
  </tr>
56
  </tfoot>
80
  <?php echo $p['profile_name']; ?>
81
  </td>
82
  <td class="description column-description">
83
+ <?php _e($p['profile_desc'], 'google-document-embedder'); ?>
84
  </td>
85
  </tr>
86
  <?php
89
  </tbody>
90
  </table>
91
 
92
+ <?php $tmp = __('Reset Profiles', 'google-document-embedder'); // not implemented yet ?>
93
 
94
  </div>
95
  </div>
97
  <div class="col-wrap">
98
  <div class="form-wrap">
99
  <?php gde_help_link( GDE_PROOPT_URL, 'right' ); ?>
100
+ <h3 class="gde-fix-h3"><?php _e('Add New Profile', 'google-document-embedder'); ?></h3>
101
  <form action="" method="post">
102
  <?php wp_nonce_field('create-new-profile', '_profiles_new'); ?>
103
  <div class="form-field">
104
+ <label for="profile-name"><?php _e('Name', 'google-document-embedder'); ?></label>
105
  <input id="profile-name" type="text" style="width:45%;" value="" name="profile-name">
106
+ <p><?php _e('The name (or ID number) is used to select the profile via the shortcode. It is all lowercase and contains only letters, numbers, and hyphens.', 'google-document-embedder'); ?></p>
107
  </div>
108
  <div class="form-field">
109
+ <label for="parent"><?php _e('Parent', 'google-document-embedder'); ?></label>
110
  <select id="parent" class="postform" name="parent">
111
  <?php
112
  foreach ($profiles as $p) {
114
  }
115
  ?>
116
  </select>
117
+ <p><?php _e('Select which profile to use as a starting point.', 'google-document-embedder'); ?></p>
118
  </div>
119
  <div class="form-field">
120
+ <label for="profile-description"><?php _e('Description', 'google-document-embedder'); ?></label>
121
  <textarea id="profile-description" cols="25" rows="3" name="description"></textarea>
122
+ <p><?php _e("Describe the profile's purpose, for your own reference (optional).", 'google-document-embedder'); ?></p>
123
  </div>
124
  <p class="submit">
125
+ <input id="profile-submit" class="button" type="submit" value="<?php _e('Add New Profile', 'google-document-embedder'); ?>" name="submit">
126
  </p>
127
  </form>
128
  </div>
133
  <?php
134
  }
135
  }
136
+ ?>
libs/tab-support.php CHANGED
@@ -27,65 +27,65 @@
27
  ?>
28
 
29
  <div class="gde-support-warn">
30
- <p><strong><?php _e('Most support questions have already been answered. Please review these pages before asking for support:', 'gde'); ?></strong></p>
31
  <ul style="list-style-type:square; padding-left:25px;line-height:1em;">
32
- <li><a href="<?php echo $pdata['PluginURI']; ?>/notes/">Google Doc Embedder <?php _e('Help', 'gde'); ?></a></li>
33
- <li><a href="<?php echo GDE_WP_URL; ?>faq/"><?php _e('Plugin FAQ', 'gde'); ?></a></li>
34
  </ul>
35
  </div>
36
  <br clear="both" />
37
 
38
  <form action="<?php echo GDE_PLUGIN_URL;?>libs/lib-formsubmit.php" id="debugForm">
39
 
40
- <h3><?php _e('Support Request', 'gde'); ?></h3>
41
- <p><?php _e("Requests sent from this form are handled by an actual human, so please don't send test messages or other spam.", 'gde'); ?></p>
42
 
43
  <table class="form-table">
44
  <tr valign="top">
45
- <th scope="row"><label for="sender_name" id="name_label"><?php _e('Your Name', 'gde'); ?></label></th>
46
  <td><input size="25" name="name" id="sender_name" value="<?php echo $name; ?>" type="text"></td>
47
  </tr>
48
  <tr valign="top">
49
- <th scope="row"><label for="sender" id="sender_label"><?php _e('Your E-mail', 'gde'); ?>*</label></th>
50
  <td>
51
  <input size="25" name="email" id="sender" value="<?php echo $email; ?>" type="text">
52
- <div id="err_email" class="err" style="color:red;font-weight:bold;display:none;"><?php _e('A valid email address is required.', 'gde'); ?></div>
53
  </td>
54
  </tr>
55
  <tr valign="top">
56
- <th scope="row"><label for="sc" id="sc_label"><?php _e('Shortcode', 'gde'); ?></label></th>
57
  <td>
58
  <input size="50" name="shortcode" id="sc" value="" type="text" placeholder="[gview file=&quot;...&quot;]"><br/>
59
- <em><?php _e("If you're having a problem getting a specific document to work, paste the shortcode you're trying to use here.", 'gde'); ?></em>
60
  </td>
61
  </tr>
62
  <tr valign="top">
63
- <th scope="row"><label for="url" id="url_label"><?php _e('URL', 'gde'); ?></label></th>
64
  <td>
65
  <input size="50" name="url" id="url" value="" type="text" placeholder="http://..."><br/>
66
- <em><?php _e("Paste the full web address of a page where I should be able to see the problem occurring.", 'gde'); ?></em>
67
  </td>
68
  </tr>
69
  <tr valign="top">
70
- <th scope="row"><label for="msg" id="msg_label"><?php _e('Message', 'gde'); ?>*</label></th>
71
  <td>
72
  <textarea name="message" id="msg" style="width:75%;min-height:50px;"></textarea>
73
  </td>
74
  </tr>
75
  <tr valign="top">
76
- <th scope="row"><?php _e('Message Options', 'gde'); ?></th>
77
  <td>
78
- <input type="checkbox" name="senddb" id="senddb" checked="checked"> <label for="senddb" id="senddb_label"><?php _e('Send debug information', 'gde'); ?></label>
79
- <span id="dbinfo-show">(<a href="javascript:void(0);" id="ta_toggleon"><?php _e('View', 'gde'); ?></a>)<br/></span>
80
- <span id="dbinfo-hide" style="display: none;">(<a href="javascript:void(0);" id="ta_toggleoff"><?php _e('Hide', 'gde'); ?></a>)<br/></span>
81
- <input type="checkbox" name="cc" id="cc"> <label for="cc" id="cc_label"><?php _e('Send me a copy', 'gde'); ?></label>
82
  </td>
83
  </tr>
84
  <tr>
85
  <td colspan="2">
86
  <div id="debugblock" style="display:none;">
87
- <p><strong><?php _e('Debug Information', 'gde'); ?>:</strong><br/>
88
- <?php _e('Note: Profile and settings export and diagnostic log (if present) will be attached.', 'gde'); ?></p>
89
  <textarea name="debug" id="debugtxt" style="width:100%;min-height:200px;font-family:monospace;" readonly="readonly">
90
  <?php
91
 
@@ -159,15 +159,15 @@
159
  </div>
160
 
161
  <div id="debugwarn" style="display:none;color:red;font-weight:bold;">
162
- <p><?php _e("I'm less likely to be able to help you if you do not include debug information.", 'gde'); ?></p>
163
  </div>
164
- <input id="debugsend" class="button-primary" type="submit" value="<?php _e('Send Request', 'gde'); ?>" name="submit">
165
  <span id="formstatus" style="padding-left:20px;display:none;">
166
  <img src="<?php echo GDE_PLUGIN_URL;?>img/in-proc.gif" alt="">
167
  </span>
168
- <span id="doneconfirm" style="display: none;"> <?php _e('Request Sent', 'gde'); ?></span>
169
- <span id="failconfirm" style="display: none;"> <?php _e('Delivery failed. You can manually send this information to wpp@tnw.org for help.', 'gde'); ?></span>
170
  </td>
171
  </tr>
172
  </table>
173
- </form>
27
  ?>
28
 
29
  <div class="gde-support-warn">
30
+ <p><strong><?php _e('Most support questions have already been answered. Please review these pages before asking for support:', 'google-document-embedder'); ?></strong></p>
31
  <ul style="list-style-type:square; padding-left:25px;line-height:1em;">
32
+ <li><a href="<?php echo $pdata['PluginURI']; ?>/notes/">Google Doc Embedder <?php _e('Help', 'google-document-embedder'); ?></a></li>
33
+ <li><a href="<?php echo GDE_WP_URL; ?>faq/"><?php _e('Plugin FAQ', 'google-document-embedder'); ?></a></li>
34
  </ul>
35
  </div>
36
  <br clear="both" />
37
 
38
  <form action="<?php echo GDE_PLUGIN_URL;?>libs/lib-formsubmit.php" id="debugForm">
39
 
40
+ <h3><?php _e('Support Request', 'google-document-embedder'); ?></h3>
41
+ <p><?php _e("Requests sent from this form are handled by an actual human, so please don't send test messages or other spam.", 'google-document-embedder'); ?></p>
42
 
43
  <table class="form-table">
44
  <tr valign="top">
45
+ <th scope="row"><label for="sender_name" id="name_label"><?php _e('Your Name', 'google-document-embedder'); ?></label></th>
46
  <td><input size="25" name="name" id="sender_name" value="<?php echo $name; ?>" type="text"></td>
47
  </tr>
48
  <tr valign="top">
49
+ <th scope="row"><label for="sender" id="sender_label"><?php _e('Your E-mail', 'google-document-embedder'); ?>*</label></th>
50
  <td>
51
  <input size="25" name="email" id="sender" value="<?php echo $email; ?>" type="text">
52
+ <div id="err_email" class="err" style="color:red;font-weight:bold;display:none;"><?php _e('A valid email address is required.', 'google-document-embedder'); ?></div>
53
  </td>
54
  </tr>
55
  <tr valign="top">
56
+ <th scope="row"><label for="sc" id="sc_label"><?php _e('Shortcode', 'google-document-embedder'); ?></label></th>
57
  <td>
58
  <input size="50" name="shortcode" id="sc" value="" type="text" placeholder="[gview file=&quot;...&quot;]"><br/>
59
+ <em><?php _e("If you're having a problem getting a specific document to work, paste the shortcode you're trying to use here.", 'google-document-embedder'); ?></em>
60
  </td>
61
  </tr>
62
  <tr valign="top">
63
+ <th scope="row"><label for="url" id="url_label"><?php _e('URL', 'google-document-embedder'); ?></label></th>
64
  <td>
65
  <input size="50" name="url" id="url" value="" type="text" placeholder="http://..."><br/>
66
+ <em><?php _e("Paste the full web address of a page where I should be able to see the problem occurring.", 'google-document-embedder'); ?></em>
67
  </td>
68
  </tr>
69
  <tr valign="top">
70
+ <th scope="row"><label for="msg" id="msg_label"><?php _e('Message', 'google-document-embedder'); ?>*</label></th>
71
  <td>
72
  <textarea name="message" id="msg" style="width:75%;min-height:50px;"></textarea>
73
  </td>
74
  </tr>
75
  <tr valign="top">
76
+ <th scope="row"><?php _e('Message Options', 'google-document-embedder'); ?></th>
77
  <td>
78
+ <input type="checkbox" name="senddb" id="senddb" checked="checked"> <label for="senddb" id="senddb_label"><?php _e('Send debug information', 'google-document-embedder'); ?></label>
79
+ <span id="dbinfo-show">(<a href="javascript:void(0);" id="ta_toggleon"><?php _e('View', 'google-document-embedder'); ?></a>)<br/></span>
80
+ <span id="dbinfo-hide" style="display: none;">(<a href="javascript:void(0);" id="ta_toggleoff"><?php _e('Hide', 'google-document-embedder'); ?></a>)<br/></span>
81
+ <input type="checkbox" name="cc" id="cc"> <label for="cc" id="cc_label"><?php _e('Send me a copy', 'google-document-embedder'); ?></label>
82
  </td>
83
  </tr>
84
  <tr>
85
  <td colspan="2">
86
  <div id="debugblock" style="display:none;">
87
+ <p><strong><?php _e('Debug Information', 'google-document-embedder'); ?>:</strong><br/>
88
+ <?php _e('Note: Profile and settings export and diagnostic log (if present) will be attached.', 'google-document-embedder'); ?></p>
89
  <textarea name="debug" id="debugtxt" style="width:100%;min-height:200px;font-family:monospace;" readonly="readonly">
90
  <?php
91
 
159
  </div>
160
 
161
  <div id="debugwarn" style="display:none;color:red;font-weight:bold;">
162
+ <p><?php _e("I'm less likely to be able to help you if you do not include debug information.", 'google-document-embedder'); ?></p>
163
  </div>
164
+ <input id="debugsend" class="button-primary" type="submit" value="<?php _e('Send Request', 'google-document-embedder'); ?>" name="submit">
165
  <span id="formstatus" style="padding-left:20px;display:none;">
166
  <img src="<?php echo GDE_PLUGIN_URL;?>img/in-proc.gif" alt="">
167
  </span>
168
+ <span id="doneconfirm" style="display: none;"> <?php _e('Request Sent', 'google-document-embedder'); ?></span>
169
+ <span id="failconfirm" style="display: none;"> <?php _e('Delivery failed. You can manually send this information to wpp@tnw.org for help.', 'google-document-embedder'); ?></span>
170
  </td>
171
  </tr>
172
  </table>
173
+ </form>
load.php CHANGED
@@ -42,7 +42,7 @@ if ( isset( $_GET['d'] ) ) {
42
 
43
  if ( ! $allowed || ! isset( $_GET['s'] ) ) {
44
  // file blocked or not defined
45
- wp_die( __('Direct access to this file is not permitted.', 'gde') );
46
  } else {
47
  $code = $_GET['s'];
48
  }
@@ -68,12 +68,12 @@ if ( ! empty( $data ) ) {
68
  $contents = wp_remote_fopen( $url );
69
  } else {
70
  // code doesn't exist
71
- wp_die( __('The requested file was not found.', 'gde') );
72
  }
73
 
74
  if ( ! $contents || empty( $contents ) ) {
75
  // got nothing of merit
76
- wp_die( __('Unable to open the requested file. ', 'gde') );
77
  } else {
78
  global $gdetypes;
79
 
@@ -89,11 +89,11 @@ if ( ! $contents || empty( $contents ) ) {
89
  if ( array_key_exists( $ext, $gdetypes ) ) {
90
  $type = $gdetypes[$ext];
91
  } else {
92
- wp_die( __('The document file type is not supported.', 'gde') );
93
  }
94
  } else {
95
  // file has no extension
96
- wp_die( __('The document file type is not supported.', 'gde') );
97
  }
98
 
99
  // output document
@@ -103,4 +103,4 @@ if ( ! $contents || empty( $contents ) ) {
103
  echo $contents;
104
  }
105
 
106
- ?>
42
 
43
  if ( ! $allowed || ! isset( $_GET['s'] ) ) {
44
  // file blocked or not defined
45
+ wp_die( __('Direct access to this file is not permitted.', 'google-document-embedder') );
46
  } else {
47
  $code = $_GET['s'];
48
  }
68
  $contents = wp_remote_fopen( $url );
69
  } else {
70
  // code doesn't exist
71
+ wp_die( __('The requested file was not found.', 'google-document-embedder') );
72
  }
73
 
74
  if ( ! $contents || empty( $contents ) ) {
75
  // got nothing of merit
76
+ wp_die( __('Unable to open the requested file. ', 'google-document-embedder') );
77
  } else {
78
  global $gdetypes;
79
 
89
  if ( array_key_exists( $ext, $gdetypes ) ) {
90
  $type = $gdetypes[$ext];
91
  } else {
92
+ wp_die( __('The document file type is not supported.', 'google-document-embedder') );
93
  }
94
  } else {
95
  // file has no extension
96
+ wp_die( __('The document file type is not supported.', 'google-document-embedder') );
97
  }
98
 
99
  // output document
103
  echo $contents;
104
  }
105
 
106
+ ?>
options.php CHANGED
@@ -10,9 +10,9 @@ if ( isset( $_POST['_general_default'] ) ) {
10
 
11
  if ( gde_form_to_profile( 1, $_POST ) ) {
12
  // update successful
13
- gde_show_msg( __('Default profile <strong>updated</strong>.', 'gde') );
14
  } else {
15
- gde_show_msg( __('Unable to update profile.', 'gde'), true );
16
  }
17
  } elseif ( isset( $_POST['_profiles_new'] ) ) {
18
  // new profile creation
@@ -25,22 +25,22 @@ if ( isset( $_POST['_general_default'] ) ) {
25
 
26
  if ( ! preg_match( '/[\pL]/u', $name ) ) {
27
  // profile name doesn't contain any letter - possible ID conflict
28
- gde_show_msg( __('Profile name must contain at least one letter.', 'gde'), true );
29
  } elseif ( gde_profile_name_exists( $name ) !== -1 ) {
30
  // profile name is duplicate
31
- gde_show_msg( __('Profile name already exists. Please choose another name.', 'gde'), true );
32
  } elseif ( gde_profile_to_profile( $_POST['parent'], $name, stripslashes( $_POST['description'] ) ) ) {
33
  // intercept and redirect to edit profile page
34
  $lastid = gde_profile_name_exists( $name );
35
  $_POST['action'] = "edit";
36
  $_POST['profile'] = $lastid;
37
  $noload = "gentab";
38
- gde_show_msg( __('New profile <strong>created</strong>.', 'gde') );
39
  } else {
40
- gde_show_msg( __('Unable to create profile.', 'gde'), true );
41
  }
42
  } else {
43
- gde_show_msg( __('Unable to create profile.', 'gde'), true );
44
  }
45
  } elseif ( isset( $_POST['_profile_edit'] ) ) {
46
  // profile edit
@@ -48,9 +48,9 @@ if ( isset( $_POST['_general_default'] ) ) {
48
 
49
  if ( gde_form_to_profile( $_POST['profile_id'], $_POST ) ) {
50
  // update successful
51
- gde_show_msg( __('Profile <strong>updated</strong>.', 'gde') );
52
  } else {
53
- gde_show_msg( __('Unable to update profile.', 'gde'), true );
54
  }
55
  } elseif ( isset( $_POST['action'] ) && isset( $_POST['profile'] ) ) {
56
  // profile row action
@@ -58,14 +58,14 @@ if ( isset( $_POST['_general_default'] ) ) {
58
  if ( $_POST['action'] == "delete" ) {
59
  $tabid = "protab";
60
  if ( gde_delete_profile( $_POST['profile'] ) ) {
61
- gde_show_msg( __('Profile <strong>deleted</strong>.', 'gde') );
62
  } else {
63
- gde_show_msg( __('Unable to delete profile.', 'gde'), true );
64
  }
65
  } elseif ( $_POST['action'] == "default" ) {
66
  $tabid = "gentab";
67
  if ( gde_overwrite_profile( $_POST['profile'] ) ) {
68
- gde_show_msg( __('Default profile <strong>updated</strong>.', 'gde') );
69
  }
70
  } elseif ( $_POST['action'] == "edit" ) {
71
  $tabid = "protab";
@@ -102,7 +102,7 @@ if ( isset( $_POST['_general_default'] ) ) {
102
  if ( ! isset( $oldoptions['error_log'] ) || $oldoptions['error_log'] == "no" ) {
103
  if ( ! gde_dx_log("Diagnostic logging enabled") ) {
104
  // can't write to db - don't enable logging
105
- gde_show_msg( __('Unable to enable diagnostic logging.', 'gde'), true );
106
  $gdeoptions[$k] = "no";
107
  }
108
  }
@@ -114,9 +114,9 @@ if ( isset( $_POST['_general_default'] ) ) {
114
 
115
  if ( update_option( 'gde_options', $gdeoptions ) ) {
116
  // update successful
117
- gde_show_msg( __('Settings <strong>updated</strong>.', 'gde') );
118
  } else {
119
- gde_show_msg( __('Settings <strong>updated</strong>.', 'gde') ); // not true, but avoids confusion in case where no changes were made
120
  gde_dx_log('Settings update failed - maybe no changes');
121
  }
122
  } elseif ( isset( $_POST['_advanced_import'] ) ) {
@@ -138,7 +138,7 @@ if ( isset( $_POST['_general_default'] ) ) {
138
 
139
  if ( ! $valid ) {
140
  $tabid = "advtab";
141
- gde_show_msg( __('Please select a valid export file to import.', 'gde'), true );
142
  } else {
143
  // process and import
144
  $import = true;
@@ -165,12 +165,8 @@ if ( ! $import ) {
165
 
166
  <div class="wrap">
167
  <div class="icon32" id="icon-options-general"></div>
168
- <h2>Google Doc Embedder <?php _e('Settings', 'gde'); ?></h2>
169
-
170
- <p><em>Please see the notice on our
171
- <a href="https://wordpress.org/plugins/google-document-embedder/" target="_blank">plugin homepage</a> to find out about recent changes to the Google Viewer.
172
- </em></p>
173
-
174
  <div id="gdeadmintabs" class="ui-tabs ui-widget ui-widget-content ui-corner-all">
175
  <ul class="nav-tab-wrapper ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all">
176
  <?php
@@ -178,12 +174,12 @@ if ( ! $import ) {
178
  ?>
179
  <li id="gentab" class="ui-state-default ui-corner-top ui-tabs-selected ui-state-active">
180
  <a href="#general" class="nav-tab">
181
- <span><?php _e('General', 'gde'); ?></span>
182
  </a>
183
  </li>
184
  <li id="protab" class="ui-state-default ui-corner-top">
185
  <a href="#profiles" class="nav-tab">
186
- <span><?php _e('Profiles', 'gde'); ?></span>
187
  </a>
188
  </li>
189
  <?php
@@ -191,12 +187,12 @@ if ( ! $import ) {
191
  ?>
192
  <li id="gentab-reload" class="ui-state-default ui-corner-top">
193
  <a href="#general" class="nav-tab">
194
- <span><?php _e('General', 'gde'); ?></span>
195
  </a>
196
  </li>
197
  <li id="protab" class="ui-state-default ui-corner-top ui-tabs-selected ui-state-active">
198
  <a href="#profiles" class="nav-tab">
199
- <span><?php _e('Profiles', 'gde'); ?></span>
200
  </a>
201
  </li>
202
  <?php
@@ -204,12 +200,12 @@ if ( ! $import ) {
204
  ?>
205
  <li id="advtab" class="ui-state-default ui-corner-top">
206
  <a href="#advanced" class="nav-tab">
207
- <span><?php _e('Advanced', 'gde'); ?></span>
208
  </a>
209
  </li>
210
  <!--li id="suptab" class="ui-state-default ui-corner-top">
211
  <a href="#support" class="nav-tab">
212
- <span><?php _e('Support', 'gde'); ?></span>
213
  </a>
214
  </li-->
215
  </ul>
@@ -258,9 +254,9 @@ function gde_opts_checkbox( $field, $label, $wrap = '', $br = '', $disabled = fa
258
  global $gdeoptions;
259
 
260
  if ( ! empty( $wrap ) ) {
261
- echo '<span id="'.$wrap.'">';
262
  }
263
- echo '<input type="checkbox" id="'.$field.'" name="'.$field.'"';
264
  if ( ( isset( $gdeoptions[$field] ) && $gdeoptions[$field] == "yes" ) || ( $disabled ) ) {
265
  echo ' checked="checked"';
266
  }
@@ -269,7 +265,7 @@ function gde_opts_checkbox( $field, $label, $wrap = '', $br = '', $disabled = fa
269
  echo ' disabled="disabled"';
270
  }
271
 
272
- echo ' value="'.$field.'"> <label for="'.$field.'">'.$label.'</label>';
273
  if ( ! empty( $br ) ) {
274
  echo '<br/>';
275
  }
@@ -279,9 +275,9 @@ function gde_opts_checkbox( $field, $label, $wrap = '', $br = '', $disabled = fa
279
  }
280
 
281
  function gde_profile_option( $option, $value, $label, $helptext = '' ) {
282
- echo "<option value=\"$value\"";
283
  if ( ! empty( $helptext ) ) {
284
- echo " title=\"$helptext\"";
285
  }
286
  if ( $option == $value ) {
287
  echo ' selected="selected"';
@@ -291,9 +287,9 @@ function gde_profile_option( $option, $value, $label, $helptext = '' ) {
291
 
292
  function gde_profile_checkbox( $option, $field, $label, $wrap = '', $br = '' ) {
293
  if ( ! empty( $wrap ) ) {
294
- echo '<span id="'.$wrap.'">';
295
  }
296
- echo '<input type="checkbox" id="'.$field.'" name="'.$field.'"';
297
 
298
  // toolbar items
299
  if ( substr( $field, 0, 5 ) == "gdet_" ) {
@@ -325,7 +321,7 @@ function gde_profile_checkbox( $option, $field, $label, $wrap = '', $br = '' ) {
325
  echo ' checked="checked"';
326
  }
327
 
328
- echo ' value="'.$field.'"> <label for="'.$field.'">'.$label.'</label>';
329
  if ( ! empty( $br ) ) {
330
  echo '<br/>';
331
  }
@@ -335,12 +331,12 @@ function gde_profile_checkbox( $option, $field, $label, $wrap = '', $br = '' ) {
335
  }
336
 
337
  function gde_profile_text( $option, $field, $class = '', $size = '', $enabled = true ) {
338
- echo '<input type="text" id="'.$field.'" name="'.$field.'" value="'.$option.'"';
339
  if ( ! empty( $class ) ) {
340
- echo ' class="'.$class.'"';
341
  }
342
  if ( ! empty( $size ) ) {
343
- echo ' size="'.$size.'"';
344
  }
345
  if ( $enabled === false ) {
346
  echo ' disabled="disabled"';
@@ -350,14 +346,14 @@ function gde_profile_text( $option, $field, $class = '', $size = '', $enabled =
350
  }
351
 
352
  function gde_help_link( $url, $float = '' ) {
353
- $title = __('Help', 'gde');
354
  $img = GDE_PLUGIN_URL . "img/help.png";
355
 
356
  if ( ! empty( $float ) ) {
357
- echo '<div style="float:'.$float.';">';
358
  }
359
 
360
- echo '<a href="'.$url.'" target="_blank" title="'.$title.'"><img src="'.$img.'" alt="?"></a>';
361
 
362
  if ( ! empty( $float ) ) {
363
  echo "</div>\n";
@@ -369,16 +365,16 @@ function gde_row_cb( $pid ) {
369
  if ( $pid == 1 ) {
370
  return " ";
371
  } else {
372
- return '<input type="checkbox" value="'.$pid.'" name="delete_tags[]">';
373
  }
374
  }
375
 
376
  function gde_row_actions( $pid ) {
377
  $actions = array(
378
  // action name => arr ( label, class )
379
- "edit" => array( __('Edit', 'gde'), 'edit' ),
380
- "delete" => array( __('Delete', 'gde'), 'delete' ),
381
- "default" => array( __('Make Default', 'gde'), 'default' )
382
  );
383
 
384
  // protect default profile
@@ -387,11 +383,11 @@ function gde_row_actions( $pid ) {
387
  }
388
 
389
  foreach ($actions as $k => $v) {
390
- $act[] = '<span class="'.$v[1].'" id="'.$k.'-'.$pid.'"><a href="options-general.php?page=gde-settings">'.$v[0].'</a></span>';
391
  }
392
  $acts = implode( " | ", $act );
393
 
394
  return $acts;
395
  }
396
 
397
- ?>
10
 
11
  if ( gde_form_to_profile( 1, $_POST ) ) {
12
  // update successful
13
+ gde_show_msg( __('Default profile <strong>updated</strong>.', 'google-document-embedder') );
14
  } else {
15
+ gde_show_msg( __('Unable to update profile.', 'google-document-embedder'), true );
16
  }
17
  } elseif ( isset( $_POST['_profiles_new'] ) ) {
18
  // new profile creation
25
 
26
  if ( ! preg_match( '/[\pL]/u', $name ) ) {
27
  // profile name doesn't contain any letter - possible ID conflict
28
+ gde_show_msg( __('Profile name must contain at least one letter.', 'google-document-embedder'), true );
29
  } elseif ( gde_profile_name_exists( $name ) !== -1 ) {
30
  // profile name is duplicate
31
+ gde_show_msg( __('Profile name already exists. Please choose another name.', 'google-document-embedder'), true );
32
  } elseif ( gde_profile_to_profile( $_POST['parent'], $name, stripslashes( $_POST['description'] ) ) ) {
33
  // intercept and redirect to edit profile page
34
  $lastid = gde_profile_name_exists( $name );
35
  $_POST['action'] = "edit";
36
  $_POST['profile'] = $lastid;
37
  $noload = "gentab";
38
+ gde_show_msg( __('New profile <strong>created</strong>.', 'google-document-embedder') );
39
  } else {
40
+ gde_show_msg( __('Unable to create profile.', 'google-document-embedder'), true );
41
  }
42
  } else {
43
+ gde_show_msg( __('Unable to create profile.', 'google-document-embedder'), true );
44
  }
45
  } elseif ( isset( $_POST['_profile_edit'] ) ) {
46
  // profile edit
48
 
49
  if ( gde_form_to_profile( $_POST['profile_id'], $_POST ) ) {
50
  // update successful
51
+ gde_show_msg( __('Profile <strong>updated</strong>.', 'google-document-embedder') );
52
  } else {
53
+ gde_show_msg( __('Unable to update profile.', 'google-document-embedder'), true );
54
  }
55
  } elseif ( isset( $_POST['action'] ) && isset( $_POST['profile'] ) ) {
56
  // profile row action
58
  if ( $_POST['action'] == "delete" ) {
59
  $tabid = "protab";
60
  if ( gde_delete_profile( $_POST['profile'] ) ) {
61
+ gde_show_msg( __('Profile <strong>deleted</strong>.', 'google-document-embedder') );
62
  } else {
63
+ gde_show_msg( __('Unable to delete profile.', 'google-document-embedder'), true );
64
  }
65
  } elseif ( $_POST['action'] == "default" ) {
66
  $tabid = "gentab";
67
  if ( gde_overwrite_profile( $_POST['profile'] ) ) {
68
+ gde_show_msg( __('Default profile <strong>updated</strong>.', 'google-document-embedder') );
69
  }
70
  } elseif ( $_POST['action'] == "edit" ) {
71
  $tabid = "protab";
102
  if ( ! isset( $oldoptions['error_log'] ) || $oldoptions['error_log'] == "no" ) {
103
  if ( ! gde_dx_log("Diagnostic logging enabled") ) {
104
  // can't write to db - don't enable logging
105
+ gde_show_msg( __('Unable to enable diagnostic logging.', 'google-document-embedder'), true );
106
  $gdeoptions[$k] = "no";
107
  }
108
  }
114
 
115
  if ( update_option( 'gde_options', $gdeoptions ) ) {
116
  // update successful
117
+ gde_show_msg( __('Settings <strong>updated</strong>.', 'google-document-embedder') );
118
  } else {
119
+ gde_show_msg( __('Settings <strong>updated</strong>.', 'google-document-embedder') ); // not true, but avoids confusion in case where no changes were made
120
  gde_dx_log('Settings update failed - maybe no changes');
121
  }
122
  } elseif ( isset( $_POST['_advanced_import'] ) ) {
138
 
139
  if ( ! $valid ) {
140
  $tabid = "advtab";
141
+ gde_show_msg( __('Please select a valid export file to import.', 'google-document-embedder'), true );
142
  } else {
143
  // process and import
144
  $import = true;
165
 
166
  <div class="wrap">
167
  <div class="icon32" id="icon-options-general"></div>
168
+ <h2>Google Doc Embedder <?php _e('Settings', 'google-document-embedder'); ?></h2>
169
+
 
 
 
 
170
  <div id="gdeadmintabs" class="ui-tabs ui-widget ui-widget-content ui-corner-all">
171
  <ul class="nav-tab-wrapper ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all">
172
  <?php
174
  ?>
175
  <li id="gentab" class="ui-state-default ui-corner-top ui-tabs-selected ui-state-active">
176
  <a href="#general" class="nav-tab">
177
+ <span><?php _e('General', 'google-document-embedder'); ?></span>
178
  </a>
179
  </li>
180
  <li id="protab" class="ui-state-default ui-corner-top">
181
  <a href="#profiles" class="nav-tab">
182
+ <span><?php _e('Profiles', 'google-document-embedder'); ?></span>
183
  </a>
184
  </li>
185
  <?php
187
  ?>
188
  <li id="gentab-reload" class="ui-state-default ui-corner-top">
189
  <a href="#general" class="nav-tab">
190
+ <span><?php _e('General', 'google-document-embedder'); ?></span>
191
  </a>
192
  </li>
193
  <li id="protab" class="ui-state-default ui-corner-top ui-tabs-selected ui-state-active">
194
  <a href="#profiles" class="nav-tab">
195
+ <span><?php _e('Profiles', 'google-document-embedder'); ?></span>
196
  </a>
197
  </li>
198
  <?php
200
  ?>
201
  <li id="advtab" class="ui-state-default ui-corner-top">
202
  <a href="#advanced" class="nav-tab">
203
+ <span><?php _e('Advanced', 'google-document-embedder'); ?></span>
204
  </a>
205
  </li>
206
  <!--li id="suptab" class="ui-state-default ui-corner-top">
207
  <a href="#support" class="nav-tab">
208
+ <span><?php _e('Support', 'google-document-embedder'); ?></span>
209
  </a>
210
  </li-->
211
  </ul>
254
  global $gdeoptions;
255
 
256
  if ( ! empty( $wrap ) ) {
257
+ echo '<span id="'.esc_attr($wrap).'">';
258
  }
259
+ echo '<input type="checkbox" id="'.esc_attr($field).'" name="'.esc_attr($field).'"';
260
  if ( ( isset( $gdeoptions[$field] ) && $gdeoptions[$field] == "yes" ) || ( $disabled ) ) {
261
  echo ' checked="checked"';
262
  }
265
  echo ' disabled="disabled"';
266
  }
267
 
268
+ echo ' value="'.esc_attr($field).'"> <label for="'.esc_attr($field).'">'.htmlentities($label).'</label>';
269
  if ( ! empty( $br ) ) {
270
  echo '<br/>';
271
  }
275
  }
276
 
277
  function gde_profile_option( $option, $value, $label, $helptext = '' ) {
278
+ echo "<option value=\"".esc_attr($value)."\"";
279
  if ( ! empty( $helptext ) ) {
280
+ echo " title=\"".esc_attr($helptext)."\"";
281
  }
282
  if ( $option == $value ) {
283
  echo ' selected="selected"';
287
 
288
  function gde_profile_checkbox( $option, $field, $label, $wrap = '', $br = '' ) {
289
  if ( ! empty( $wrap ) ) {
290
+ echo '<span id="'.esc_attr($wrap).'">';
291
  }
292
+ echo '<input type="checkbox" id="'.esc_attr($field).'" name="'.esc_attr($field).'"';
293
 
294
  // toolbar items
295
  if ( substr( $field, 0, 5 ) == "gdet_" ) {
321
  echo ' checked="checked"';
322
  }
323
 
324
+ echo ' value="'.esc_attr($field).'"> <label for="'.esc_attr($field).'">'.htmlentities($label).'</label>';
325
  if ( ! empty( $br ) ) {
326
  echo '<br/>';
327
  }
331
  }
332
 
333
  function gde_profile_text( $option, $field, $class = '', $size = '', $enabled = true ) {
334
+ echo '<input type="text" id="'.esc_attr($field).'" name="'.esc_attr($field).'" value="'.esc_attr($option).'"';
335
  if ( ! empty( $class ) ) {
336
+ echo ' class="'.esc_attr($class).'"';
337
  }
338
  if ( ! empty( $size ) ) {
339
+ echo ' size="'.esc_attr($size).'"';
340
  }
341
  if ( $enabled === false ) {
342
  echo ' disabled="disabled"';
346
  }
347
 
348
  function gde_help_link( $url, $float = '' ) {
349
+ $title = __('Help', 'google-document-embedder');
350
  $img = GDE_PLUGIN_URL . "img/help.png";
351
 
352
  if ( ! empty( $float ) ) {
353
+ echo '<div style="float:'.esc_attr($float).';">';
354
  }
355
 
356
+ echo '<a href="'.esc_attr($url).'" target="_blank" title="'.esc_attr($title).'"><img src="'.esc_attr($img).'" alt="?"></a>';
357
 
358
  if ( ! empty( $float ) ) {
359
  echo "</div>\n";
365
  if ( $pid == 1 ) {
366
  return " ";
367
  } else {
368
+ return '<input type="checkbox" value="'.esc_attr($pid).'" name="delete_tags[]">';
369
  }
370
  }
371
 
372
  function gde_row_actions( $pid ) {
373
  $actions = array(
374
  // action name => arr ( label, class )
375
+ "edit" => array( __('Edit', 'google-document-embedder'), 'edit' ),
376
+ "delete" => array( __('Delete', 'google-document-embedder'), 'delete' ),
377
+ "default" => array( __('Make Default', 'google-document-embedder'), 'default' )
378
  );
379
 
380
  // protect default profile
383
  }
384
 
385
  foreach ($actions as $k => $v) {
386
+ $act[] = '<span class="'.esc_attr($v[1]).'" id="'.esc_attr($k).'-'.esc_attr($pid).'"><a href="options-general.php?page=gde-settings">'.htmlentities($v[0]).'</a></span>';
387
  }
388
  $acts = implode( " | ", $act );
389
 
390
  return $acts;
391
  }
392
 
393
+ ?>
readme.txt CHANGED
@@ -1,10 +1,9 @@
1
  === Google Doc Embedder ===
2
  Contributors: danlester, k3davis
3
  Tags: doc, docx, pdf, ppt, pptx, xls, office, powerpoint, google, document, embed
4
- Author URI: http://www.davistribe.org/code/
5
- Donate link: http://www.davistribe.org/gde/donate/
6
  Requires at least: 3.5
7
- Tested up to: 4.1
8
  Stable tag: trunk
9
  License: GPLv2 or later
10
 
@@ -17,10 +16,10 @@ Google Doc Embedder lets you embed several types of files into your WordPress pa
17
  > <strong>NOTE: Recent changes by Google to their viewer mean that some other plugins may be more suitable in some cases:</strong><br>
18
  >
19
  > * If you are able to store your files in Google Drive, try the [Google Drive Embedder plugin](http://wp-glogin.com/wpgoogledoctodrive). This will be faster to display, and more reliable.
20
- > * If you are looking for mobile-friendly PDF embedding, or the ability to make it difficult to download the full PDF (the old 'enhanced mode'), please find out more about [our proposed new plugin](http://pdf-embedder.instapage.com/).
21
- > * If this plugin works as you require then we will continue to support it assuming Google still provides the underlying Doc Viewer in its current form!
22
  >
23
- > This plugin only works in "Standard Viewer" mode for the time being since the recent changes to Google Doc Viewer were incompatible with the "Enhanced Viewer" mode.
24
 
25
  = More about Google Doc Embedder =
26
 
@@ -51,7 +50,7 @@ you use the Office 2003 equivalent formats instead.
51
 
52
  Note: Use of this plug-in implies your agreement with Google's published [Terms of Service](http://docs.google.com/viewer/TOS?hl=en "Terms of Service").
53
 
54
- Translations are welcome; see the [web site](http://www.davistribe.org/gde/notes/#translate "web site") for details.
55
 
56
  * English (en\_US), built-in
57
  * Czech (cs\_CZ) by Jirka, thanks!
@@ -73,7 +72,7 @@ Translations are welcome; see the [web site](http://www.davistribe.org/gde/notes
73
  Upload the documents to your site using the media upload facility built into WordPress, via FTP, or link to documents on another (public)
74
  site. Use the Media Library or Google Doc Embedder button in the Visual editor to build the appropriate shortcode, or use the documentation.
75
 
76
- For basic manual instructions, please see the FAQ. For advanced usage, see the [web site](http://www.davistribe.org/gde/usage/ "web site").
77
 
78
  Go to "GDE Settings" (under "Settings" in the admin panel) to change defaults, or override individually using the shortcode syntax in the FAQ.
79
 
@@ -108,8 +107,6 @@ Common optional attributes:
108
  * `width=` : To override the profile's default width of the viewer, enter a new width value - e.g., "400px" or "80%"
109
  * `height=` : To override the profile's default height of the viewer, enter a new height value - e.g., "400px" or "80%"
110
 
111
- For a list of all available attributes, see [Usage](http://www.davistribe.org/gde/usage/ "Usage").
112
-
113
  = What are "Profiles"? =
114
  Profiles allow you to create a unique batch of settings and access them from the viewer using only a profile ID (or name), rather than
115
  writing a horrifically complicated shortcode. This allows each instance of GDE (even on the same page) to be completely customizable while
@@ -121,22 +118,21 @@ Most likely, no. If your file requires a login to view - such as being saved in
121
  be "publicly available." Please save the file in a publicly accessible location for best results.
122
 
123
  = What about private documents? =
124
- The file must be publically available, but there is no reason why you need to publish the location. With GDE you can hide the URL as well
125
- as block direct downloads of the file. In combination with robots.txt and other mechanisms for blocking search engines or file browsing on
126
- your site, the document can be effectively private to everyone but the viewer itself. You can also try the [Secure Documents](http://www.davistribe.org/gde/secure-docs/ "Secure Documents") feature for more robust document security.
127
 
128
  = Does it work with files saved in Google Docs/Drive? =
129
  This plug-in utilizes the viewer from Google Docs in a standalone fashion. There is no direct integration with Google Docs and even those
130
  documents stored there and shared publicly do not embed reliably with their standalone viewer (ironically), so at this time that use is not
131
- supported by the plug-in. Please store your original documents somewhere on your web site in their native supported formats.
 
 
132
 
133
  = Does it work in Multisite environments? =
134
  The plugin works on network installs, though it must be activated on a per-site basis (not network activated). There are no multisite
135
  specific features at this time, but it will function normally in this environment. If you use GDE in a multisite environment, I welcome your feedback on what functionality you would like to see.
136
 
137
- = Other Common Questions =
138
- More common questions are answered on the GDE web site [here](http://www.davistribe.org/gde/notes/ "Notes").
139
-
140
  == Screenshots ==
141
 
142
  1. Default appearance of embedded viewer (cropped)
@@ -149,6 +145,18 @@ More common questions are answered on the GDE web site [here](http://www.davistr
149
 
150
  (E) Enhanced Viewer
151
 
 
 
 
 
 
 
 
 
 
 
 
 
152
  = 2.5.18 =
153
  * Added: Notice on settings page about recent changes to Google Viewer.
154
 
@@ -245,7 +253,5 @@ More common questions are answered on the GDE web site [here](http://www.davistr
245
  * Fixed: Viewer size from shortcode doesn't default to pixel
246
  * Fixed: Erroneous error message when file validation is blocked
247
 
248
- [Full history...](http://www.davistribe.org/gde/changelog/ "Full history")
249
-
250
  == Upgrade Notice ==
251
 
1
  === Google Doc Embedder ===
2
  Contributors: danlester, k3davis
3
  Tags: doc, docx, pdf, ppt, pptx, xls, office, powerpoint, google, document, embed
4
+ Author URI: https://wordpress.org/plugins/google-document-embedder/
 
5
  Requires at least: 3.5
6
+ Tested up to: 4.4
7
  Stable tag: trunk
8
  License: GPLv2 or later
9
 
16
  > <strong>NOTE: Recent changes by Google to their viewer mean that some other plugins may be more suitable in some cases:</strong><br>
17
  >
18
  > * If you are able to store your files in Google Drive, try the [Google Drive Embedder plugin](http://wp-glogin.com/wpgoogledoctodrive). This will be faster to display, and more reliable.
19
+ > * To make it difficult for users to download the full PDF (the old 'enhanced mode'), please find out more about [our new plugin - PDF Embedder Secure](http://wp-pdf.com/secure/?utm_source=GDE%20Readme&utm_medium=wordpressorg&utm_campaign=Freemium).
20
+ > * Mobile-friendly functionality for viewing PDFs is available in [PDF Embedder Premium](http://wp-pdf.com/premium/?utm_source=GDE%20Readme%20Premium&utm_medium=wordpressorg&utm_campaign=Freemium).
21
  >
22
+ > If this plugin works as you require then we will continue to support it assuming Google still provides the underlying Doc Viewer in its current form!
23
 
24
  = More about Google Doc Embedder =
25
 
50
 
51
  Note: Use of this plug-in implies your agreement with Google's published [Terms of Service](http://docs.google.com/viewer/TOS?hl=en "Terms of Service").
52
 
53
+ Translations:
54
 
55
  * English (en\_US), built-in
56
  * Czech (cs\_CZ) by Jirka, thanks!
72
  Upload the documents to your site using the media upload facility built into WordPress, via FTP, or link to documents on another (public)
73
  site. Use the Media Library or Google Doc Embedder button in the Visual editor to build the appropriate shortcode, or use the documentation.
74
 
75
+ For basic manual instructions, please see the FAQ.
76
 
77
  Go to "GDE Settings" (under "Settings" in the admin panel) to change defaults, or override individually using the shortcode syntax in the FAQ.
78
 
107
  * `width=` : To override the profile's default width of the viewer, enter a new width value - e.g., "400px" or "80%"
108
  * `height=` : To override the profile's default height of the viewer, enter a new height value - e.g., "400px" or "80%"
109
 
 
 
110
  = What are "Profiles"? =
111
  Profiles allow you to create a unique batch of settings and access them from the viewer using only a profile ID (or name), rather than
112
  writing a horrifically complicated shortcode. This allows each instance of GDE (even on the same page) to be completely customizable while
118
  be "publicly available." Please save the file in a publicly accessible location for best results.
119
 
120
  = What about private documents? =
121
+ The file must be publicly available, but there is no reason why you need to publish the location beyond supplying it to the GDE plugin.
122
+ However, savvy users will be able to locate the URL and download the original file.
123
+ To make it difficult for users to download PDF files (the old 'enhanced mode' of GDE), please find out more about [our new plugin - PDF Embedder Secure](http://wp-pdf.com/secure/?utm_source=GDE%20FAQ&utm_medium=wordpressorg&utm_campaign=Freemium).
124
 
125
  = Does it work with files saved in Google Docs/Drive? =
126
  This plug-in utilizes the viewer from Google Docs in a standalone fashion. There is no direct integration with Google Docs and even those
127
  documents stored there and shared publicly do not embed reliably with their standalone viewer (ironically), so at this time that use is not
128
+ supported by the plug-in.
129
+
130
+ If you are able to store your files in Google Drive, you may want to try the [Google Drive Embedder plugin](http://wp-glogin.com/wpgoogledoctodrive). This will be faster to display, and more reliable in that case.
131
 
132
  = Does it work in Multisite environments? =
133
  The plugin works on network installs, though it must be activated on a per-site basis (not network activated). There are no multisite
134
  specific features at this time, but it will function normally in this environment. If you use GDE in a multisite environment, I welcome your feedback on what functionality you would like to see.
135
 
 
 
 
136
  == Screenshots ==
137
 
138
  1. Default appearance of embedded viewer (cropped)
145
 
146
  (E) Enhanced Viewer
147
 
148
+ = 2.5.22 =
149
+
150
+ Post editor button fixed - was removed in previous version.
151
+
152
+ = 2.5.21 =
153
+
154
+ Changed the name of text domain from 'gde' to 'google-document-embedder'.
155
+ This was needed so WordPress' new translation system works - text domain must match plugin slug.
156
+
157
+ = 2.5.19 =
158
+ * Fixed potential XSS attack flaw - please update to this version.
159
+
160
  = 2.5.18 =
161
  * Added: Notice on settings page about recent changes to Google Viewer.
162
 
253
  * Fixed: Viewer size from shortcode doesn't default to pixel
254
  * Fixed: Erroneous error message when file validation is blocked
255
 
 
 
256
  == Upgrade Notice ==
257
 
uninstall.php CHANGED
@@ -39,4 +39,4 @@ delete_option( 'external_updates-google-document-embedder' );
39
  $table = $wpdb->base_prefix . 'gde_dx_log';
40
  $wpdb->query( "DROP TABLE IF EXISTS $table" );
41
 
42
- ?>
39
  $table = $wpdb->base_prefix . 'gde_dx_log';
40
  $wpdb->query( "DROP TABLE IF EXISTS $table" );
41
 
42
+ ?>
~view.php DELETED
@@ -1,452 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * Enhanced Viewer
5
- */
6
-
7
- // disable if adddressed. $_GET['gpid'] below has SQL injection vulnerability and should
8
- // be replaced if this file is used again.
9
- exit;
10
-
11
- // access wp functions externally
12
- require_once('libs/lib-bootstrap.php');
13
-
14
- // no access if parent plugin is disabled
15
- if ( ! function_exists('gde_activate') ) {
16
- wp_die('<p>'.__('You do not have sufficient permissions to access this page.').'</p>');
17
- }
18
-
19
- if ( isset( $_GET['a'] ) && $_GET['a'] == 'gt') {
20
- // proxy xml content - must be done to avoid XSS failures (contains embedded link data and enables text selection)
21
-
22
- $code = gde_get_contents("https://docs.google.com/viewer?" . $_SERVER['QUERY_STRING']);
23
- header('Content-type: application/xml');
24
- echo $code;
25
-
26
- } elseif ( isset( $_GET['a'] ) && $_GET['a'] == 'bi' ) {
27
- // proxy image content - prevents "too many redirects" on many-paged docs
28
- /*
29
- $code = gde_get_contents( "https://docs.google.com/viewer?" . $_SERVER['QUERY_STRING'] );
30
- header('Content-type: image/png');
31
- echo $code;
32
- */
33
- header( "Location: https://docs.google.com/viewer?" . $_SERVER['QUERY_STRING'] );
34
-
35
- } elseif ( isset( $_GET['jsfile'] ) ) {
36
- // proxy javascript content - not doing anything here but Google changes return 404 if not proxied (??)
37
- $code = gde_get_contents("https://docs.google.com/" . $_GET['jsfile']);
38
- header('Content-type: text/javascript');
39
- echo $code;
40
-
41
- } else {
42
-
43
- // trap language
44
- if ( isset( $_GET['hl'] ) ) {
45
- $lang = $_GET['hl'];
46
- } else {
47
- $lang = "";
48
- }
49
-
50
- if ( ! $mode = gde_get_mode( $_GET ) ) {
51
- wp_die( __('Invalid URL format', 'gde') );
52
- }
53
-
54
- // get profile
55
- if ( isset( $_GET['gpid'] ) ) {
56
- $gpid = mysql_real_escape_string( $_GET['gpid'] );
57
- if ( $profile = gde_get_profile( $gpid ) ) {
58
- $tb = $profile['tb_flags'];
59
- $vw = $profile['vw_flags'];
60
- $bg = $profile['vw_bgcolor'];
61
- $css = $profile['vw_css'];
62
- }
63
- }
64
-
65
- // autodetect mobile
66
- if ( $mode !== "mobile" && $profile['tb_mobile'] == "default" ) {
67
- if ( gde_mobile_check() ) {
68
- $mode = "mobile";
69
- $_SERVER['QUERY_STRING'] = str_replace( $mode, "mobile", $_SERVER['QUERY_STRING'] );
70
- }
71
- }
72
-
73
- // get the default page content
74
- $code = gde_get_contents( "https://docs.google.com/viewer?" . $_SERVER['QUERY_STRING'] );
75
-
76
- if ( ! $code ) {
77
- // blank page was returned
78
- gde_load_failure();
79
- exit;
80
- } else {
81
- // fix js path
82
- $search[] = "gview/resources_gview/client/js";
83
- //$replace[] = "https://docs.google.com/gview/resources_gview/client/js"; // use this if js not proxied
84
- $replace[] = "?jsfile=gview/resources_gview/client/js"; // use this instead to proxy the js
85
-
86
- // mode-specific styles
87
- if ( $mode == "chrome" ) {
88
- // remove branding elements
89
- $newstyles[] = '
90
- #docs-header { display: none; }
91
- #gview-menu { display: none; }
92
- #searchElements { display: none; }
93
- #buttonElements { float: right; padding-right: 5px; }
94
- #thumb-pane { display: none; }
95
- #content-pane { top: 36px !important; left: 0 !important; width: 100% !important; }
96
- .view { background-color: inherit; }
97
- ';
98
- } elseif ( $mode == "mobile" ) {
99
- $newstyles[] = "#page-footer { display: none !important; }";
100
- } elseif ( $mode == "embedded" ) {
101
-
102
- // new toolbar button style
103
- $newstyles[] = '
104
- #controlbarControls { padding-top: 3px; margin-left: 5px; right: 5px; }
105
- #controlbarPageNumber { padding: 4px 5px 0 5px; }
106
- .toolbar-button-icon { padding-top: 1px; }
107
- .goog-toolbar-button-outer-box { opacity: 0.60; padding: 1px; }
108
- .goog-toolbar-button-outer-box:hover { opacity: 1.0; padding: 0; }
109
- .goog-toolbar-button-outer-box:hover {
110
- background-color: #F8F8F8;
111
- border: 1px solid #CCC;
112
- background-image: -moz-linear-gradient(center top , #F8F8F8, #F1F1F1);
113
- box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1) inset;
114
- }
115
- .goog-custom-button-disabled, .goog-custom-button-disabled:hover { opacity: 0.3; border: 0; padding: 1px; }
116
- #openFullScreenButtonIcon {
117
- background-image: url("img/sprite-fullscr.png");
118
- background-position: center;
119
- }
120
- .view { background-color: inherit; }
121
- ';
122
-
123
- // hide open in new window
124
- if ( strstr( $tb, 'n' ) !== false || ( $profile['tb_fulluser'] == "yes" && ! is_user_logged_in() ) ) {
125
- $newstyles[] = "#controlbarOpenInViewerButton, #gdeControlbarOpenInViewerButton { display: none !important; }";
126
- }
127
- }
128
-
129
- // toolbar flag key
130
- /*
131
- h => hide toolbar (all)
132
- n => hide new window button (embedded only)
133
- p => hide page numbers (embedded & mobile)
134
- r => hide next/prev page (all)
135
- z => hide zoom in/out (all)
136
- */
137
-
138
- // hide toolbar
139
- if (strstr($tb, 'h')) {
140
- $newstyles[] = "#controlbar { display: none; }";
141
- }
142
-
143
- // hide page numbers
144
- if (strstr($tb, 'p')) {
145
- $newstyles[] = "#controlbarPageNumber { display: none !important; }";
146
- }
147
-
148
- // hide prev/next buttons
149
- if (strstr($tb, 'r')) {
150
- $newstyles[] = "#controlbarBackButton { display: none !important; }";
151
- $newstyles[] = "#controlbarForwardButton { display: none !important; }";
152
- }
153
-
154
- # hide zoom in/out
155
- if (strstr($tb, 'z')) {
156
- if ( $mode == "mobile" ) {
157
- $newstyles[] = ".mobile-button-zoom-out { display: none !important; }";
158
- $newstyles[] = ".mobile-button-zoom-in { display: none !important; }";
159
- } else {
160
- $newstyles[] = "#controlbarZoomOutButton { display: none !important; }";
161
- $newstyles[] = "#controlbarZoomInButton { display: none !important; }";
162
- }
163
- }
164
-
165
- // the below viewer styles are applied to all modes
166
- /*
167
- b => remove page borders
168
- f => simulate "full bleed" (minimal margins) (currently not exposed)
169
- t => transparent background
170
- v => reduce vertical margins (currently not exposed)
171
- x => hide selection of text
172
- */
173
-
174
- // "full bleed" (experimental) - low res and breaks zooming
175
- if (strstr($vw, 'f')) {
176
- $newstyles[] = "#page-pane { margin: 0 -8px !important; }";
177
- $newstyles[] = "#gview { padding-bottom: -8px !important; }";
178
- $newstyles[] = ".page-element { margin: 0 !important; padding: 0 !important; width: 100% !important; }";
179
- $newstyles[] = ".page-image { width: 99% !important; }";
180
- $newstyles[] = "#content-pane { overflow-x: hidden; }";
181
- }
182
-
183
- // reduce vertical margins
184
- if (strstr($vw, 'v')) {
185
- //$newstyles[] = "#content-pane>div { margin: 0 !important; padding: 0 !important; }";
186
- $newstyles[] = "#content-pane { text-align: left; }";
187
- $newstyles[] = ".page-element { padding: 0; }";
188
- //$newstyles[] = "#content-pane { background-color: transparent; }";
189
- }
190
-
191
- // hide selection of text
192
- if ( strstr( $vw, 'x' ) ) {
193
- $search[] = 'class="page-image';
194
- $replace[] = 'class="page-image noselect';
195
- $newstyles[] = ".rubberband { display: none; }";
196
- $newstyles[] = ".highlight-pane { display: none; }";
197
- $newstyles[] = ".page-image { cursor: default; }";
198
- }
199
-
200
- // remove page borders or change color
201
- if ( strstr( $vw, 'b' ) && $mode !== "chrome" ) {
202
- $newstyles[] = ".page-image { border: none; }";
203
- } elseif ( $profile['vw_pbcolor'] ) {
204
- // set page border color
205
- $newstyles[] = ".page-image { border: 1px solid " . $profile['vw_pbcolor'] . "; }";
206
- }
207
-
208
- // set viewer background color
209
- if ( strstr( $vw, 't' )) {
210
- $newstyles[] = "#content-pane { background-color: transparent; }";
211
- } elseif ( ! empty( $bg ) ) {
212
- $newstyles[] = "#content-pane { background-color: $bg; }";
213
- }
214
-
215
- if (count($newstyles) > 0) {
216
- // build new stylesheet
217
- $styleblock = array();
218
- $styleblock[] = "\n<!-- GDE STYLE INSERT -->";
219
-
220
- $styleblock[] = '<style type="text/css">';
221
- foreach ($newstyles as $ln) {
222
- $styleblock[] = "\t $ln";
223
- }
224
- $styleblock[] = "</style>";
225
-
226
- // insert new styles
227
- $styleblock = implode("\n", $styleblock)."\n</head>";
228
- $search[] = "</head>";
229
- $replace[] = $styleblock;
230
- }
231
-
232
- // override stylesheet
233
- if ( ! empty( $css ) ) {
234
- $cssblock = '<link rel="stylesheet" type="text/css" href="'.$css."\">\n</head>";
235
- $search[] = "</head>";
236
- $replace[] = $cssblock;
237
- }
238
-
239
- // override right-click behavior (if link is private)
240
- if ( $profile['link_block'] == "yes" ) {
241
- $search[] = "<body";
242
- $replace[] = '<body oncontextmenu="return false;"';
243
- $search[] = "</body>";
244
- $replace[] = '
245
- <script type="text/javascript">
246
- if (document.addEventListener) {
247
- document.addEventListener(\'contextmenu\', function(e) {
248
- e.preventDefault();
249
- }, false);
250
- } else {
251
- document.attachEvent(\'oncontextmenu\', function() {
252
- window.event.returnValue = false;
253
- });
254
- }
255
- </script>
256
- '."\n</body>";
257
- }
258
-
259
- // override new window behavior
260
- $src = "js/tb-newwin.php";
261
- if ( $mode == "embedded" && $profile['tb_fullscr'] !== "default" ) {
262
- if ( $profile['tb_fullwin'] == "same" ) {
263
- $arg[] = "a=fs";
264
- }
265
- //if ( $profile['tb_print'] == "yes" ) {
266
- // $arg[] = "p=1";
267
- //}
268
- if ( isset( $arg ) && is_array( $arg ) ) {
269
- $src .= "?hl=$lang&" . implode("&", $arg);
270
- }
271
- $scriptblock = '<script type="text/javascript" src="' . $src . '"></script>';
272
- $search[] = "</body>";
273
- $replace[] = $scriptblock."\n</body>";
274
- } elseif ( $profile['tb_fullscr'] == "default" && $profile['tb_fullwin'] == "same" ) {
275
- $src .= "?a=fs&url=" . $_GET['url'] . "&hl=" . $lang;
276
- $scriptblock = '<script type="text/javascript" src="' . $src . '"></script>';
277
- $search[] = "</body>";
278
- $replace[] = $scriptblock."\n</body>";
279
- }
280
-
281
- // perform string replacements
282
- $code = str_replace($search, $replace, $code);
283
- }
284
-
285
- // disable caching of viewer if link is blocked or document cache is off
286
- if ( $profile['link_block'] == "yes" || strstr( urldecode( $_GET['url'] ), "?" ) ) {
287
- gde_block_caching();
288
- }
289
-
290
- // output page
291
- header('Content-type: text/html; charset=utf-8');
292
- echo $code;
293
- }
294
-
295
-
296
- /**
297
- * Fetch remote file source
298
- *
299
- * @since 2.5.0.1
300
- * @return string Contents of remote file
301
- */
302
- function gde_get_contents( $url ) {
303
-
304
- $opts = array(
305
- 'user-agent' => 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:29.0) Gecko/20100101 Firefox/29.0',
306
- 'timeout' => 20,
307
- 'ssl_verify' => false
308
- );
309
-
310
- $response = wp_remote_get( $url, $opts );
311
-
312
- if ( is_wp_error( $response ) || wp_remote_retrieve_response_code( $response ) != 200 ) {
313
- gde_dx_log("Error retrieving document");
314
- return false;
315
- } else {
316
- $result = trim( $response['body'] );
317
- if ( empty( $result ) && function_exists('curl_version') ) {
318
- // document returned OK but has no contents
319
- // (this is rare but seems to happen in some server configs)
320
- gde_dx_log("Retrieve body empty - using cURL fallback");
321
- $result = trim( gde_curl_get_contents( $url ) );
322
- if ( empty( $result ) ) {
323
- return false;
324
- }
325
- } elseif ( empty( $result ) ) {
326
- gde_dx_log("Retrieve body empty - cURL fallback not available");
327
- return false;
328
- }
329
- }
330
-
331
- return $result;
332
- }
333
-
334
- /**
335
- * Fetch remote file source (cURL fallback)
336
- *
337
- * @since 1.7.0.0
338
- * @return string Contents of remote file
339
- */
340
- function gde_curl_get_contents( $url ) {
341
- $ch = curl_init();
342
- curl_setopt_array( $ch, array(
343
- CURLOPT_URL => $url,
344
- CURLOPT_RETURNTRANSFER => true,
345
- CURLOPT_CONNECTTIMEOUT => 20, // HTTP API is 5, overridden in gde_get_contents to match this
346
- CURLOPT_SSL_VERIFYPEER => false
347
- ) );
348
- $file_contents = curl_exec( $ch );
349
- curl_close( $ch );
350
-
351
- return $file_contents;
352
- }
353
-
354
- /**
355
- * Check for mobile browser
356
- *
357
- * @since 2.5.0.1
358
- * @return bool Browser is detected as mobile, or not
359
- */
360
- function gde_mobile_check() {
361
- //return true; // test
362
- include_once("libs/lib-mobilecheck.php");
363
-
364
- if ( gde_is_mobile_browser() ) {
365
- return true;
366
- } else {
367
- return false;
368
- }
369
- }
370
-
371
- /**
372
- * Get profile data
373
- *
374
- * @since 2.5.0.1
375
- * @return array Array of specific profile data (bool false on failure)
376
- */
377
- function gde_get_profile( $id ) {
378
- global $wpdb;
379
- $table = $wpdb->prefix . 'gde_profiles';
380
-
381
- $profile = $wpdb->get_results( "SELECT * FROM $table WHERE profile_id = $id", ARRAY_A );
382
- $profile = unserialize($profile[0]['profile_data']);
383
-
384
- if ( is_array($profile) ) {
385
- return $profile;
386
- } else {
387
- return false;
388
- }
389
- }
390
-
391
- /**
392
- * Get viewer mode
393
- *
394
- * @since 2.5.0.1
395
- * @return string Which mode to grab content source from
396
- */
397
- function gde_get_mode( $get ) {
398
- if ( isset( $get['embedded'] ) ) {
399
- return "embedded";
400
- } elseif ( isset( $get['mobile'] ) ) {
401
- return "mobile";
402
- } elseif ( isset( $get['chrome'] ) ) {
403
- //return "chrome";
404
- return "embedded";
405
- } else {
406
- return false;
407
- }
408
- }
409
-
410
- /**
411
- * Block caching of entire viewer frame (not just doc)
412
- *
413
- * @since 2.5.0.4
414
- * @return void
415
- */
416
- function gde_block_caching() {
417
- header("Expires: Tue, 03 Jul 2001 06:00:00 GMT");
418
- header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
419
- header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
420
- header("Cache-Control: post-check=0, pre-check=0", false);
421
- header("Pragma: no-cache");
422
- }
423
-
424
- /**
425
- * Error page when enhanced viewer not supported (empty document body)
426
- *
427
- * @since 2.5.0.3
428
- * @return string HTML source for error to display
429
- */
430
- function gde_load_failure() {
431
- // test stuff
432
- global $profile;
433
-
434
- $title = "GDE " . __('Error', 'gde') . ": ";
435
- $error = $title . __('Unable to retrieve document contents. Please try again or switch to Standard Viewer.', 'gde');
436
-
437
- gde_block_caching();
438
- header('Content-type: text/html; charset=utf-8');
439
-
440
- echo '
441
- <html>
442
- <head>
443
- <title>' . $title . '</title>
444
- </head>
445
- <body>
446
- <p>' . $error . '</p>
447
- </body>
448
- </html>';
449
-
450
- }
451
-
452
- ?>