diff --git a/inc/api.php b/inc/api.php index 1f2fcbd..a316c3f 100644 --- a/inc/api.php +++ b/inc/api.php @@ -351,9 +351,9 @@ function feature_gallery() { $img = array_rand($img_array); $img_domain = akina_option('cover_cdn') ? akina_option('cover_cdn') : get_template_directory_uri(); if(strpos($_SERVER['HTTP_ACCEPT'], 'image/webp')) { - $imgurl = $img_domain . "/manifest/" . $img_array[$img]["webp"][1]; + $imgurl = $img_domain . "/manifest/" . $img_array[$img]["webp"][0]; } else { - $imgurl = $img_domain . "/manifest/" . $img_array[$img]["jpeg"][1]; + $imgurl = $img_domain . "/manifest/" . $img_array[$img]["jpeg"][0]; } $data = array('cover image'); $response = new WP_REST_Response($data); diff --git a/languages/en_US.mo b/languages/en_US.mo index b9992f7..9eb161b 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 532c211..0eb643c 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-12-15 14:40+0800\n" -"PO-Revision-Date: 2019-12-15 14:40+0800\n" +"POT-Creation-Date: 2019-12-21 20:24+0800\n" +"PO-Revision-Date: 2019-12-21 20:24+0800\n" "Last-Translator: \n" "Language-Team: \n" "Language: en_US\n" @@ -1303,14 +1303,14 @@ msgid "" msgstr "" #: options.php:879 -msgid "Cover CDN" +msgid "Cover manifest" msgstr "" #: options.php:880 #, php-format msgid "" -"Fill in the cdn path for random picture display, without adding a slash at " -"the end, for example: https://cdn.jsdelivr.net/gh/mashirozx/sakura@3.3.3, " +"Fill in the manifest path for random picture display, without adding a slash " +"at the end, for example: https://cdn.jsdelivr.net/gh/mashirozx/sakura@3.3.3, " "please refer to Wiki . Click here to update manifest" msgstr "" diff --git a/languages/sakura.pot b/languages/sakura.pot index b9320ef..66378e4 100644 --- a/languages/sakura.pot +++ b/languages/sakura.pot @@ -3,7 +3,7 @@ msgid "" msgstr "" "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n" "Project-Id-Version: Sakura\n" -"POT-Creation-Date: 2019-12-15 14:40+0800\n" +"POT-Creation-Date: 2019-12-21 20:23+0800\n" "PO-Revision-Date: 2019-11-01 14:27+0800\n" "Last-Translator: \n" "Language-Team: \n" @@ -1287,13 +1287,13 @@ msgid "" msgstr "" #: options.php:879 -msgid "Cover CDN" +msgid "Cover manifest" msgstr "" #: options.php:880 #, php-format msgid "" -"Fill in the cdn path for random picture display, without adding a slash at the end, for " +"Fill in the manifest path for random picture display, without adding a slash at the end, for " "example: https://cdn.jsdelivr.net/gh/mashirozx/sakura@3.3.3, please refer to Wiki . Click here to update manifest" diff --git a/languages/zh_CN.mo b/languages/zh_CN.mo index f4480f5..6198127 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 9fd26c6..a1c1c93 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-12-15 14:41+0800\n" -"PO-Revision-Date: 2019-12-15 14:41+0800\n" +"POT-Creation-Date: 2019-12-21 20:23+0800\n" +"PO-Revision-Date: 2019-12-21 20:24+0800\n" "Last-Translator: \n" "Language-Team: \n" "Language: zh_CN\n" @@ -1324,27 +1324,21 @@ msgstr "" "名/2018/05/xx.png 加载" #: options.php:879 -msgid "Cover CDN" -msgstr "封面图图片库" +msgid "Cover manifest" +msgstr "" #: options.php:880 -#, fuzzy, php-format -#| msgid "" -#| "Fill in the cdn path for random picture display, without adding a slash " -#| "at the end, for example: https://cdn.jsdelivr.net/gh/mashirozx/" -#| "sakura@3.3.3, please refer to Wiki . Click here to update " -#| "manifest" +#, php-format msgid "" -"Fill in the cdn path for random picture display, without adding a slash at " -"the end, for example: https://cdn.jsdelivr.net/gh/mashirozx/sakura@3.3.3, " +"Fill in the manifest path for random picture display, without adding a slash " +"at the end, for example: https://cdn.jsdelivr.net/gh/mashirozx/sakura@3.3.3, " "please refer to Wiki . Click here to update manifest" msgstr "" -"填写 cdn 路径,用于随机图片展示,最后不用加斜杠,例:https://cdn.jsdelivr." -"net/gh/mashirozx/sakura@3.3.3 ,更多信息请参考Wiki。点击这里更新" -"manifest" +"填写 manifest 路径,用于随机图片展示,最后不用加斜杠,例:https://cdn." +"jsdelivr.net/gh/mashirozx/sakura@3.3.3 ,更多信息请参考Wiki。点击这里" +"更新manifest" #: options.php:886 msgid "Use the front-end library locally (lib.js、lib.css)" @@ -1858,6 +1852,9 @@ msgstr "注 册" msgid "Registration is not open yet." msgstr "暂未开放注册。" +#~ msgid "Cover CDN" +#~ msgstr "封面图图片库" + #~ msgid "Jsdelivr CDN" #~ msgstr "随机图片" diff --git a/manifest/manifest.py b/manifest/manifest.py index 0e7421c..b8f5ecc 100644 --- a/manifest/manifest.py +++ b/manifest/manifest.py @@ -44,7 +44,10 @@ class Single(object): def main(self): self.hash() # if os.path.exists(self.jpeg) and os.path.exists(self.webp): - self.optimize() + try: + self.optimize() + except OSError: + print("Falied to optimize the picture: " + self.file) self.manifest() return self.mani diff --git a/options.php b/options.php index 4d61858..fc2021d 100644 --- a/options.php +++ b/options.php @@ -876,8 +876,8 @@ function optionsframework_options() { 'type' => 'text'); $options[] = array( - 'name' => __('Cover CDN', 'sakura'),/*封面图片库*/ - 'desc' => sprintf(__('Fill in the cdn path for random picture display, without adding a slash at the end, for example: https://cdn.jsdelivr.net/gh/mashirozx/sakura@3.3.3, please refer to Wiki . Click here to update manifest', 'sakura'), rest_url('sakura/v1/database/update')),/*填写 cdn 路径,用于随机图片展示,最后不用加斜杠,例:https://cdn.jsdelivr.net/gh/mashirozx/sakura@3.3.3 ,更多信息请参考Wiki*/ + 'name' => __('Cover manifest', 'sakura'),/*封面图片库*/ + 'desc' => sprintf(__('Fill in the manifest path for random picture display, without adding a slash at the end, for example: https://cdn.jsdelivr.net/gh/mashirozx/sakura@3.3.3, please refer to Wiki . Click here to update manifest', 'sakura'), rest_url('sakura/v1/database/update')),/*填写 manifest 路径 ,用于随机图片展示,最后不用加斜杠,例:https://cdn.jsdelivr.net/gh/mashirozx/sakura@3.3.3 ,更多信息请参考Wiki*/ 'id' => 'cover_cdn', 'std' => 'https://cdn.jsdelivr.net/gh/mashirozx/sakura@3.3.3', 'type' => 'text');