cls_qiniu_factory.php 998 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. if(!defined('IN_T'))
  3. {
  4. die('hacking attempt');
  5. }
  6. require_once __DIR__ ."/../../config/config.php";
  7. require_once 'autoload.php';
  8. use Qiniu\Auth;
  9. use Qiniu\Storage\UploadManager;
  10. use Qiniu\Processing\Operation;
  11. use Qiniu\config;
  12. class Qiniu_Factory
  13. {
  14. private static $auth;
  15. private static $Operation;
  16. public static function getAuth()
  17. {
  18. if(empty($auth)){
  19. $auth = new Auth($GLOBALS['_lang']['qiniu_config']['accessKey'], $GLOBALS['_lang']['qiniu_config']['secretKey']);
  20. }
  21. return $auth;
  22. }
  23. public static function getUploaManager(){
  24. return new UploadManager();
  25. }
  26. public static function getOperation(){
  27. if (empty($Operation)) {
  28. $Operation = new Operation($GLOBALS['_lang']['qiniu_config']['cdn_host'] ,Qiniu_Factory::getAuth());
  29. }
  30. return $Operation;
  31. }
  32. public static function getZoneUrl(){
  33. // $config = new Config();
  34. // return $config->getUpHost();
  35. return 'http://'.$GLOBALS['_lang']['qiniu_config']['up_url'];
  36. }
  37. }
  38. ?>