GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( a9bb7a...f1689e )
by takahiro
07:56
created
modules/action.php 2 patches
Spacing   +125 added lines, -125 removed lines patch added patch discarded remove patch
@@ -14,51 +14,51 @@  discard block
 block discarded – undo
14 14
 
15 15
 
16 16
 	public function __construct() {
17
-		add_filter( 'cron_schedules', array( $this, 'cron_schedules' ) );
18
-		add_action( 'publish_to_trash', array( $this, 'publish_to_trash' ));
19
-		add_action( 'save_post', array( $this, 'set_event' ) );
20
-		add_action( 'admin_head', array( $this, 'ping' ) );
21
-		add_action( 'template_redirect', array( $this, 'ping' ) );
22
-		add_action( 'init', array( $this, 'init' ) );
17
+		add_filter('cron_schedules', array($this, 'cron_schedules'));
18
+		add_action('publish_to_trash', array($this, 'publish_to_trash'));
19
+		add_action('save_post', array($this, 'set_event'));
20
+		add_action('admin_head', array($this, 'ping'));
21
+		add_action('template_redirect', array($this, 'ping'));
22
+		add_action('init', array($this, 'init'));
23 23
 	}
24 24
 
25 25
 	public function init() {
26 26
 		$posts = get_posts($this->args);
27 27
 
28
-		if ( empty($posts) )
28
+		if (empty($posts))
29 29
 			return;
30 30
 
31
-		foreach ( $posts as $post ) {
32
-			add_action( 'wp_syndicate_' . $post->post_name . '_import', array( $this, 'import' ) );
31
+		foreach ($posts as $post) {
32
+			add_action('wp_syndicate_'.$post->post_name.'_import', array($this, 'import'));
33 33
 		}
34 34
 	}
35 35
 
36 36
 	public function publish_to_trash($post) {
37
-		if ( 'wp-syndicate' !== $post->post_type )
37
+		if ('wp-syndicate' !== $post->post_type)
38 38
 			return;
39 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 ) ));
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)));
43 43
 	}
44 44
 
