Channel.class.php 745 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. /**
  3. * 处理方法
  4. *
  5. * @author widuu <admin@widuu.com>
  6. * @document https://github.com/widuu/qiniu_ueditor_1.4.3
  7. */
  8. class Channel{
  9. private $config;
  10. private $handle = null;
  11. public function __construct($config){
  12. // 上传类型
  13. $type = strtolower(trim($config['upload_type']));
  14. // 类名称
  15. $class_name = ucfirst($type);
  16. // 判断是否存在
  17. if( !class_exists($class_name) ){
  18. return array(
  19. 'state' => 'ERROR',
  20. 'error' => $class_name.' class not exists'
  21. );
  22. }else{
  23. $this->handle = new $class_name($config);
  24. }
  25. }
  26. public function dispatcher($action){
  27. return call_user_func(
  28. array(
  29. $this->handle,
  30. htmlspecialchars($action)
  31. )
  32. );
  33. }
  34. }