Changeset 1864165
- Timestamp:
- 04/25/2018 12:58:44 PM (8 years ago)
- Location:
- wp-syndicate/trunk
- Files:
-
- 3 edited
-
modules/action.php (modified) (13 diffs)
-
readme.txt (modified) (4 diffs)
-
wp-syndicate.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wp-syndicate/trunk/modules/action.php
r1372197 r1864165 16 16 public function __construct() { 17 17 add_filter( 'cron_schedules', array( $this, 'cron_schedules' ) ); 18 add_action( 'publish_to_trash', array( $this, 'publish_to_trash' )); 18 19 add_action( 'save_post', array( $this, 'set_event' ) ); 19 20 add_action( 'admin_head', array( $this, 'ping' ) ); … … 21 22 add_action( 'init', array( $this, 'init' ) ); 22 23 } 23 24 24 25 public function init() { 25 26 $posts = get_posts($this->args); … … 31 32 add_action( 'wp_syndicate_' . $post->post_name . '_import', array( $this, 'import' ) ); 32 33 } 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 ) )); 33 43 } 34 44 … … 71 81 return $schedules; 72 82 } 73 83 74 84 public function set_event($post_id) { 75 85 … … 106 116 $options = get_option( 'wp_syndicate_options' ); 107 117 $post = get_post($post_id); 108 118 109 119 if ( !is_object($post) ) 110 120 return; … … 118 128 $feed->enable_cache(false); 119 129 }, 10); 120 130 121 131 add_filter( 'wp_feed_cache_transient_lifetime' , array( $this, 'return_0' ) ); 122 132 $rss = fetch_feed( $feed_url ); … … 144 154 foreach ( $rss_items as $item ) { 145 155 $this->is_enclosure = false; 146 156 147 157 //投稿ID取得 148 158 $slug = $post->post_name . '_' . $item->get_id(); 149 159 $set_post = get_page_by_path( sanitize_title($slug), OBJECT, $post_type ); 150 160 $set_post_id = $set_post == null ? '' : $set_post->ID; 151 161 152 162 if ( empty($set_post_id) ) { 153 163 global $wpdb; 154 164 $db_ret = $wpdb->get_row( $wpdb->prepare( "SELECT count(1) as cnt FROM $wpdb->postmeta WHERE meta_key='%s'", $slug) ); 155 165 if ( $db_ret === null || $db_ret->cnt !== '0' ) 156 continue; 157 } 158 166 continue; 167 } 168 159 169 if ( $registration_method == 'insert' && is_object($set_post) ) { 160 170 continue; … … 195 205 $this->is_enclosure = true; 196 206 $this->set_enclosure( $item->get_enclosure()->link ); 197 } 207 } 198 208 199 209 $this->match_count = 0; … … 214 224 $post_ids[] = $update_post_id; 215 225 } 216 } 217 226 } 227 218 228 if ( $flg ) { 219 229 $subject = '[' . get_bloginfo( 'name' ) . ']' . __( 'feed import success', WPSYND_DOMAIN ); … … 233 243 wp_mail( $options['error_mail'], $subject, $msg ); 234 244 } 235 245 236 246 } 237 247 … … 241 251 242 252 public function update_link( $matches ) { 243 253 244 254 if ( is_array($matches) && array_key_exists(2, $matches) && isset($this->post) && is_object($this->post) && is_a($this->post, 'wp_post_helper') ) { 245 255 $args = array(); … … 267 277 $thumnail_flg = true; 268 278 } 269 279 270 280 $this->post->add_media($media, '', '', '', $thumnail_flg); 271 281 $this->match_count++; … … 274 284 } else { 275 285 return $matches[0]; 276 } 286 } 277 287 } 278 288 return $matches[0]; 279 289 } 280 290 281 291 public function set_enclosure($link) { 282 292 if ( !empty($link) && is_object($this->post) && is_a($this->post, 'wp_post_helper') ) { -
wp-syndicate/trunk/readme.txt
r1372197 r1864165 1 1 === WP Syndicate === 2 Contributors: horike, megumithemes2 Contributors: horike,amimotoami,webnist,wokamoto,gatespace,mt8biz 3 3 Tags:feed, rss 4 4 Requires at least: 4.3 5 Tested up to: 4. 4.16 Stable tag: 1.1.2 25 Tested up to: 4.9.5 6 Stable tag: 1.1.23 7 7 8 8 == Description == … … 14 14 15 15 You can send your own language pack to me. 16 17 Please contact to me.18 19 gmail:horike37@gmail.com20 16 21 17 = Contributors = … … 73 69 74 70 = 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 76 72 77 73 = 1.1.19 = … … 86 82 = 1.1.22 = 87 83 * 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 5 5 * 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. 6 6 * Author: horike 7 * Version: 1.1.2 27 * Version: 1.1.23 8 8 * Author URI: http://digitalcube.jp 9 9 * License: GPL2+ … … 36 36 } 37 37 closedir(); 38
Note: See TracChangeset
for help on using the changeset viewer.