Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
fubo committed Jul 5, 2020
1 parent 7c07d6e commit d83d84b
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 49 deletions.
2 changes: 1 addition & 1 deletion fatratcollect.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: Fat Rat Collect
* Plugin URI: https://www.fatrat.cn
* Description: 胖鼠采集(Fat Rat Collect) 是一款可以帮助你批量采集文章数据的开源插件,采集含括微信采集、简书采集、知乎采集、列表采集、详情采集。完美支持自动采集、自动发布文章。图片本地化、关键字替换、自动标签、动态内容、等其他黑科技。是您建站好帮手!如果你还会一点Html JQuery知识。那就太棒了。
* Version: 2.2.3
* Version: 2.2.4
* Author: Fat Rat
* Author URI: https://www.fatrat.cn/about
* Disclaimer: Use at your own risk. No warranty expressed or implied is provided.
Expand Down
5 changes: 3 additions & 2 deletions includes/fatrat-data-detail.php
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,9 @@ public function article_to_storage($article, $custom_release_config = [])

$this->post_merge($post, $release_config);
if ($post_id = wp_insert_post($post)) {
(new FRC_Kit())->kit_auto_tags($post_id);
(new FRC_Kit())->kit_dynamic_fields($post_id);
$kitModel = new FRC_Kit();
$kitModel->kit_auto_tags($post_id);
$kitModel->kit_dynamic_fields($post_id);
$post = get_post($post_id, ARRAY_A);
$this->update_successful_status($article['id'], $post);
$this->update_post_meta($post['ID'], $release_config);
Expand Down
53 changes: 10 additions & 43 deletions includes/fatrat-kit.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,11 @@ public function kit_automatic_save_pic($postID){
}

public function kit_auto_tags($postID){
if ((defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)) {
$result = get_option(FRC_Validation::FRC_VALIDATION_AUTO_TAGS);
if ((defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) || empty($result) || json_decode($result)->switch != 'open') {
return;
}
// if ((defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)
// || (!current_user_can('edit_post', $postID))) {
// return;
// }
remove_action('publish_post', 'frc_auto_tags');

$post_content = get_post($postID)->post_content;
$add_tag_link = get_the_tags($postID);
if (!$add_tag_link){
Expand All @@ -46,21 +43,15 @@ public function kit_auto_tags($postID){
}
});
}

add_action('publish_post', 'frc_auto_tags');
}


public function kit_dynamic_fields($postID){
if ((defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)) {
$result = get_option(FRC_Validation::FRC_VALIDATION_DYNAMIC_FIELDS);
if ((defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) || empty($result) || json_decode($result)->switch != 'open') {
return;
}
// if ((defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)
// || (!current_user_can('edit_post', $postID))) {
// return;
// }

remove_action('publish_post', 'frc_dynamic_fields');
$content = get_post($postID)->post_content;

if (strpos( $content, '<blockquote' ) !== false || strpos( $content, '</blockquote>' ) !== false){
Expand Down Expand Up @@ -100,9 +91,7 @@ public function kit_dynamic_fields($postID){
}

wp_update_post(array('ID' => $postID, 'post_content' => $content));
add_action('publish_post', 'frc_dynamic_fields');
}

}

if (!function_exists("frc_image")) {
Expand All @@ -116,34 +105,12 @@ function frc_image($file){
}
}

$result = get_option(FRC_Validation::FRC_VALIDATION_AUTO_TAGS);
if ($result && json_decode($result)->switch === 'open'){
function frc_auto_tags($postID){
$model = new FRC_Kit();
$model->kit_auto_tags($postID);
}
add_action('publish_post', 'frc_auto_tags');
}

$result = get_option(FRC_Validation::FRC_VALIDATION_DYNAMIC_FIELDS);
if ($result && json_decode($result)->switch === 'open'){
function frc_dynamic_fields( $postID ) {
$model = new FRC_Kit();
$model->kit_dynamic_fields($postID);
}
add_action( 'publish_post', 'frc_dynamic_fields', 11);
}

/*
$result = get_option(FRC_Validation::FRC_VALIDATION_AUTOMATIC_SAVE_PIC);
if ($result && json_decode($result)->switch === 'open'){
function frc_automatic_save_pic( $postID ) {
$model = new FRC_Kit();
$model->kit_automatic_save_pic($postID);
}
add_action( 'publish_post', 'frc_automatic_save_pic');
function frc_auto_task($postID){
$model = new FRC_Kit();
$model->kit_auto_tags($postID);
$model->kit_dynamic_fields($postID);
}
*/
add_action('publish_post', 'frc_auto_task');

$result = get_option(FRC_Validation::FRC_VALIDATION_INNER_CHAIN);
if ($result && json_decode($result)->switch === 'open'){
Expand Down
5 changes: 3 additions & 2 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Donate link: https://www.fatrat.cn/bounty
Tags: 采集,微信公众号文章采集,知乎采集,列表采集,批量采集,分页采集,自动标签,自动采集,自动发布,seo,免费采集插件,caiji,pangshu
Requires at least: 4.6
Tested up to: 5.4
Stable tag: 2.2.3
Stable tag: 2.2.4
Requires PHP: 7.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Expand Down Expand Up @@ -91,8 +91,9 @@ php推荐 使用php72及以上版本

== Changelog ==

= 2.2.3
= 2.2.3-4
* 修复自动发布 动态内容,自动标签bug
* 优化代码,提升速度

= 2.2.1-2
* 微信采集链接优化
Expand Down
2 changes: 1 addition & 1 deletion views/todo.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<h3>历史更新:</h3>
<ul>
<li><b>v2.2.3</b></li>
<li><b>v2.2.3-4</b></li>
<li>修复自动发布自动tags/动态内容不生效.</li>
<li><b>v2.2.2</b></li>
<li>微信采集链接优化.</li>
Expand Down

0 comments on commit d83d84b

Please sign in to comment.