This commit is contained in:
spirit 2019-12-24 20:03:43 +08:00
parent ad63468e4e
commit 15e7f3b57a
4 changed files with 8 additions and 8 deletions

View File

@ -470,7 +470,7 @@ function set_post_views() {
global $post; global $post;
$post_id = intval($post->ID); $post_id = intval($post->ID);
if($post_id) { if($post_id) {
$views = get_post_meta($post_id, 'views', true); $views = (int)get_post_meta($post_id, 'views', true);
if(!update_post_meta($post_id, 'views', ($views + 1))) { if(!update_post_meta($post_id, 'views', ($views + 1))) {
add_post_meta($post_id, 'views', 1, true); add_post_meta($post_id, 'views', 1, true);
} }

View File

@ -275,7 +275,7 @@ EOS;
$posts = new WP_Query('posts_per_page=-1&post_status=publish&post_type=post'); $posts = new WP_Query('posts_per_page=-1&post_status=publish&post_type=post');
while ($posts->have_posts()): $posts->the_post(); while ($posts->have_posts()): $posts->the_post();
$output .= '{"type":"post","link":"' . get_post_permalink() . '","title":' . json_encode(get_the_title()) . ',"comments":"' . get_comments_number('0', '1', '%') . '","text":' . json_encode(str_replace($vowels, " ", preg_replace($regex, ' ', get_the_content()))) . '},'; $output .= '{"type":"post","link":"' . get_permalink() . '","title":' . json_encode(get_the_title()) . ',"comments":"' . get_comments_number('0', '1', '%') . '","text":' . json_encode(str_replace($vowels, " ", preg_replace($regex, ' ', get_the_content()))) . '},';
endwhile; endwhile;
wp_reset_postdata(); wp_reset_postdata();
@ -373,12 +373,12 @@ function update_database() {
$manifest = file_get_contents($img_domain . "/manifest/manifest.json"); $manifest = file_get_contents($img_domain . "/manifest/manifest.json");
if($manifest) { if($manifest) {
$manifest = array( $manifest = array(
"key" => "manifest_json", "mate_key" => "manifest_json",
"value" => $manifest "mate_value" => $manifest
); );
$time = array( $time = array(
"key" => "json_time", "mate_key" => "json_time",
"value" => date("Y-m-d H:i:s",time()) "mate_value" => date("Y-m-d H:i:s",time())
); );
$wpdb->query("DELETE FROM `wp_sakura` WHERE `mate_key` ='manifest_json'"); $wpdb->query("DELETE FROM `wp_sakura` WHERE `mate_key` ='manifest_json'");

Binary file not shown.

View File

@ -2,7 +2,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Sakura\n" "Project-Id-Version: Sakura\n"
"POT-Creation-Date: 2019-12-21 20:23+0800\n" "POT-Creation-Date: 2019-12-21 20:23+0800\n"
"PO-Revision-Date: 2019-12-21 20:24+0800\n" "PO-Revision-Date: 2019-12-24 13:28+0800\n"
"Last-Translator: \n" "Last-Translator: \n"
"Language-Team: \n" "Language-Team: \n"
"Language: zh_CN\n" "Language: zh_CN\n"
@ -955,7 +955,7 @@ msgstr "聚焦图二链接"
#: options.php:509 #: options.php:509
msgid "Top-feature 3 image" msgid "Top-feature 3 image"
msgstr "聚焦图二链接" msgstr "聚焦图"
#: options.php:516 options.php:517 #: options.php:516 options.php:517
msgid "Top-feature 3 title" msgid "Top-feature 3 title"