Plugin Directory

Changeset 1864165


Ignore:
Timestamp:
04/25/2018 12:58:44 PM (8 years ago)
Author:
horike
Message:

Update version

Location:
wp-syndicate/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • wp-syndicate/trunk/modules/action.php

    r1372197 r1864165  
    1616    public function __construct() {
    1717        add_filter( 'cron_schedules', array( $this, 'cron_schedules' ) );
     18        add_action( 'publish_to_trash', array( $this, 'publish_to_trash' ));
    1819        add_action( 'save_post', array( $this, 'set_event' ) );
    1920        add_action( 'admin_head', array( $this, 'ping' ) );
     
    2122        add_action( 'init', array( $this, 'init' ) );
    2223    }
    23    
     24
    2425    public function init() {
    2526        $posts = get_posts($this->args);
     
    3132            add_action( 'wp_syndicate_' . $post->post_name . '_import', array( $this, 'import' ) );
    3233        }
     34    }
     35
     36    public function publish_to_trash($post) {
     37        if ( 'wp-syndicate' !== $post->post_type )
     38            return;
     39
     40        $hook = 'wp_syndicate_' .  str_replace( '__trashed', '', $post->post_name ) . '_import';
     41        if ( wp_next_scheduled( $hook, array( $post->ID )) )
     42            var_dump(wp_clear_scheduled_hook( $hook, array( $post->ID ) ));
    3343    }
    3444
     
    7181        return $schedules;
    7282    }
    73    
     83
    7484    public function set_event($post_id) {
    7585
     
    106116        $options = get_option( 'wp_syndicate_options' );
    107117        $post = get_post($post_id);
    108        
     118
    109119        if ( !is_object($post) )
    110120            return;
     
    118128            $feed->enable_cache(false);
    119129        }, 10);
    120        
     130
    121131        add_filter( 'wp_feed_cache_transient_lifetime' , array( $this, 'return_0' ) );
    122132        $rss = fetch_feed( $feed_url );
     
    144154        foreach ( $rss_items as $item ) {
    145155            $this->is_enclosure = false;
    146            
     156
    147157            //投稿ID取得
    148158            $slug = $post->post_name . '_' . $item->get_id();
    149159            $set_post = get_page_by_path( sanitize_title($slug), OBJECT, $post_type );
    150160            $set_post_id = $set_post == null ? '' : $set_post->ID;
    151            
     161
    152162            if ( empty($set_post_id) ) {
    153163                global $wpdb;
    154164                $db_ret = $wpdb->get_row( $wpdb->prepare( "SELECT count(1) as cnt FROM $wpdb->postmeta WHERE meta_key='%s'", $slug) );
    155165                if ( $db_ret === null || $db_ret->cnt !== '0' )
    156                     continue; 
    157             }
    158            
     166                    continue;
     167            }
     168
    159169            if ( $registration_method == 'insert' && is_object($set_post) ) {
    160170                continue;
     
    195205                $this->is_enclosure = true;
    196206                $this->set_enclosure( $item->get_enclosure()->link );
    197             } 
     207            }
    198208
    199209            $this->match_count = 0;
     
    214224                $post_ids[] = $update_post_id;
    215225            }
    216         } 
    217        
     226        }
     227
    218228        if ( $flg ) {
    219229            $subject = '[' . get_bloginfo( 'name' ) . ']' . __( 'feed import success', WPSYND_DOMAIN );
     
    233243            wp_mail( $options['error_mail'], $subject, $msg );
    234244        }
    235        
     245
    236246    }
    237247
     
    241251
    242252    public function update_link( $matches ) {
    243    
     253
    244254        if ( is_array($matches) && array_key_exists(2, $matches) && isset($this->post) && is_object($this->post) && is_a($this->post, 'wp_post_helper') ) {
    245255            $args    = array();
     
    267277                    $thumnail_flg = true;
    268278                }
    269                
     279
    270280                $this->post->add_media($media, '', '', '', $thumnail_flg);
    271281                $this->match_count++;
     
    274284            } else {
    275285                return $matches[0];
    276             } 
     286            }
    277287        }
    278288        return $matches[0];
    279289    }
    280    
     290
    281291    public function set_enclosure($link) {
    282292        if ( !empty($link) && is_object($this->post) && is_a($this->post, 'wp_post_helper') ) {
  • wp-syndicate/trunk/readme.txt

    r1372197 r1864165  
    11=== WP Syndicate ===
    2 Contributors: horike,megumithemes
     2Contributors: horike,amimotoami,webnist,wokamoto,gatespace,mt8biz
    33Tags:feed, rss
    44Requires at least: 4.3
    5 Tested up to: 4.4.1
    6 Stable tag: 1.1.22
     5Tested up to: 4.9.5
     6Stable tag: 1.1.23
    77
    88== Description ==
     
    1414
    1515You can send your own language pack to me.
    16 
    17 Please contact to me.
    18 
    19 gmail:horike37@gmail.com
    2016
    2117= Contributors =
     
    7369
    7470= 1.1.18 =
    75 * When update post, exclude post_status, post_author, post_type 
     71* When update post, exclude post_status, post_author, post_type
    7672
    7773= 1.1.19 =
     
    8682= 1.1.22 =
    8783* Add some hook.
     84
     85= 1.1.23 =
     86* Fixed a bug that the syndication schedule will not be deleted when it is trashed
  • wp-syndicate/trunk/wp-syndicate.php

    r1372197 r1864165  
    55 * Description: It is a plug-in that WP Syndicate takes in an RSS feed, it is possible to capture the content of other sites on the WordPress site.
    66 * Author: horike
    7  * Version: 1.1.22
     7 * Version: 1.1.23
    88 * Author URI: http://digitalcube.jp
    99 * License: GPL2+
     
    3636}
    3737closedir();
    38 
Note: See TracChangeset for help on using the changeset viewer.