45 45
 	public function ping() {
46 46
 		$posts = get_posts($this->args);
47
-		if ( empty($posts) )
47
+		if (empty($posts))
48 48
 			return;
49 49
 
50
-		foreach ( $posts as $post ) {
50
+		foreach ($posts as $post) {
51 51
 			$key = $post->post_name;
52
-			$hook = 'wp_syndicate_' . $key . '_import';
52
+			$hook = 'wp_syndicate_'.$key.'_import';
53 53
 
54
-			if ( !wp_next_scheduled( $hook, array( $post->ID ) ) ) {
54
+			if (!wp_next_scheduled($hook, array($post->ID))) {
55 55
 				$this->set_event($post->ID);
56
-				$subject = '[' . get_bloginfo( 'name' ) . ']' . __( 'WP Cron Error', WPSYND_DOMAIN );
57
-				$msg  = sprintf( __( '%s of WP Cron restart, because it stopped.', WPSYND_DOMAIN ), $hook ) . "\n". __( 'action time', WPSYND_DOMAIN ). ':' . date_i18n('Y/m/d:H:i:s') . "\n\n\n";
56
+				$subject = '['.get_bloginfo('name').']'.__('WP Cron Error', WPSYND_DOMAIN);
57
+				$msg  = sprintf(__('%s of WP Cron restart, because it stopped.', WPSYND_DOMAIN), $hook)."\n".__('action time', WPSYND_DOMAIN).':'.date_i18n('Y/m/d:H:i:s')."\n\n\n";
58 58
 				$msg .= admin_url();
59
-				WP_SYND_logger::get_instance()->error( $subject, $msg );
60
-				$options = get_option( 'wp_syndicate_options' );
61
-				wp_mail( $options['error_mail'], $subject, $msg );
59
+				WP_SYND_logger::get_instance()->error($subject, $msg);
60
+				$options = get_option('wp_syndicate_options');
61
+				wp_mail($options['error_mail'], $subject, $msg);
62 62
 			}
63 63
 		}
64 64
 	}
@@ -66,16 +66,16 @@  discard block
 block discarded – undo
66 66
 	public function cron_schedules($schedules) {
67 67
 		$posts = get_posts($this->args);
68 68
 
69
-		if ( empty($posts) ) {
69
+		if (empty($posts)) {
70 70
 			return $schedules;
71 71
 		}
72 72
 
73
-		foreach ( $posts as $post ) {
74
-			$key = 'wp_syndicate_' . $post->post_name;
75
-			$interval_min = get_post_meta( $post->ID, 'wp_syndicate-feed-retrieve-term', true );
76
-			$interval = intval($interval_min)*60;
77
-			$display = get_the_title( $post->ID );
78
-			$schedules[$key] = array( 'interval' => $interval, 'display' => $display );
73
+		foreach ($posts as $post) {
74
+			$key = 'wp_syndicate_'.$post->post_name;
75
+			$interval_min = get_post_meta($post->ID, 'wp_syndicate-feed-retrieve-term', true);
76
+			$interval = intval($interval_min) * 60;
77
+			$display = get_the_title($post->ID);
78
+			$schedules[$key] = array('interval' => $interval, 'display' => $display);
79 79
 		}
80 80
 
81 81
 		return $schedules;
@@ -83,63 +83,63 @@  discard block
 block discarded – undo
83 83
 
84 84
 	public function set_event($post_id) {
85 85
 
86
-		if ( wp_is_post_revision($post_id) )
86
+		if (wp_is_post_revision($post_id))
87 87
 			return;
88 88
 
89
-		if ( 'wp-syndicate' != get_post_type($post_id) )
89
+		if ('wp-syndicate' != get_post_type($post_id))
90 90
 			return;
91 91
 
92
-		$post = get_post( $post_id );
93
-		if ( !is_object($post) )
92
+		$post = get_post($post_id);
93
+		if (!is_object($post))
94 94
 			return;
95 95
 
96 96
 		$key = $post->post_name;
97
-		$interval_min = get_post_meta( $post_id, 'wp_syndicate-feed-retrieve-term', true );
98
-		$interval = intval($interval_min)*60;
97
+		$interval_min = get_post_meta($post_id, 'wp_syndicate-feed-retrieve-term', true);
98
+		$interval = intval($interval_min) * 60;
99 99
 		$action_time = time() + $interval;
100 100
 
101
-		$hook = 'wp_syndicate_' . $key . '_import';
102
-		$event = 'wp_syndicate_' . $key;
101
+		$hook = 'wp_syndicate_'.$key.'_import';
102
+		$event = 'wp_syndicate_'.$key;
103 103
 
104
-		if ( wp_next_scheduled( $hook, array( $post_id )) )
105
-			wp_clear_scheduled_hook( $hook, array( $post_id ) );
104
+		if (wp_next_scheduled($hook, array($post_id)))
105
+			wp_clear_scheduled_hook($hook, array($post_id));
106 106
 
107
-		wp_schedule_event( $action_time, $event, $hook, array( $post_id )  );
108
-		spawn_cron( $action_time );
107
+		wp_schedule_event($action_time, $event, $hook, array($post_id));
108
+		spawn_cron($action_time);
109 109
 	}
110 110
 
111 111
 	public function import($post_id) {
112 112
 		global $allowedposttags;
113 113
 
114
-		$allowedposttags = apply_filters( 'wp_syndicate_allowedposttags', $allowedposttags );
114
+		$allowedposttags = apply_filters('wp_syndicate_allowedposttags', $allowedposttags);
115 115
 
116
-		$options = get_option( 'wp_syndicate_options' );
116
+		$options = get_option('wp_syndicate_options');
117 117
 		$post = get_post($post_id);
118 118
 
119
-		if ( !is_object($post) )
119
+		if (!is_object($post))
120 120
 			return;
121 121
 
122 122
 		$this->media_id = $post_id;
123
-		$feed_url = html_entity_decode(get_post_meta( $post_id, 'wp_syndicate-feed-url', true ), ENT_QUOTES, 'UTF-8');
123
+		$feed_url = html_entity_decode(get_post_meta($post_id, 'wp_syndicate-feed-url', true), ENT_QUOTES, 'UTF-8');
124 124
 
125
-		add_action('wp_feed_options', function(&$feed){
125
+		add_action('wp_feed_options', function(&$feed) {
126 126
 			$feed->set_timeout(30);
127 127
 			$feed->force_feed(true);
128 128
 			$feed->enable_cache(false);
129 129
 		}, 10);
130 130
 
131
-		add_filter( 'wp_feed_cache_transient_lifetime' , array( $this, 'return_0' ) );
132
-		$rss = fetch_feed( $feed_url );
133
-		remove_filter( 'wp_feed_cache_transient_lifetime' , array( $this, 'return_0' ) );
134
-		if ( is_wp_error( $rss ) ) {
135
-			$subject = '[' . get_bloginfo( 'name' ) . ']' . __( 'feed import failed', WPSYND_DOMAIN );
136
-			$msg  = sprintf( __( 'An error occurred at a feed retrieval of %s', WPSYND_DOMAIN ), $post->post_name ) . "\n". __( 'action time', WPSYND_DOMAIN ). ':' . date_i18n('Y/m/d:H:i:s') . "\n\n\n";
137
-			$msg .= __( 'below error message', WPSYND_DOMAIN ) . "\n";
131
+		add_filter('wp_feed_cache_transient_lifetime', array($this, 'return_0'));
132
+		$rss = fetch_feed($feed_url);
133
+		remove_filter('wp_feed_cache_transient_lifetime', array($this, 'return_0'));
134
+		if (is_wp_error($rss)) {
135
+			$subject = '['.get_bloginfo('name').']'.__('feed import failed', WPSYND_DOMAIN);
136
+			$msg  = sprintf(__('An error occurred at a feed retrieval of %s', WPSYND_DOMAIN), $post->post_name)."\n".__('action time', WPSYND_DOMAIN).':'.date_i18n('Y/m/d:H:i:s')."\n\n\n";
137
+			$msg .= __('below error message', WPSYND_DOMAIN)."\n";
138 138
 			$msg .= $rss->get_error_message()."\n\n";
139
-			$msg .= __( 'feed URL', WPSYND_DOMAIN ) . ':' . $feed_url;
140
-			$error_post_id = WP_SYND_logger::get_instance()->error( $subject, $msg );
141
-			$msg .= admin_url('/post.php?post=' . $error_post_id . '&action=edit');
142
-			wp_mail( $options['error_mail'], $subject, $msg );
139
+			$msg .= __('feed URL', WPSYND_DOMAIN).':'.$feed_url;
140
+			$error_post_id = WP_SYND_logger::get_instance()->error($subject, $msg);
141
+			$msg .= admin_url('/post.php?post='.$error_post_id.'&action=edit');
142
+			wp_mail($options['error_mail'], $subject, $msg);
143 143
 			return;
144 144
 		}
145 145
 
@@ -149,138 +149,138 @@  discard block
 block discarded – undo
149 149
 		$rss_items = $rss->get_items(0, 50);
150 150
 		$post_ids = array();
151 151
 		$flg = true;
152
-		$registration_method = get_post_meta( $post_id, 'wp_syndicate-registration-method', true );
153
-		$post_type = get_post_meta( $post_id, 'wp_syndicate-default-post-type', true );
154
-		foreach ( $rss_items as $item ) {
152
+		$registration_method = get_post_meta($post_id, 'wp_syndicate-registration-method', true);
153
+		$post_type = get_post_meta($post_id, 'wp_syndicate-default-post-type', true);
154
+		foreach ($rss_items as $item) {
155 155
 			$this->is_enclosure = false;
156 156
 
157 157
 			//投稿ID取得
158
-			$slug = $post->post_name . '_' . $item->get_id();
159
-			$set_post = get_page_by_path( sanitize_title($slug), OBJECT, $post_type );
158
+			$slug = $post->post_name.'_'.$item->get_id();
159
+			$set_post = get_page_by_path(sanitize_title($slug), OBJECT, $post_type);
160 160
 			$set_post_id = $set_post == null ? '' : $set_post->ID;
161 161
 
162
-			if ( empty($set_post_id) ) {
162
+			if (empty($set_post_id)) {
163 163
 				global $wpdb;
164
-				$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' )
164
+				$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 166
 					continue;
167 167
 			}
168 168
 
169
-			if ( $registration_method == 'insert' && is_object($set_post) ) {
169
+			if ($registration_method == 'insert' && is_object($set_post)) {
170 170
 				continue;
171 171
 			}
172 172
 
173 173
 			$updated = empty($set_post_id) ? false : true;
174
-			$is_skip = apply_filters( 'wp_syndicate_is_skip', false, $item, $updated, $set_post_id, $post_id );
175
-			if ( $is_skip ) {
174
+			$is_skip = apply_filters('wp_syndicate_is_skip', false, $item, $updated, $set_post_id, $post_id);
175
+			if ($is_skip) {
176 176
 				continue;
177 177
 			}
178 178
 
179 179
 			$post_args = array(
180 180
 								'ID' => $set_post_id,
181 181
 								'post_name' => $slug,
182
-								'post_date' => apply_filters( 'wp_syndicate_get_date', $item->get_date('Y/m/d H:i:s'), $post_id ),
183
- 								'post_title' => apply_filters( 'wp_syndicate_get_title', $item->get_title(), $post_id ),
182
+								'post_date' => apply_filters('wp_syndicate_get_date', $item->get_date('Y/m/d H:i:s'), $post_id),
183
+ 								'post_title' => apply_filters('wp_syndicate_get_title', $item->get_title(), $post_id),
184 184
 								'post_content' => '',
185 185
 							);
186
-			if ( !$updated ) {
187
-				$post_args['post_author'] = get_post_meta( $post_id, 'wp_syndicate-author-id', true );
188
-				$post_args['post_status'] = get_post_meta( $post_id, 'wp_syndicate-default-post-status', true );
189
-				$post_args['post_type'] = get_post_meta( $post_id, 'wp_syndicate-default-post-type', true );
186
+			if (!$updated) {
187
+				$post_args['post_author'] = get_post_meta($post_id, 'wp_syndicate-author-id', true);
188
+				$post_args['post_status'] = get_post_meta($post_id, 'wp_syndicate-default-post-status', true);
189
+				$post_args['post_type'] = get_post_meta($post_id, 'wp_syndicate-default-post-type', true);
190 190
 			}
191 191
 			$this->post = new wp_post_helper($post_args);
192 192
 
193 193
 			//画像の登録
194
-			if ( $updated ) {
195
-				$images = get_attached_media( 'image', $set_post_id );
196
-				if ( is_array( $images ) ) {
197
-					foreach ( $images as $image ) {
198
-						wp_delete_attachment( $image->ID );
194
+			if ($updated) {
195
+				$images = get_attached_media('image', $set_post_id);
196
+				if (is_array($images)) {
197
+					foreach ($images as $image) {
198
+						wp_delete_attachment($image->ID);
199 199
 					}
200 200
 				}
201 201
 			}
202 202
 
203
-			$content = apply_filters( 'the_content', $item->get_content() );
204
-			if ( $item->get_enclosure() && !empty($item->get_enclosure()->link) ) {
203
+			$content = apply_filters('the_content', $item->get_content());
204
+			if ($item->get_enclosure() && !empty($item->get_enclosure()->link)) {
205 205
 				$this->is_enclosure = true;
206
-				$this->set_enclosure( $item->get_enclosure()->link );
206
+				$this->set_enclosure($item->get_enclosure()->link);
207 207
 			}
208 208
 
209 209
 			$this->match_count = 0;
210
-			$content = preg_replace_callback( '#<img([^>]*)src=["\']([^"\']+)["\']([^>]*)>#i',  array($this, 'update_link'), $content, -1 );
210
+			$content = preg_replace_callback('#<img([^>]*)src=["\']([^"\']+)["\']([^>]*)>#i', array($this, 'update_link'), $content, -1);
211 211
 			$this->match_count = 0;
212 212
 			$this->post->set(array(
213
-								'post_content' => apply_filters( 'wp_syndicate_get_content', $content, $post_id )
213
+								'post_content' => apply_filters('wp_syndicate_get_content', $content, $post_id)
214 214
 							));
215
-			$this->post->add_meta( 'wp_syndicate-origin-of-syndication-slug', $post->post_name, true );
216
-			$this->post->add_meta( 'wp_syndicate-origin-of-syndication-siteurl', $this->host, true );
215
+			$this->post->add_meta('wp_syndicate-origin-of-syndication-slug', $post->post_name, true);
216
+			$this->post->add_meta('wp_syndicate-origin-of-syndication-siteurl', $this->host, true);
217 217
 
218 218
 			$update_post_id = $this->post->update();
219
-			if ( !$update_post_id ) {
219
+			if (!$update_post_id) {
220 220
 				$flg = false;
221 221
 			} else {
222
-				update_post_meta( $update_post_id, $slug, 1 );
223
-				do_action( 'wp_syndicate_save_post', $update_post_id, $item, $updated, $post_id );
222
+				update_post_meta($update_post_id, $slug, 1);
223
+				do_action('wp_syndicate_save_post', $update_post_id, $item, $updated, $post_id);
224 224
 				$post_ids[] = $update_post_id;
225 225
 			}
226 226
 		}
227 227
 
228
-		if ( $flg ) {
229
-			$subject = '[' . get_bloginfo( 'name' ) . ']' . __( 'feed import success', WPSYND_DOMAIN );
230
-			$msg = __( 'feed URL:', WPSYND_DOMAIN ) . $feed_url . "\n";
231
-			$msg .= sprintf( __( 'Feed acquisition completion of %s', WPSYND_DOMAIN ), $post->post_name ) . "\n" . __( 'action time', WPSYND_DOMAIN ). ':' . date_i18n('Y/m/d:H:i:s') . "\n\n\n";
232
-			$msg .= __( 'below ID data updates', WPSYND_DOMAIN ) . "\n";
233
-			$msg .= implode( "\n", $post_ids );
234
-			WP_SYND_logger::get_instance()->success( $subject, $msg );
228
+		if ($flg) {
229
+			$subject = '['.get_bloginfo('name').']'.__('feed import success', WPSYND_DOMAIN);
230
+			$msg = __('feed URL:', WPSYND_DOMAIN).$feed_url."\n";
231
+			$msg .= sprintf(__('Feed acquisition completion of %s', WPSYND_DOMAIN), $post->post_name)."\n".__('action time', WPSYND_DOMAIN).':'.date_i18n('Y/m/d:H:i:s')."\n\n\n";
232
+			$msg .= __('below ID data updates', WPSYND_DOMAIN)."\n";
233
+			$msg .= implode("\n", $post_ids);
234
+			WP_SYND_logger::get_instance()->success($subject, $msg);
235 235
 		} else {
236
-			$subject = '[' . get_bloginfo( 'name' ) . ']' . __( 'feed import failed', WPSYND_DOMAIN );
237
-			$msg = __( 'feed URL:', WPSYND_DOMAIN ) . $feed_url . "\n";
238
-			$msg .= sprintf( __( 'Failed to some data registration of %s', WPSYND_DOMAIN ), $post->post_name ) . "\n". __( 'action time', WPSYND_DOMAIN ). ':' . date_i18n('Y/m/d:H:i:s') . "\n\n\n";
239
-			$msg .= __( 'below ID data updates', WPSYND_DOMAIN ) . "\n";
240
-			$msg .= implode( "\n", $post_ids );
241
-			$error_post_id = WP_SYND_logger::get_instance()->error( $subject, $msg );
242
-			$msg .= admin_url('/post.php?post=' . $error_post_id . '&action=edit');
243
-			wp_mail( $options['error_mail'], $subject, $msg );
236
+			$subject = '['.get_bloginfo('name').']'.__('feed import failed', WPSYND_DOMAIN);
237
+			$msg = __('feed URL:', WPSYND_DOMAIN).$feed_url."\n";
238
+			$msg .= sprintf(__('Failed to some data registration of %s', WPSYND_DOMAIN), $post->post_name)."\n".__('action time', WPSYND_DOMAIN).':'.date_i18n('Y/m/d:H:i:s')."\n\n\n";
239
+			$msg .= __('below ID data updates', WPSYND_DOMAIN)."\n";
240
+			$msg .= implode("\n", $post_ids);
241
+			$error_post_id = WP_SYND_logger::get_instance()->error($subject, $msg);
242
+			$msg .= admin_url('/post.php?post='.$error_post_id.'&action=edit');
243
+			wp_mail($options['error_mail'], $subject, $msg);
244 244
 		}
245 245
 
246 246
 	}
247 247
 
248
-	public function return_0( $seconds ) {
248
+	public function return_0($seconds) {
249 249
 		return 0;
250 250
 	}
251 251
 
252
-	public function update_link( $matches ) {
252
+	public function update_link($matches) {
253 253
 
254
-		if ( is_array($matches) && array_key_exists(2, $matches) && isset($this->post) && is_object($this->post) && is_a($this->post, 'wp_post_helper') ) {
254
+		if (is_array($matches) && array_key_exists(2, $matches) && isset($this->post) && is_object($this->post) && is_a($this->post, 'wp_post_helper')) {
255 255
 			$args    = array();
256
-			$user    = get_post_meta( $this->media_id, 'wp_syndicate-basic-auth-user', true );
257
-			$pass    = get_post_meta( $this->media_id, 'wp_syndicate-basic-auth-pass', true );
258
-			if ( !empty($user) && !empty($pass) ) {
256
+			$user    = get_post_meta($this->media_id, 'wp_syndicate-basic-auth-user', true);
257
+			$pass    = get_post_meta($this->media_id, 'wp_syndicate-basic-auth-pass', true);
258
+			if (!empty($user) && !empty($pass)) {
259 259
 				$args = array(
260
-					'headers' => array( 'Authorization' => 'Basic ' . base64_encode( $user . ':' . $pass ) )
260
+					'headers' => array('Authorization' => 'Basic '.base64_encode($user.':'.$pass))
261 261
 				);
262 262
 			}
263 263
 
264 264
 			$args['timeout'] = 30;
265
-			if ( $media = remote_get_file($matches[2], '', $args) ) {
265
+			if ($media = remote_get_file($matches[2], '', $args)) {
266 266
 
267
-				if ( $this->is_enclosure === true ) {
267
+				if ($this->is_enclosure === true) {
268 268
 					$thumnail_flg = false;
269 269
 				} else {
270 270
 					$thumnail_flg = $this->match_count > 0 ? false : true;
271 271
 				}
272 272
 
273
-				$url = preg_split( '/wp-content/', $media );
274
-				$url = home_url( 'wp-content' . $url[1] );
273
+				$url = preg_split('/wp-content/', $media);
274
+				$url = home_url('wp-content'.$url[1]);
275 275
 
276
-				if ( $url == $this->enclosure_url ) {
276
+				if ($url == $this->enclosure_url) {
277 277
 					$thumnail_flg = true;
278 278
 				}
279 279
 
280 280
 				$this->post->add_media($media, '', '', '', $thumnail_flg);
281 281
 				$this->match_count++;
282 282
 
283
-				return apply_filters( 'wp_syndicate_return_img', '<img' . $matches[1] . 'src="' . $url . '"' . $matches[3] . '>', $thumnail_flg, $url, $this->enclosure_url, $this->match_count );
283
+				return apply_filters('wp_syndicate_return_img', '<img'.$matches[1].'src="'.$url.'"'.$matches[3].'>', $thumnail_flg, $url, $this->enclosure_url, $this->match_count);
284 284
 			} else {
285 285
 				return $matches[0];
286 286
 			}
@@ -289,21 +289,21 @@  discard block
 block discarded – undo
289 289
 	}
290 290
 
291 291
 	public function set_enclosure($link) {
292
-		if ( !empty($link) && is_object($this->post) && is_a($this->post, 'wp_post_helper') ) {
292
+		if (!empty($link) && is_object($this->post) && is_a($this->post, 'wp_post_helper')) {
293 293
 			$args    = array();
294
-			$user    = get_post_meta( $this->media_id, 'wp_syndicate-basic-auth-user', true );
295
-			$pass    = get_post_meta( $this->media_id, 'wp_syndicate-basic-auth-pass', true );
296
-			if ( !empty($user) && !empty($pass) ) {
294
+			$user    = get_post_meta($this->media_id, 'wp_syndicate-basic-auth-user', true);
295
+			$pass    = get_post_meta($this->media_id, 'wp_syndicate-basic-auth-pass', true);
296
+			if (!empty($user) && !empty($pass)) {
297 297
 				$args = array(
298
-					'headers' => array( 'Authorization' => 'Basic ' . base64_encode( $user . ':' . $pass ) )
298
+					'headers' => array('Authorization' => 'Basic '.base64_encode($user.':'.$pass))
299 299
 				);
300 300
 			}
301 301
 
302 302
 			$args['timeout'] = 30;
303
-			if ( $media = remote_get_file($link, '', $args) ) {
303
+			if ($media = remote_get_file($link, '', $args)) {
304 304
 				$this->post->add_media($media, '', '', '', true);
305
-				$url = preg_split( '/wp-content/', $media );
306
-				$url = home_url( 'wp-content' . $url[1] );
305
+				$url = preg_split('/wp-content/', $media);
306
+				$url = home_url('wp-content'.$url[1]);
307 307
 				$this->enclosure_url = $url;
308 308
 			}
309 309
 		}
Please login to merge, or discard this patch.
Braces   +30 added lines, -20 removed lines patch added patch discarded remove patch
@@ -25,8 +25,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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) ) {
Please login to merge, or discard this patch.