diff --git a/cover/img.txt b/cover/img.txt
new file mode 100644
index 0000000..6ce78d5
--- /dev/null
+++ b/cover/img.txt
@@ -0,0 +1,3 @@
+https://cdn.jsdelivr.net/gh/mashirozx/Sakura@3.3.2/cover/gallery/pixar_up_movie_balloons_desktop_1920x1080_hd-wallpaper-507967.jpg
+https://cdn.jsdelivr.net/gh/mashirozx/Sakura@3.3.2/cover/gallery/beyond_by_auroralion-dan5njb.jpg
+https://cdn.jsdelivr.net/gh/mashirozx/Sakura@3.3.2/cover/gallery/海の空(56993195)_by_夏T.jpg
diff --git a/cover/index.php b/cover/index.php
deleted file mode 100644
index 4ebee33..0000000
--- a/cover/index.php
+++ /dev/null
@@ -1,14 +0,0 @@
-
diff --git a/feature/img.txt b/feature/img.txt
new file mode 100644
index 0000000..839fb03
--- /dev/null
+++ b/feature/img.txt
@@ -0,0 +1,2 @@
+https://cdn.jsdelivr.net/gh/mashirozx/Sakura@3.3.2/feature/gallery/1.jpg
+https://cdn.jsdelivr.net/gh/mashirozx/Sakura@3.3.2/feature/gallery/2.jpg
diff --git a/feature/index.php b/feature/index.php
deleted file mode 100644
index 4ebee33..0000000
--- a/feature/index.php
+++ /dev/null
@@ -1,14 +0,0 @@
-
diff --git a/inc/api.php b/inc/api.php
index a175108..36e0229 100644
--- a/inc/api.php
+++ b/inc/api.php
@@ -276,13 +276,14 @@ EOS;
* @rest api接口路径:https://sakura.2heng.xin/wp-json/sakura/v1/image/cover
*/
function cover_gallery() {
- $img_array = glob(get_wp_root_path(). "/themes/Sakura/cover/gallery/*.{gif,jpg,png}",GLOB_BRACE);
- $img = array_rand($img_array);
- $imgurl = $img_array[$img];
- $mimetype = end(getimagesize($imgurl));
- $imgdata = file_get_contents($imgurl);
- header("Content-type: ".$mimetype);
- echo $imgdata;
+ $img_array = file(get_wp_root_path(). "/themes/Sakura/cover/img.txt");
+ $img = mt_rand(0, count($img_array) - 1);
+ $imgurl = trim($img_array[$img]);
+ $data = array( 'cover image' );
+ $response = new WP_REST_Response($data);
+ $response->set_status( 302 );
+ $response->header( 'Location', $imgurl);
+ return $response;
}
/*
@@ -290,11 +291,12 @@ function cover_gallery() {
* @rest api接口路径:https://sakura.2heng.xin/wp-json/sakura/v1/image/feature
*/
function feature_gallery() {
- $img_array = glob(get_wp_root_path(). "/themes/Sakura/feature/gallery/*.{gif,jpg,png}",GLOB_BRACE);
- $img = array_rand($img_array);
- $imgurl = $img_array[$img];
- $mimetype = end(getimagesize($imgurl));
- $imgdata = file_get_contents($imgurl);
- header("Content-type: ".$mimetype);
- echo $imgdata;
+ $img_array = file(get_wp_root_path(). "/themes/Sakura/feature/img.txt");
+ $img = mt_rand(0, count($img_array) - 1);
+ $imgurl = trim($img_array[$img]);
+ $data = array( 'feature image' );
+ $response = new WP_REST_Response($data);
+ $response->set_status( 302 );
+ $response->header( 'Location', $imgurl);
+ return $response;
}
\ No newline at end of file
diff --git a/languages/en_US.mo b/languages/en_US.mo
index 4e717de..827abab 100644
Binary files a/languages/en_US.mo and b/languages/en_US.mo differ
diff --git a/languages/en_US.po b/languages/en_US.po
index 61a88a6..e62bc51 100644
--- a/languages/en_US.po
+++ b/languages/en_US.po
@@ -1,8 +1,8 @@
msgid ""
msgstr ""
"Project-Id-Version: Sakura\n"
-"POT-Creation-Date: 2019-11-17 21:32+0800\n"
-"PO-Revision-Date: 2019-11-17 21:32+0800\n"
+"POT-Creation-Date: 2019-11-27 23:10+0800\n"
+"PO-Revision-Date: 2019-11-27 23:10+0800\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: en_US\n"
@@ -171,41 +171,41 @@ msgstr ""
msgid "Edit"
msgstr ""
-#: functions.php:485
+#: functions.php:486
msgid ""
"Please install pulgin WP-Statistics"
msgstr ""
-#: functions.php:538
+#: functions.php:536
msgid "This guy is so lazy ╮(╯▽╰)╭"
msgstr ""
-#: functions.php:1248
+#: functions.php:1246
msgid "All expand/collapse"
msgstr ""
-#: functions.php:1259 options.php:840
+#: functions.php:1257 options.php:840
msgid " "
msgstr ""
-#: functions.php:1263
+#: functions.php:1261
msgid " post(s)"
msgstr ""
-#: functions.php:1285 functions.php:1288 inc/theme_plus.php:479
+#: functions.php:1283 functions.php:1286 inc/theme_plus.php:479
msgid "Dashboard"
msgstr ""
-#: functions.php:1501
+#: functions.php:1499
msgid "ERROR: This email domain (@"
msgstr ""
-#: functions.php:1581
+#: functions.php:1603
msgid "QQ"
msgstr ""
-#: functions.php:1637
+#: functions.php:1659
msgid "Sidebar"
msgstr ""
@@ -214,7 +214,7 @@ msgstr ""
msgid "page %s "
msgstr ""
-#: inc/api.php:253 inc/theme_plus.php:728
+#: inc/api.php:252 inc/theme_plus.php:728
msgid "The comment is private"
msgstr ""
@@ -690,9 +690,9 @@ msgstr ""
#: options.php:268
msgid ""
-"The default image displayed without the article feature image set, use "
-"random cover if left blank (the image to be displayed is placed in the /wp-"
-"content/themes/Sakura/feature/gallery/ directory)"
+"The default image to be displayed without the feature map of the article. "
+"Leave blank here to use the built-in API (write the URL of the image to be "
+"displayed randomly to the /feature/img.txt file)"
msgstr ""
#: options.php:274
@@ -870,8 +870,8 @@ msgstr ""
#: options.php:423
msgid ""
-"Leave this blank to use the built-in API (put the images that need to be "
-"randomly displayed into the /cover/gallery/ directory)"
+"Leave blank here to use the built-in API (write the URL of the image that "
+"needs to be displayed randomly to the /cover/img.txt file))"
msgstr ""
#: options.php:429
@@ -1005,8 +1005,6 @@ msgid "Post share"
msgstr ""
#: options.php:587
-#, fuzzy
-#| msgid "Previous"
msgid "Previous and Next"
msgstr "Previous"
diff --git a/languages/sakura.pot b/languages/sakura.pot
index f2818c3..890f66f 100644
--- a/languages/sakura.pot
+++ b/languages/sakura.pot
@@ -1,9 +1,8 @@
-#, fuzzy
msgid ""
msgstr ""
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
"Project-Id-Version: Sakura\n"
-"POT-Creation-Date: 2019-11-17 21:32+0800\n"
+"POT-Creation-Date: 2019-11-27 23:10+0800\n"
"PO-Revision-Date: 2019-11-01 14:27+0800\n"
"Last-Translator: \n"
"Language-Team: \n"
@@ -170,41 +169,41 @@ msgstr ""
msgid "Edit"
msgstr ""
-#: functions.php:485
+#: functions.php:486
msgid ""
"Please install pulgin WP-Statistics"
msgstr ""
-#: functions.php:538
+#: functions.php:536
msgid "This guy is so lazy ╮(╯▽╰)╭"
msgstr ""
-#: functions.php:1248
+#: functions.php:1246
msgid "All expand/collapse"
msgstr ""
-#: functions.php:1259 options.php:840
+#: functions.php:1257 options.php:840
msgid " "
msgstr ""
-#: functions.php:1263
+#: functions.php:1261
msgid " post(s)"
msgstr ""
-#: functions.php:1285 functions.php:1288 inc/theme_plus.php:479
+#: functions.php:1283 functions.php:1286 inc/theme_plus.php:479
msgid "Dashboard"
msgstr ""
-#: functions.php:1501
+#: functions.php:1499
msgid "ERROR: This email domain (@"
msgstr ""
-#: functions.php:1581
+#: functions.php:1603
msgid "QQ"
msgstr ""
-#: functions.php:1637
+#: functions.php:1659
msgid "Sidebar"
msgstr ""
@@ -213,7 +212,7 @@ msgstr ""
msgid "page %s "
msgstr ""
-#: inc/api.php:253 inc/theme_plus.php:728
+#: inc/api.php:252 inc/theme_plus.php:728
msgid "The comment is private"
msgstr ""
@@ -685,9 +684,9 @@ msgstr ""
#: options.php:268
msgid ""
-"The default image displayed without the article feature image set, use random cover if left "
-"blank (the image to be displayed is placed in the /wp-content/themes/Sakura/feature/gallery/ "
-"directory)"
+"The default image to be displayed without the feature map of the article. Leave blank here to "
+"use the built-in API (write the URL of the image to be displayed randomly to the /feature/img."
+"txt file)"
msgstr ""
#: options.php:274
@@ -861,8 +860,8 @@ msgstr ""
#: options.php:423
msgid ""
-"Leave this blank to use the built-in API (put the images that need to be randomly displayed "
-"into the /cover/gallery/ directory)"
+"Leave blank here to use the built-in API (write the URL of the image that needs to be "
+"displayed randomly to the /cover/img.txt file))"
msgstr ""
#: options.php:429
diff --git a/languages/zh_CN.mo b/languages/zh_CN.mo
index 1704ea2..4e928d3 100644
Binary files a/languages/zh_CN.mo and b/languages/zh_CN.mo differ
diff --git a/languages/zh_CN.po b/languages/zh_CN.po
index a7062bf..652b7c8 100644
--- a/languages/zh_CN.po
+++ b/languages/zh_CN.po
@@ -1,8 +1,8 @@
msgid ""
msgstr ""
"Project-Id-Version: Sakura\n"
-"POT-Creation-Date: 2019-11-17 21:32+0800\n"
-"PO-Revision-Date: 2019-11-17 21:32+0800\n"
+"POT-Creation-Date: 2019-11-27 23:14+0800\n"
+"PO-Revision-Date: 2019-11-27 23:14+0800\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: zh_CN\n"
@@ -171,7 +171,7 @@ msgstr "否"
msgid "Edit"
msgstr "编辑"
-#: functions.php:485
+#: functions.php:486
msgid ""
"Please install pulgin WP-Statistics"
@@ -179,35 +179,35 @@ msgstr ""
"请安装插件 WP-Statistics"
-#: functions.php:538
+#: functions.php:536
msgid "This guy is so lazy ╮(╯▽╰)╭"
msgstr "这家伙好懒╮(╯▽╰)╭"
-#: functions.php:1248
+#: functions.php:1246
msgid "All expand/collapse"
msgstr "全部展开/收缩"
-#: functions.php:1259 options.php:840
+#: functions.php:1257 options.php:840
msgid " "
msgstr ""
-#: functions.php:1263
+#: functions.php:1261
msgid " post(s)"
msgstr " 篇文章"
-#: functions.php:1285 functions.php:1288 inc/theme_plus.php:479
+#: functions.php:1283 functions.php:1286 inc/theme_plus.php:479
msgid "Dashboard"
msgstr "管理中心"
-#: functions.php:1501
+#: functions.php:1499
msgid "ERROR: This email domain (@"
msgstr ""
-#: functions.php:1581
+#: functions.php:1603
msgid "QQ"
msgstr ""
-#: functions.php:1637
+#: functions.php:1659
msgid "Sidebar"
msgstr "侧栏"
@@ -216,7 +216,7 @@ msgstr "侧栏"
msgid "page %s "
msgstr "第 %s 页 "
-#: inc/api.php:253 inc/theme_plus.php:728
+#: inc/api.php:252 inc/theme_plus.php:728
msgid "The comment is private"
msgstr "该评论为私密评论"
@@ -697,12 +697,12 @@ msgstr "默认文章特色图"
#: options.php:268
msgid ""
-"The default image displayed without the article feature image set, use "
-"random cover if left blank (the image to be displayed is placed in the /wp-"
-"content/themes/Sakura/feature/gallery/ directory)"
+"The default image to be displayed without the feature map of the article. "
+"Leave blank here to use the built-in API (write the URL of the image to be "
+"displayed randomly to the /feature/img.txt file)"
msgstr ""
-"在未设置文章特色图的情况下展示的默认图像,留空则调用本地随机封面(要展示的图"
-"片放入 /wp-content/themes/Sakura/feature/gallery/ 目录)"
+"在未设置文章特色图的情况下展示的默认图像,此处留空则使用内置API(将需要随机展"
+"示的图片url写入 /feature/img.txt 文件)"
#: options.php:274
msgid "Comment shrink"
@@ -881,9 +881,10 @@ msgstr "封面图"
#: options.php:423
msgid ""
-"Leave this blank to use the built-in API (put the images that need to be "
-"randomly displayed into the /cover/gallery/ directory)"
-msgstr "此处留空则使用内置API(将需要随机展示的图片放入 /cover/gallery/ 目录)"
+"Leave blank here to use the built-in API (write the URL of the image that "
+"needs to be displayed randomly to the /cover/img.txt file))"
+msgstr ""
+"此处留空则使用内置API(将需要随机展示的图片url写入 /cover/img.txt 文件)"
#: options.php:429
msgid "Background image filter"
@@ -1779,8 +1780,6 @@ msgid "This username has been registered."
msgstr "该用户名已被注册。"
#: user/page-register.php:24
-#, fuzzy
-#| msgid "Please enter email address."
msgid "Please enter email address."
msgstr "请填写电子邮件地址。"
@@ -1821,8 +1820,6 @@ msgid "Sign up"
msgstr "注 册"
#: user/page-register.php:92
-#, fuzzy
-#| msgid "Registration is not open yet"
msgid "Registration is not open yet."
msgstr "暂未开放注册。"
diff --git a/options.php b/options.php
index 5690edb..ac94035 100644
--- a/options.php
+++ b/options.php
@@ -265,7 +265,7 @@ function optionsframework_options() {
$options[] = array(
'name' => __('Default article feature image', 'sakura'),/*默认文章特色图*/
- 'desc' => __('The default image displayed without the article feature image set, use random cover if left blank (the image to be displayed is placed in the /wp-content/themes/Sakura/feature/gallery/ directory)', 'sakura'),/*在未设置文章特色图的情况下展示的默认图像,留空则调用本地随机封面(要展示的图片放入 /wp-content/themes/Sakura/feature/gallery/ 目录)*/
+ 'desc' => __('The default image to be displayed without the feature map of the article. Leave blank here to use the built-in API (write the URL of the image to be displayed randomly to the /feature/img.txt file)', 'sakura'),/*在未设置文章特色图的情况下展示的默认图像,此处留空则使用内置API(将需要随机展示的图片url写入 /feature/img.txt 文件)*/
'id' => 'default_feature_image',
'std' => 'https://api.mashiro.top/feature/',
'type' => 'text');
@@ -420,7 +420,7 @@ function optionsframework_options() {
$options[] = array(
'name' => __('Cover image', 'sakura'),/*封面图*/
- 'desc' => __('Leave this blank to use the built-in API (put the images that need to be randomly displayed into the /cover/gallery/ directory)', 'sakura'),/*此处留空则使用内置API(将需要随机展示的图片放入 /cover/gallery/ 目录)*/
+ 'desc' => __('Leave blank here to use the built-in API (write the URL of the image that needs to be displayed randomly to the /cover/img.txt file))', 'sakura'),/*此处留空则使用内置API(将需要随机展示的图片url写入 /cover/img.txt 文件)*/
'id' => 'cover_img',
'std' => '',
'type' => 'text');