/**
  * init
  * @static
  * @return void
  */
 public static function init()
 {
     register_activation_hook(HACKLOG_RA_UPYUN_LOADER, array(__CLASS__, 'my_activation'));
     register_deactivation_hook(HACKLOG_RA_UPYUN_LOADER, array(__CLASS__, 'my_deactivation'));
     $opts = get_option(self::opt_primary);
     self::$rest_user = $opts['rest_user'];
     self::$rest_pwd = $opts['rest_pwd'];
     self::$form_api_secret = $opts['form_api_secret'];
     self::$form_api_allowed_ext = $opts['form_api_allowed_ext'];
     self::$form_api_content_max_length = $opts['form_api_content_max_length'];
     self::$form_api_timeout = $opts['form_api_timeout'];
     self::$anti_leech_token = $opts['anti_leech_token'];
     self::$anti_leech_timeout = $opts['anti_leech_timeout'];
     self::$rest_server = $opts['rest_server'];
     self::$bucketname = $opts['bucketname'];
     self::$rest_port = $opts['rest_port'];
     self::$rest_timeout = $opts['rest_timeout'] > 0 ? $opts['rest_timeout'] : 30;
     $opts['rest_remote_path'] = rtrim($opts['rest_remote_path'], '/');
     $opts['http_remote_path'] = rtrim($opts['http_remote_path'], '/');
     $opts['remote_baseurl'] = rtrim($opts['remote_baseurl'], '/');
     $upload_dir = wp_upload_dir();
     //be aware of / in the end
     self::$local_basepath = $upload_dir['basedir'];
     self::$local_path = $upload_dir['path'];
     self::$local_baseurl = $upload_dir['baseurl'];
     self::$local_url = $upload_dir['url'];
     self::$subdir = $upload_dir['subdir'];
     //if the post publish date was different from the media upload date,the time should take from the database.
     if (get_option('uploads_use_yearmonth_folders') && isset($_REQUEST['post_id'])) {
         $post_id = (int) $_REQUEST['post_id'];
         if ($post = get_post($post_id)) {
             if (substr($post->post_date, 0, 4) > 0) {
                 $time = $post->post_date;
                 $y = substr($time, 0, 4);
                 $m = substr($time, 5, 2);
                 $subdir = "/{$y}/{$m}";
                 self::$subdir = $subdir;
             }
         }
     }
     //后面不带 /
     self::$rest_remote_path = $opts['rest_remote_path'];
     self::$http_remote_path = $opts['http_remote_path'];
     //此baseurl与options里面的不同!
     self::$remote_baseurl = '.' == self::$http_remote_path ? $opts['remote_baseurl'] : $opts['remote_baseurl'] . '/' . self::$http_remote_path;
     self::$remote_url = self::$remote_baseurl . self::$subdir;
 }