add bing pic api

pull/250/head
Yanliang.Mei 2020-06-04 15:47:53 +08:00
parent 7a1ec65a9a
commit 38c1e6420e
4 changed files with 13 additions and 2 deletions

View File

@ -149,6 +149,12 @@ class Images
$imgurl = str_replace(get_template_directory(), get_template_directory_uri(), $imgurl);
} elseif (akina_option('cover_cdn_options') == "type_3") {
$imgurl = akina_option('cover_cdn');
} elseif (akina_option('cover_cdn_options') == "type_4") {
// bing 图片
$xml = file_get_contents('https://cn.bing.com/HPImageArchive.aspx?n=1&idx='.$mdx_img_bing);
if(preg_match("/<url>(.+?)<\/url>/is",$xml,$matches)){
$imgurl='https://cn.bing.com'.str_replace('1366x768','1920x1080',$matches[1]);
}
} else {
global $sakura_image_array;
$img_array = json_decode($sakura_image_array, true);

Binary file not shown.

View File

@ -2,14 +2,14 @@ msgid ""
msgstr ""
"Project-Id-Version: Sakura\n"
"POT-Creation-Date: 2020-04-06 17:55+0800\n"
"PO-Revision-Date: 2020-04-06 17:56+0800\n"
"PO-Revision-Date: 2020-06-04 15:46+0800\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: zh_CN\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 2.3\n"
"X-Generator: Poedit 2.3.1\n"
"X-Poedit-Basepath: ..\n"
"Plural-Forms: nplurals=1; plural=0;\n"
"X-Poedit-Flags-xgettext: --add-comments=translators:\n"
@ -849,6 +849,10 @@ msgstr "内置原图随机图(默认)"
msgid "custom api (advanced)"
msgstr "外部随机图API"
#: options.php:386
msgid "bing one pic everyday"
msgstr "Bing每日一图"
#: options.php:390
msgid "Cover images url"
msgstr "封面图片库url"

View File

@ -383,6 +383,7 @@ function optionsframework_options()
'type_1' => __('webp images (optimization)', 'sakura'), /*webp优化随机图*/
'type_2' => __('built-in api (default)', 'sakura'), /*内置原图随机图*/
'type_3' => __('custom api (advanced)', 'sakura'), /*外部随机图API*/
'type_4' => __('bing one pic everyday', 'sakura'), /*Bing每日一图API*/
)
);