Passed
Push — ci ( 77eba0...79798a )
by litefeel
02:24
created
views/user-setting-field.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@
 block discarded – undo
1
-<?php $value = get_option( $args['name'], $args['default'] ); ?>
2
-<select name="<?php echo esc_attr( $args['name'] ) ?>" id="<?php echo esc_attr( $args['name'] ) ?>">
3
-	<?php foreach ( get_users() as $user ) : ?>
4
-		<option value="<?php echo esc_attr( $user->ID ); ?>"<?php echo (int) $value === $user->ID ? ' selected' : '';?>>
5
-			<?php echo esc_html( $user->display_name ); ?>
1
+<?php $value = get_option($args['name'], $args['default']); ?>
2
+<select name="<?php echo esc_attr($args['name']) ?>" id="<?php echo esc_attr($args['name']) ?>">
3
+	<?php foreach (get_users() as $user) : ?>
4
+		<option value="<?php echo esc_attr($user->ID); ?>"<?php echo (int) $value === $user->ID ? ' selected' : ''; ?>>
5
+			<?php echo esc_html($user->display_name); ?>
6 6
 		</option>
7 7
 	<?php endforeach; ?>
8 8
 </select>
Please login to merge, or discard this patch.
views/checkbox-setting-field.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -5,6 +5,6 @@
 block discarded – undo
5 5
  */
6 6
 
7 7
 ?>
8
-<?php $value = get_option( $args['name'], $args['default'] ); ?>
9
-<input type="checkbox" name="<?php echo esc_attr( $args['name'] ); ?>" id="<?php echo esc_attr( $args['name'] ); ?>" value="yes" <?php echo 'yes' === $value ? 'checked' : '';  ?> />
8
+<?php $value = get_option($args['name'], $args['default']); ?>
9
+<input type="checkbox" name="<?php echo esc_attr($args['name']); ?>" id="<?php echo esc_attr($args['name']); ?>" value="yes" <?php echo 'yes' === $value ? 'checked' : ''; ?> />
10 10
 <p class="description"><?php echo $args['help_text']; ?></p>
Please login to merge, or discard this patch.
views/setting-field.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -5,6 +5,6 @@
 block discarded – undo
5 5
  */
6 6
 
7 7
 ?>
8
-<?php $value = get_option( $args['name'], $args['default'] ); ?>
9
-<input name="<?php echo esc_attr( $args['name'] ); ?>" id="<?php echo esc_attr( $args['name'] ); ?>" type="<?php echo 'wogh_secret' === $args['name'] ? 'password' : 'text'; ?>" value="<?php echo esc_attr( $value ); ?>" />
8
+<?php $value = get_option($args['name'], $args['default']); ?>
9
+<input name="<?php echo esc_attr($args['name']); ?>" id="<?php echo esc_attr($args['name']); ?>" type="<?php echo 'wogh_secret' === $args['name'] ? 'password' : 'text'; ?>" value="<?php echo esc_attr($value); ?>" />
10 10
 <p class="description"><?php echo $args['help_text']; ?></p>
Please login to merge, or discard this patch.
writing-on-github.php 1 patch
Spacing   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -12,8 +12,8 @@  discard block
 block discarded – undo
12 12
 
13 13
 // If the functions have already been autoloaded, don't reload.
14 14
 // This fixes function duplication during unit testing.
