block_vedio.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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_vedio.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_vedio extends commonblock_html {
  13. function block_vedio() {}
  14. function name() {
  15. return lang('blockclass', 'blockclass_html_script_vedio');
  16. }
  17. function getsetting() {
  18. global $_G;
  19. $settings = array(
  20. 'url' => array(
  21. 'title' => 'vedio_url',
  22. 'type' => 'text',
  23. 'default' => 'http://'
  24. ),
  25. 'width' => array(
  26. 'title' => 'vedio_width',
  27. 'type' => 'text',
  28. 'default' => ''
  29. ),
  30. 'height' => array(
  31. 'title' => 'vedio_height',
  32. 'type' => 'text',
  33. 'default' => ''
  34. ),
  35. );
  36. return $settings;
  37. }
  38. function getdata($style, $parameter) {
  39. require_once libfile('function/discuzcode');
  40. $parameter['width'] = !empty($parameter['width']) ? intval($parameter['width']) : 'auto';
  41. $parameter['height'] = !empty($parameter['height']) ? intval($parameter['height']) : 'auto';
  42. $parameter['url'] = addslashes($parameter['url']);
  43. $return = parseflv($parameter['url'], $parameter['width'], $parameter['height']);
  44. if($return == false) {
  45. $return = $parameter['url'];
  46. }
  47. return array('html' => $return, 'data' => null);
  48. }
  49. }
  50. ?>