block_google.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. /**
  3. * [Discuz!] (C)2001-2099 Comsenz Inc.
  4. * This is NOT a freeware, use is subject to license terms
  5. *
  6. * $Id: block_google.php 25525 2011-11-14 04:39:11Z zhangguosheng $
  7. */
  8. if(!defined('IN_DISCUZ')) {
  9. exit('Access Denied');
  10. }
  11. require_once libfile('commonblock_html', 'class/block/html');
  12. class block_google extends commonblock_html {
  13. function block_google() {}
  14. function name() {
  15. return lang('blockclass', 'blockclass_html_script_google');
  16. }
  17. function getsetting() {
  18. global $_G;
  19. $settings = array(
  20. 'lang' => array(
  21. 'title' => 'google_lang',
  22. 'type' => 'mradio',
  23. 'value' => array(
  24. array('', 'google_lang_any'),
  25. array('en', 'google_lang_en'),
  26. array('zh-CN', 'google_lang_zh-CN'),
  27. array('zh-TW', 'google_lang_zh-TW')
  28. )
  29. ),
  30. 'default' => array(
  31. 'title' => 'google_default',
  32. 'type' => 'mradio',
  33. 'value' => array(
  34. array(0, 'google_default_0'),
  35. array(1, 'google_default_1'),
  36. )
  37. ),
  38. 'client' => array(
  39. 'title' => 'google_client',
  40. 'type' => 'text',
  41. ),
  42. );
  43. return $settings;
  44. }
  45. function getdata($style, $parameter) {
  46. $parameter = dhtmlspecialchars($this->cookparameter($parameter));
  47. $return = '<script type="text/javascript">var google_host="'.$_SERVER['HTTP_HOST'].'",google_charset="'.CHARSET.'",google_client="'.$parameter['client'].'",google_hl="'.$parameter['lang'].'",google_lr="'.($parameter['lang'] ? 'lang_'.$parameter['lang'] : '').'";google_default_0="'.($parameter['default'] == 0 ? ' selected' : '').'";google_default_1="'.($parameter['default'] == 1 ? ' selected' : '').'";</script><script type="text/javascript" src="static/js/google.js"></script>';
  48. return array('html' => $return, 'data' => null);
  49. }
  50. }
  51. ?>