15
-if ( defined( 'WRITING_ON_GITHUB_TEST' ) && WRITING_ON_GITHUB_TEST ) {
16
-	$path = dirname( __FILE__ ) . '/vendor/autoload.php';
15
+if (defined('WRITING_ON_GITHUB_TEST') && WRITING_ON_GITHUB_TEST) {
16
+	$path = dirname(__FILE__) . '/vendor/autoload.php';
17 17
 	include_once $path;
18 18
 }
19 19
 
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 // require_once(dirname(__FILE__) . '/views/options.php');
42 42
 // require_once(dirname(__FILE__) . '/views/user-setting-field.php');
43 43
 
44
-add_action( 'plugins_loaded', array( new Writing_On_GitHub, 'boot' ) );
44
+add_action('plugins_loaded', array(new Writing_On_GitHub, 'boot'));
45 45
 
46 46
 class Writing_On_GitHub {
47 47
 
@@ -138,14 +138,14 @@  discard block
 block discarded – undo
138 138
 	public function __construct() {
139 139
 		self::$instance = $this;
140 140
 
141
-		if ( is_admin() ) {
141
+		if (is_admin()) {
142 142
 			$this->admin = new Writing_On_GitHub_Admin;
143 143
 		}
144 144
 
145
-		$this->controller = new Writing_On_GitHub_Controller( $this );
145
+		$this->controller = new Writing_On_GitHub_Controller($this);
146 146
 
147
-		if ( defined( 'WP_CLI' ) && WP_CLI ) {
148
-			WP_CLI::add_command( 'wogh', $this->cli() );
147
+		if (defined('WP_CLI') && WP_CLI) {
148
+			WP_CLI::add_command('wogh', $this->cli());
149 149
 		}
150 150
 	}
151 151
 
@@ -153,30 +153,30 @@  discard block
 block discarded – undo
153 153
 	 * Attaches the plugin's hooks into WordPress.
154 154
 	 */
155 155
 	public function boot() {
156
-		register_activation_hook( __FILE__, array( $this, 'activate' ) );
157
-		add_action( 'admin_notices', array( $this, 'activation_notice' ) );
156
+		register_activation_hook(__FILE__, array($this, 'activate'));
157
+		add_action('admin_notices', array($this, 'activation_notice'));
158 158
 
159
-		add_action( 'init', array( $this, 'l10n' ) );
159
+		add_action('init', array($this, 'l10n'));
160 160
 
161 161
 		// Controller actions.
162
-		add_action( 'save_post', array( $this->controller, 'export_post' ) );
163
-		add_action( 'delete_post', array( $this->controller, 'delete_post' ) );
164
-		add_action( 'wp_ajax_nopriv_wogh_push_request', array( $this->controller, 'pull_posts' ) );
165
-        add_action( 'wogh_export', array( $this->controller, 'export_all' ), 10, 2 );
166
-		add_action( 'wogh_import', array( $this->controller, 'import_master' ), 10, 1 );
167
-		add_filter( 'get_edit_post_link', array( $this, 'edit_post_link' ), 10, 3 );
162
+		add_action('save_post', array($this->controller, 'export_post'));
163
+		add_action('delete_post', array($this->controller, 'delete_post'));
164
+		add_action('wp_ajax_nopriv_wogh_push_request', array($this->controller, 'pull_posts'));
165
+        add_action('wogh_export', array($this->controller, 'export_all'), 10, 2);
166
+		add_action('wogh_import', array($this->controller, 'import_master'), 10, 1);
167
+		add_filter('get_edit_post_link', array($this, 'edit_post_link'), 10, 3);
168 168
 
169 169
 		// add_filter( 'wogh_post_meta', array( $this, 'ignore_post_meta' ), 10, 1 );
170 170
 		// add_filter( 'wogh_pre_import_meta', array( $this, 'ignore_post_meta' ), 10, 1 );
171
-		add_filter( 'the_content', array( $this, 'the_content' ) );
171
+		add_filter('the_content', array($this, 'the_content'));
172 172
 
173
-		do_action( 'wogh_boot', $this );
173
+		do_action('wogh_boot', $this);
174 174
 	}
175 175
 
176 176
 	public function edit_post_link($link, $postID, $context) {
177
-		if ( ! wp_is_post_revision( $postID ) ) {
178
-			$post = new Writing_On_GitHub_Post( $postID, Writing_On_GitHub::$instance->api() );
179
-			if ( $post->is_on_github() ) {
177
+		if ( ! wp_is_post_revision($postID)) {
178
+			$post = new Writing_On_GitHub_Post($postID, Writing_On_GitHub::$instance->api());
179
+			if ($post->is_on_github()) {
180 180
 				return $post->github_edit_url();
181 181
 			}
182 182
 		}
@@ -235,29 +235,29 @@  discard block
 block discarded – undo
235 235
 	 * Init i18n files
236 236
 	 */
237 237
 	public function l10n() {
238
-		load_plugin_textdomain( self::$text_domain );
238
+		load_plugin_textdomain(self::$text_domain);
239 239
 	}
240 240
 
241 241
 	/**
242 242
 	 * Sets and kicks off the export cronjob
243 243
 	 */
244
-	public function start_export( $force = false ) {
245
-		$this->start_cron( 'export', $force );
244
+	public function start_export($force = false) {
245
+		$this->start_cron('export', $force);
246 246
 	}
247 247
 
248 248
 	/**
249 249
 	 * Sets and kicks off the import cronjob
250 250
 	 */
251 251
 	public function start_import() {
252
-		$this->start_cron( 'import' );
252
+		$this->start_cron('import');
253 253
 	}
254 254
 
255 255
 	/**
256 256
 	 * Enables the admin notice on initial activation
257 257
 	 */
258 258
 	public function activate() {
259
-		if ( 'yes' !== get_option( '_wogh_fully_exported' ) ) {
260
-			set_transient( '_wogh_activated', 'yes' );
259
+		if ('yes' !== get_option('_wogh_fully_exported')) {
260
+			set_transient('_wogh_activated', 'yes');
261 261
 		}
262 262
 	}
263 263
 
@@ -265,18 +265,18 @@  discard block
 block discarded – undo
265 265
 	 * Displays the activation admin notice
266 266
 	 */
267 267
 	public function activation_notice() {
268
-		if ( ! get_transient( '_wogh_activated' ) ) {
268
+		if ( ! get_transient('_wogh_activated')) {
269 269
 			return;
270 270
 		}
271 271
 
272
-		delete_transient( '_wogh_activated' );
272
+		delete_transient('_wogh_activated');
273 273
 
274 274
 		?><div class="updated">
275 275
 			<p>
276 276
 				<?php
277 277
 					printf(
278
-						__( 'To set up your site to sync with GitHub, update your <a href="%s">settings</a> and click "Export to GitHub."', 'writing-on-github' ),
279
-						admin_url( 'options-general.php?page=' . static::$text_domain)
278
+						__('To set up your site to sync with GitHub, update your <a href="%s">settings</a> and click "Export to GitHub."', 'writing-on-github'),
279
+						admin_url('options-general.php?page=' . static::$text_domain)
280 280
 					);
281 281
 				?>
282 282
 			</p>
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
 	 * @return Writing_On_GitHub_CLI
299 299
 	 */
300 300
 	public function cli() {
301
-		if ( ! $this->cli ) {
301
+		if ( ! $this->cli) {
302 302
 			$this->cli = new Writing_On_GitHub_CLI;
303 303
 		}
304 304
 
@@ -311,8 +311,8 @@  discard block
 block discarded – undo
311 311
 	 * @return Writing_On_GitHub_Request
312 312
 	 */
313 313
 	public function request() {
314
-		if ( ! $this->request ) {
315
-			$this->request = new Writing_On_GitHub_Request( $this );
314
+		if ( ! $this->request) {
315
+			$this->request = new Writing_On_GitHub_Request($this);
316 316
 		}
317 317
 
318 318
 		return $this->request;
@@ -324,8 +324,8 @@  discard block
 block discarded – undo
324 324
 	 * @return Writing_On_GitHub_Response
325 325
 	 */
326 326
 	public function response() {
327
-		if ( ! $this->response ) {
328
-			$this->response = new Writing_On_GitHub_Response( $this );
327
+		if ( ! $this->response) {
328
+			$this->response = new Writing_On_GitHub_Response($this);
329 329
 		}
330 330
 
331 331
 		return $this->response;
@@ -337,8 +337,8 @@  discard block
 block discarded – undo
337 337
 	 * @return Writing_On_GitHub_Api
338 338
 	 */
339 339
 	public function api() {
340
-		if ( ! $this->api ) {
341
-			$this->api = new Writing_On_GitHub_Api( $this );
340
+		if ( ! $this->api) {
341
+			$this->api = new Writing_On_GitHub_Api($this);
342 342
 		}
343 343
 
344 344
 		return $this->api;
@@ -350,8 +350,8 @@  discard block
 block discarded – undo
350 350
 	 * @return Writing_On_GitHub_Import
351 351
 	 */
352 352
 	public function import() {
353
-		if ( ! $this->import ) {
354
-			$this->import = new Writing_On_GitHub_Import( $this );
353
+		if ( ! $this->import) {
354
+			$this->import = new Writing_On_GitHub_Import($this);
355 355
 		}
356 356
 
357 357
 		return $this->import;
@@ -363,8 +363,8 @@  discard block
 block discarded – undo
363 363
 	 * @return Writing_On_GitHub_Export
364 364
 	 */
365 365
 	public function export() {
366
-		if ( ! $this->export ) {
367
-			$this->export = new Writing_On_GitHub_Export( $this );
366
+		if ( ! $this->export) {
367
+			$this->export = new Writing_On_GitHub_Export($this);
368 368
 		}
369 369
 
370 370
 		return $this->export;
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
 	 * @return Writing_On_GitHub_Semaphore
377 377
 	 */
378 378
 	public function semaphore() {
379
-		if ( ! $this->semaphore ) {
379
+		if ( ! $this->semaphore) {
380 380
 			$this->semaphore = new Writing_On_GitHub_Semaphore;
381 381
 		}
382 382
 
@@ -389,8 +389,8 @@  discard block
 block discarded – undo
389 389
 	 * @return Writing_On_GitHub_Database
390 390
 	 */
391 391
 	public function database() {
392
-		if ( ! $this->database ) {
393
-			$this->database = new Writing_On_GitHub_Database( $this );
392
+		if ( ! $this->database) {
393
+			$this->database = new Writing_On_GitHub_Database($this);
394 394
 		}
395 395
 
396 396
 		return $this->database;
@@ -402,7 +402,7 @@  discard block
 block discarded – undo
402 402
 	 * @return Writing_On_GitHub_Cache
403 403
 	 */
404 404
 	public function cache() {
405
-		if ( ! $this->cache ) {
405
+		if ( ! $this->cache) {
406 406
 			$this->cache = new Writing_On_GitHub_Cache;
407 407
 		}
408 408
 
@@ -417,18 +417,18 @@  discard block
 block discarded – undo
417 417
 	 * @param mixed $msg
418 418
 	 * @param string $write
419 419
 	 */
420
-	public static function write_log( $msg, $write = 'line' ) {
421
-		if ( defined( 'WP_CLI' ) && WP_CLI ) {
422
-			if ( is_array( $msg ) || is_object( $msg ) ) {
423
-				WP_CLI::print_value( $msg );
420
+	public static function write_log($msg, $write = 'line') {
421
+		if (defined('WP_CLI') && WP_CLI) {
422
+			if (is_array($msg) || is_object($msg)) {
423
+				WP_CLI::print_value($msg);
424 424
 			} else {
425
-				WP_CLI::$write( $msg );
425
+				WP_CLI::$write($msg);
426 426
 			}
427
-		} elseif ( true === WP_DEBUG ) {
428
-			if ( is_array( $msg ) || is_object( $msg ) ) {
429
-				error_log( print_r( $msg, true ) );
427
+		} elseif (true === WP_DEBUG) {
428
+			if (is_array($msg) || is_object($msg)) {
429
+				error_log(print_r($msg, true));
430 430
 			} else {
431
-				error_log( $msg );
431
+				error_log($msg);
432 432
 			}
433 433
 		}
434 434
 	}
@@ -439,10 +439,10 @@  discard block
 block discarded – undo
439 439
      * @param bool   $force
440 440
      * @param string $type
441 441
      */
442
-	protected function start_cron( $type, $force = false ) {
443
-		update_option( '_wogh_' . $type . '_started', 'yes' );
442
+	protected function start_cron($type, $force = false) {
443
+		update_option('_wogh_' . $type . '_started', 'yes');
444 444
 		$user_id = get_current_user_id();
445
-		wp_schedule_single_event( time(), 'wogh_' . $type . '', array( $user_id, $force ) );
445
+		wp_schedule_single_event(time(), 'wogh_' . $type . '', array($user_id, $force));
446 446
 		spawn_cron();
447 447
 	}
448 448
 }
Please login to merge, or discard this patch.