Skip to content

Commit

Permalink
v2.5
Browse files Browse the repository at this point in the history
1. 代码重构
2. API restful
3. 更新 SDK
  • Loading branch information
0xJacky committed Dec 7, 2019
1 parent 99c5a25 commit 7a7f906
Show file tree
Hide file tree
Showing 491 changed files with 51,456 additions and 17,478 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.idea
.idea
.DS_Store
21 changes: 9 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

### 当前版本

v2.2
v2.5

![image][image-1]

Expand All @@ -15,22 +15,19 @@ v2.2
3. 设置页面可以显示当日的刷新剩余量
4. 中英文支持
5. 支持文件刷新和目录刷新
6. 支持批量预热文件

### 环境

WordPress 4.9.5 (低版本暂未测试,理论上是支持的)
WordPress 5.0+

PHP 5.3 ~ 7.1 (取决于阿里云 SDK)
PHP 7.0+

### 插件的使用
#### 下载
[Latest Release][1]

#### 安装

插件已提交到 WordPress 插件商店,正在等待审核,在此之前,您需要使用以下的安装方法:

将压缩包解压,上传到 `/wp-content/plugins/` 或通过 WordPress 插件管理页面上传插件压缩包来安装

#### 配置
Expand All @@ -43,21 +40,21 @@ PHP 5.3 ~ 7.1 (取决于阿里云 SDK)

这个是对快捷按钮的设置,如果选择 `刷新当前主题目录内的静态文件(目录)``全站刷新(目录)` 则请求强制回源拉取更新的目录(使用一个刷新目录配额)。

#### URL 预热
v2.5 版本更新:

预热可以将源站的内容主动预热到 L2 Cache 节点上,用户首次访问可直接命中缓存,缓解源站压力,
1. 代码重构

如果您是首次使用 CDN 和这个插件,您可以点击预热按钮,插件将会自动搜索当前主题目录类的静态资源文件,处理成标准的 URL 格式后提交到预热接口。
2. API Restful

由于阿里云的 SDK 不支持批量刷新,所以现在使用循环提交的方式,主题内文件较多的话等待时间可能稍微长一点,具体使用 URL 配额由文件数量决定。
3. 更新 SDK

v2.2 版本更新:

1. 修复了一些小问题

2. 阿里云 SDK 已支持批量刷新,但貌似会提示文件名称格式不正确的问题,所以仍使用循环提交的方式,并做了一些小调整,只提交后缀为 `css, js` 的文件(下个版本会增加自定义后缀的功能),如果您有好的方案,欢迎提交 Pull Request

3. 为了提交到 WordPress 已将插件名更名为 `Jacky AliCDN Helper`。(求 dalao 给它取个更好听的名字w)
3. 为了提交到 WordPress 已将插件名更名为 `Aliyun CDN Helper`。(求 dalao 给它取个更好听的名字w)

#### 刷新自定义 URL

Expand All @@ -72,7 +69,7 @@ v2.2 版本更新:
![image][image-2]


[1]: https://github.com/0xJacky/jacky-alicdn-helper/releases/latest
[1]: https://github.com/0xJacky/aliyun-cdn-helper/releases/latest

[image-1]: https://github.com/0xJacky/aliyun-cdn-helper/raw/master/assets/screenshot-1.png
[image-2]: https://github.com/0xJacky/aliyun-cdn-helper/raw/master/assets/my_alipay.png
26 changes: 10 additions & 16 deletions aliyun-cdn.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Plugin Name: Jacky AliCDN Helper
* Plugin Name: Aliyun CDN Helper
* Plugin URI: https://github.com/0xJacky/aliyun_cdn_helper
* Description: 阿里云 CDN 辅助工具。Aliyun CDN auxiliary tool for wordpress.
* Version: 2.1
Expand All @@ -10,7 +10,7 @@
*/

/**
* Jacky AliCDN Helper
* Aliyun CDN Helper
* Copyright 2017 0xJacky (email : [email protected])
*
* This program is free software; you can redistribute it and/or modify
Expand All @@ -27,25 +27,19 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/*ini_set( 'display_errors', 1 );
ini_set( 'display_startup_errors', 1 );
error_reporting( - 1 );*/

namespace CDN\WP;

define( 'ALIYUN_CDN_PATH', dirname( __FILE__ ) );
require( ALIYUN_CDN_PATH . '/autoload.php' );

use CDN\WP\Config;

Config::init( ALIYUN_CDN_PATH );
load_plugin_textdomain( 'aliyun-cdn', false, Config::$plugin_path . '/languages' );
load_plugin_textdomain( Config::identifier, false, Config::$plugin_path . '/languages' );

new Api;

try {
new CDN\WP\Init();
new CDN\WP\Settings();
new CDN\WP\Api();
} catch ( ServerException $e ) {
//echo $e->getMessage();
register_activation_hook( __FILE__, function () {
add_option( 'alicdn_options', Config::$originOptions, '', 'yes' ); //autoload
} );
if ( is_admin() ) {
new Init;
new Settings;
}
2 changes: 1 addition & 1 deletion autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* @return void
*/
defined( 'ALIYUN_CDN_PATH' ) OR exit();
require( ALIYUN_CDN_PATH . '/vendor/autoload.php' );
spl_autoload_register( function ( $class ) {
$auto_load_class = array(
'CDN\\WP\\' => '/src/'
Expand All @@ -28,4 +29,3 @@
}
}
} );
include ALIYUN_CDN_PATH . '/sdk/aliyun-php-sdk-core/Config.php';
5 changes: 5 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"require": {
"alibabacloud/client": "^1.5"
}
}
Loading

0 comments on commit 7a7f906

Please sign in to comment.