@@ -25,8 +25,9 @@ discard block |
||
| 25 | 25 | public function init() { |
| 26 | 26 | $posts = get_posts($this->args); |
| 27 | 27 | |
| 28 | - if ( empty($posts) ) |
|
| 29 | - return; |
|
| 28 | + if ( empty($posts) ) { |
|
| 29 | + return; |
|
| 30 | + } |
|
| 30 | 31 | |
| 31 | 32 | foreach ( $posts as $post ) { |
| 32 | 33 | add_action( 'wp_syndicate_' . $post->post_name . '_import', array( $this, 'import' ) ); |
@@ -34,18 +35,21 @@ discard block |
||
| 34 | 35 | } |
| 35 | 36 | |
| 36 | 37 | public function publish_to_trash($post) { |
| 37 | - if ( 'wp-syndicate' !== $post->post_type ) |
|
| 38 | - return; |
|
| 38 | + if ( 'wp-syndicate' !== $post->post_type ) { |
|
| 39 | + return; |
|
| 40 | + } |
|
| 39 | 41 | |
| 40 | 42 | $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 ) )); |
|
| 43 | + if ( wp_next_scheduled( $hook, array( $post->ID )) ) { |
|
| 44 | + var_dump(wp_clear_scheduled_hook( $hook, array( $post->ID ) )); |
|
| 45 | + } |
|
| 43 | 46 | } |
| 44 | 47 | |
| 45 | 48 | public function ping() { |
| 46 | 49 | $posts = get_posts($this->args); |
| 47 | - if ( empty($posts) ) |
|
| 48 | - return; |
|
| 50 | + if ( empty($posts) ) { |
|
| 51 | + return; |
|
| 52 | + } |
|
| 49 | 53 | |
| 50 | 54 | foreach ( $posts as $post ) { |
| 51 | 55 | $key = $post->post_name; |
@@ -83,15 +87,18 @@ discard block |
||
| 83 | 87 | |
| 84 | 88 | public function set_event($post_id) { |
| 85 | 89 | |
| 86 | - if ( wp_is_post_revision($post_id) ) |
|
| 87 | - return; |
|
| 90 | + if ( wp_is_post_revision($post_id) ) { |
|
| 91 | + return; |
|
| 92 | + } |
|
| 88 | 93 | |
| 89 | - if ( 'wp-syndicate' != get_post_type($post_id) ) |
|
| 90 | - return; |
|
| 94 | + if ( 'wp-syndicate' != get_post_type($post_id) ) { |
|
| 95 | + return; |
|
| 96 | + } |
|
| 91 | 97 | |
| 92 | 98 | $post = get_post( $post_id ); |
| 93 | - if ( !is_object($post) ) |
|
| 94 | - return; |
|
| 99 | + if ( !is_object($post) ) { |
|
| 100 | + return; |
|
| 101 | + } |
|
| 95 | 102 | |
| 96 | 103 | $key = $post->post_name; |
| 97 | 104 | $interval_min = get_post_meta( $post_id, 'wp_syndicate-feed-retrieve-term', true ); |
@@ -101,8 +108,9 @@ discard block |
||
| 101 | 108 | $hook = 'wp_syndicate_' . $key . '_import'; |
| 102 | 109 | $event = 'wp_syndicate_' . $key; |
| 103 | 110 | |
| 104 | - if ( wp_next_scheduled( $hook, array( $post_id )) ) |
|
| 105 | - wp_clear_scheduled_hook( $hook, array( $post_id ) ); |
|
| 111 | + if ( wp_next_scheduled( $hook, array( $post_id )) ) { |
|
| 112 | + wp_clear_scheduled_hook( $hook, array( $post_id ) ); |
|
| 113 | + } |
|
| 106 | 114 | |
| 107 | 115 | wp_schedule_event( $action_time, $event, $hook, array( $post_id ) ); |
| 108 | 116 | spawn_cron( $action_time ); |
@@ -116,8 +124,9 @@ discard block |
||
| 116 | 124 | $options = get_option( 'wp_syndicate_options' ); |
| 117 | 125 | $post = get_post($post_id); |
| 118 | 126 | |
| 119 | - if ( !is_object($post) ) |
|
| 120 | - return; |
|
| 127 | + if ( !is_object($post) ) { |
|
| 128 | + return; |
|
| 129 | + } |
|
| 121 | 130 | |
| 122 | 131 | $this->media_id = $post_id; |
| 123 | 132 | $feed_url = html_entity_decode(get_post_meta( $post_id, 'wp_syndicate-feed-url', true ), ENT_QUOTES, 'UTF-8'); |
@@ -162,8 +171,9 @@ discard block |
||
| 162 | 171 | if ( empty($set_post_id) ) { |
| 163 | 172 | global $wpdb; |
| 164 | 173 | $db_ret = $wpdb->get_row( $wpdb->prepare( "SELECT count(1) as cnt FROM $wpdb->postmeta WHERE meta_key='%s'", $slug) ); |
| 165 | - if ( $db_ret === null || $db_ret->cnt !== '0' ) |
|
| 166 | - continue; |
|
| 174 | + if ( $db_ret === null || $db_ret->cnt !== '0' ) { |
|
| 175 | + continue; |
|
| 176 | + } |
|
| 167 | 177 | } |
| 168 | 178 | |
| 169 | 179 | if ( $registration_method == 'insert' && is_object($set_post) ) { |