@@ -24,8 +24,9 @@ discard block |
||
| 24 | 24 | public function init() { |
| 25 | 25 | $posts = get_posts($this->args); |
| 26 | 26 | |
| 27 | - if ( empty($posts) ) |
|
| 28 | - return; |
|
| 27 | + if ( empty($posts) ) { |
|
| 28 | + return; |
|
| 29 | + } |
|
| 29 | 30 | |
| 30 | 31 | foreach ( $posts as $post ) { |
| 31 | 32 | add_action( 'wp_syndicate_' . $post->post_name . '_import', array( $this, 'import' ) ); |
@@ -34,8 +35,9 @@ discard block |
||
| 34 | 35 | |
| 35 | 36 | public function ping() { |
| 36 | 37 | $posts = get_posts($this->args); |
| 37 | - if ( empty($posts) ) |
|
| 38 | - return; |
|
| 38 | + if ( empty($posts) ) { |
|
| 39 | + return; |
|
| 40 | + } |
|
| 39 | 41 | |
| 40 | 42 | foreach ( $posts as $post ) { |
| 41 | 43 | $key = $post->post_name; |
@@ -73,15 +75,18 @@ discard block |
||
| 73 | 75 | |
| 74 | 76 | public function set_event($post_id) { |
| 75 | 77 | |
| 76 | - if ( wp_is_post_revision($post_id) ) |
|
| 77 | - return; |
|
| 78 | + if ( wp_is_post_revision($post_id) ) { |
|
| 79 | + return; |
|
| 80 | + } |
|
| 78 | 81 | |
| 79 | - if ( 'wp-syndicate' != get_post_type($post_id) ) |
|
| 80 | - return; |
|
| 82 | + if ( 'wp-syndicate' != get_post_type($post_id) ) { |
|
| 83 | + return; |
|
| 84 | + } |
|
| 81 | 85 | |
| 82 | 86 | $post = get_post( $post_id ); |
| 83 | - if ( !is_object($post) ) |
|
| 84 | - return; |
|
| 87 | + if ( !is_object($post) ) { |
|
| 88 | + return; |
|
| 89 | + } |
|
| 85 | 90 | |
| 86 | 91 | $key = $post->post_name; |
| 87 | 92 | $interval_min = get_post_meta( $post_id, 'wp_syndicate-feed-retrieve-term', true ); |
@@ -91,8 +96,9 @@ discard block |
||
| 91 | 96 | $hook = 'wp_syndicate_' . $key . '_import'; |
| 92 | 97 | $event = 'wp_syndicate_' . $key; |
| 93 | 98 | |
| 94 | - if ( wp_next_scheduled( $hook, array( $post_id )) ) |
|
| 95 | - wp_clear_scheduled_hook( $hook, array( $post_id ) ); |
|
| 99 | + if ( wp_next_scheduled( $hook, array( $post_id )) ) { |
|
| 100 | + wp_clear_scheduled_hook( $hook, array( $post_id ) ); |
|
| 101 | + } |
|
| 96 | 102 | |
| 97 | 103 | wp_schedule_event( $action_time, $event, $hook, array( $post_id ) ); |
| 98 | 104 | spawn_cron( $action_time ); |
@@ -106,8 +112,9 @@ discard block |
||
| 106 | 112 | $options = get_option( 'wp_syndicate_options' ); |
| 107 | 113 | $post = get_post($post_id); |
| 108 | 114 | |
| 109 | - if ( !is_object($post) ) |
|
| 110 | - return; |
|
| 115 | + if ( !is_object($post) ) { |
|
| 116 | + return; |
|
| 117 | + } |
|
| 111 | 118 | |
| 112 | 119 | $this->media_id = $post_id; |
| 113 | 120 | $feed_url = html_entity_decode(get_post_meta( $post_id, 'wp_syndicate-feed-url', true ), ENT_QUOTES, 'UTF-8'); |
@@ -152,8 +159,9 @@ discard block |
||
| 152 | 159 | if ( empty($set_post_id) ) { |
| 153 | 160 | global $wpdb; |
| 154 | 161 | $db_ret = $wpdb->get_row( $wpdb->prepare( "SELECT count(1) as cnt FROM $wpdb->postmeta WHERE meta_key='%s'", $slug) ); |
| 155 | - if ( $db_ret === null || $db_ret->cnt !== '0' ) |
|
| 156 | - continue; |
|
| 162 | + if ( $db_ret === null || $db_ret->cnt !== '0' ) { |
|
| 163 | + continue; |
|
| 164 | + } |
|
| 157 | 165 | } |
| 158 | 166 | |
| 159 | 167 | if ( $registration_method == 'insert' && is_object($set_post) ) { |