Passed
Push — ci ( 14378d...da94ef )
by litefeel
02:58
created
lib/response.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 	 *
22 22
 	 * @param Writing_On_GitHub $app Application container.
23 23
 	 */
24
-	public function __construct( Writing_On_GitHub $app ) {
24
+	public function __construct(Writing_On_GitHub $app) {
25 25
 		$this->app = $app;
26 26
 	}
27 27
 
@@ -32,30 +32,30 @@  discard block
 block discarded – undo
32 32
 	 *
33 33
 	 * @return false
34 34
 	 */
35
-	public function error( WP_Error $error ) {
35
+	public function error(WP_Error $error) {
36 36
 		global $wp_version;
37 37
 
38
-		$this->log( $error );
38
+		$this->log($error);
39 39
 
40
-		if ( defined( 'DOING_AJAX' ) && DOING_AJAX && defined( 'WOGH_AJAX' ) && WOGH_AJAX ) {
40
+		if (defined('DOING_AJAX') && DOING_AJAX && defined('WOGH_AJAX') && WOGH_AJAX) {
41 41
 			/**
42 42
 			 * WordPress 4.1.0 introduced allowing WP_Error objects to be
43 43
 			 * passed directly into `wp_send_json_error`. This shims in
44 44
 			 * compatibility for older versions. We're currently supporting 3.9+.
45 45
 			 */
46
-			if ( version_compare( $wp_version, '4.1.0', '<' ) ) {
46
+			if (version_compare($wp_version, '4.1.0', '<')) {
47 47
 				$result = array();
48 48
 
49
-				foreach ( $error->errors as $code => $messages ) {
50
-					foreach ( $messages as $message ) {
51
-						$result[] = array( 'code' => $code, 'message' => $message );
49
+				foreach ($error->errors as $code => $messages) {
50
+					foreach ($messages as $message) {
51
+						$result[] = array('code' => $code, 'message' => $message);
52 52
 					}
53 53
 				}
54 54
 
55 55
 				$error = $result;
56 56
 			}
57 57
 
58
-			wp_send_json_error( $error );
58
+			wp_send_json_error($error);
59 59
 		}
60 60
 
61 61
 		return false;
@@ -68,11 +68,11 @@  discard block
 block discarded – undo
68 68
 	 *
69 69
 	 * @return true
70 70
 	 */
71
-	public function success( $success ) {
72
-		$this->log( $success );
71
+	public function success($success) {
72
+		$this->log($success);
73 73
 
74
-		if ( defined( 'DOING_AJAX' ) && DOING_AJAX && defined( 'WOGH_AJAX' ) && WOGH_AJAX ) {
75
-			wp_send_json_success( $success );
74
+		if (defined('DOING_AJAX') && DOING_AJAX && defined('WOGH_AJAX') && WOGH_AJAX) {
75
+			wp_send_json_success($success);
76 76
 		}
77 77
 
78 78
 		return true;
@@ -85,11 +85,11 @@  discard block
 block discarded – undo
85 85
 	 *
86 86
 	 * @param string|WP_Error $msg Message to log.
87 87
 	 */
88
-	protected function log( $msg ) {
89
-		if ( is_wp_error( $msg ) ) {
88
+	protected function log($msg) {
89
+		if (is_wp_error($msg)) {
90 90
 			$msg = $msg->get_error_message();
91 91
 		}
92 92
 
93
-		Writing_On_GitHub::write_log( $msg );
93
+		Writing_On_GitHub::write_log($msg);
94 94
 	}
95 95
 }
Please login to merge, or discard this patch.
lib/admin.php 2 patches
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -84,13 +84,13 @@  discard block
 block discarded – undo
84 84
 			)
85 85
 		);
86 86
 
87
-        register_setting( Writing_On_GitHub::$text_domain, 'wogh_ignore_author' );
88
-        add_settings_field( 'wogh_ignore_author', __( 'Ignore author', 'writing-on-github' ), array( &$this, 'checkbox_field_callback' ), Writing_On_GitHub::$text_domain, 'general', array(
89
-                'default'   => '',
90
-                'name'      => 'wogh_ignore_author',
91
-                'help_text' => __( 'Do not export author and do not use author info from GitHub.', 'writing-on-github' ),
92
-            )
93
-        );
87
+		register_setting( Writing_On_GitHub::$text_domain, 'wogh_ignore_author' );
88
+		add_settings_field( 'wogh_ignore_author', __( 'Ignore author', 'writing-on-github' ), array( &$this, 'checkbox_field_callback' ), Writing_On_GitHub::$text_domain, 'general', array(
89
+				'default'   => '',
90
+				'name'      => 'wogh_ignore_author',
91
+				'help_text' => __( 'Do not export author and do not use author info from GitHub.', 'writing-on-github' ),
92
+			)
93
+		);
94 94
 
95 95
 		// register_setting( Writing_On_GitHub::$text_domain, 'wogh_ignore_metas' );
96 96
 		// add_settings_field( 'wogh_ignore_metas', __( 'Ignore post metas', 'writing-on-github' ), array( &$this, 'textarea_field_callback' ), Writing_On_GitHub::$text_domain, 'general', array(
@@ -128,14 +128,14 @@  discard block
 block discarded – undo
128 128
 		include dirname( dirname( __FILE__ ) ) . '/views/textarea-setting-field.php';
129 129
 	}
130 130
 
131
-    /**
132
-     * Callback to render the checkbox field.
133
-     *
134
-     * @param array $args Field arguments.
135
-     */
136
-    public function checkbox_field_callback( $args ) {
137
-        include dirname( dirname( __FILE__ ) ) . '/views/checkbox-setting-field.php';
138
-    }
131
+	/**
132
+	 * Callback to render the checkbox field.
133
+	 *
134
+	 * @param array $args Field arguments.
135
+	 */
136
+	public function checkbox_field_callback( $args ) {
137
+		include dirname( dirname( __FILE__ ) ) . '/views/checkbox-setting-field.php';
138
+	}
139 139
 
140 140
 	/**
141 141
 	 * Displays settings messages from background processes
@@ -221,9 +221,9 @@  discard block
 block discarded – undo
221 221
 			Writing_On_GitHub::$instance->start_export();
222 222
 		}
223 223
 
224
-        if ( 'force_export' === $_GET['action'] ) {
225
-            Writing_On_GitHub::$instance->start_export(true);
226
-        }
224
+		if ( 'force_export' === $_GET['action'] ) {
225
+			Writing_On_GitHub::$instance->start_export(true);
226
+		}
227 227
 
228 228
 		if ( 'import' === $_GET['action'] ) {
229 229
 			Writing_On_GitHub::$instance->start_import();
Please login to merge, or discard this patch.
Spacing   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -13,16 +13,16 @@  discard block
 block discarded – undo
13 13
 	 * Hook into GitHub API
14 14
 	 */
15 15
 	public function __construct() {
16
-		add_action( 'admin_menu', array( $this, 'add_admin_menu' ) );
17
-		add_action( 'admin_init', array( $this, 'register_settings' ) );
18
-		add_action( 'current_screen', array( $this, 'trigger_cron' ) );
16
+		add_action('admin_menu', array($this, 'add_admin_menu'));
17
+		add_action('admin_init', array($this, 'register_settings'));
18
+		add_action('current_screen', array($this, 'trigger_cron'));
19 19
 	}
20 20
 
21 21
 	/**
22 22
 	 * Callback to render the settings page view
23 23
 	 */
24 24
 	public function settings_page() {
25
-		include dirname( dirname( __FILE__ ) ) . '/views/options.php';
25
+		include dirname(dirname(__FILE__)) . '/views/options.php';
26 26
 	}
27 27
 
28 28
 	/**
@@ -32,63 +32,63 @@  discard block
 block discarded – undo
32 32
 		add_settings_section(
33 33
 			'general',
34 34
 			'General Settings',
35
-			array( $this, 'section_callback' ),
35
+			array($this, 'section_callback'),
36 36
 			Writing_On_GitHub::$text_domain
37 37
 		);
38 38
 
39
-		register_setting( Writing_On_GitHub::$text_domain, 'wogh_host' );
40
-		add_settings_field( 'wogh_host', __( 'GitHub hostname', 'writing-on-github' ), array( $this, 'field_callback' ), Writing_On_GitHub::$text_domain, 'general', array(
39
+		register_setting(Writing_On_GitHub::$text_domain, 'wogh_host');
40
+		add_settings_field('wogh_host', __('GitHub hostname', 'writing-on-github'), array($this, 'field_callback'), Writing_On_GitHub::$text_domain, 'general', array(
41 41
 				'default'   => 'https://api.github.com',
42 42
 				'name'      => 'wogh_host',
43
-				'help_text' => __( 'The GitHub host to use. This only needs to be changed to support a GitHub Enterprise installation.', 'writing-on-github' ),
43
+				'help_text' => __('The GitHub host to use. This only needs to be changed to support a GitHub Enterprise installation.', 'writing-on-github'),
44 44
 			)
45 45
 		);
46 46
 
47
-		register_setting( Writing_On_GitHub::$text_domain, 'wogh_repository' );
48
-		add_settings_field( 'wogh_repository', __( 'Repository', 'writing-on-github' ), array( $this, 'field_callback' ), Writing_On_GitHub::$text_domain, 'general', array(
47
+		register_setting(Writing_On_GitHub::$text_domain, 'wogh_repository');
48
+		add_settings_field('wogh_repository', __('Repository', 'writing-on-github'), array($this, 'field_callback'), Writing_On_GitHub::$text_domain, 'general', array(
49 49
 				'default'   => '',
50 50
 				'name'      => 'wogh_repository',
51
-				'help_text' => __( 'The GitHub repository to commit to, with owner (<code>[OWNER]/[REPOSITORY]</code>), e.g., <code>github/hubot.github.com</code>. The repository should contain an initial commit, which is satisfied by including a README when you create the repository on GitHub.', 'writing-on-github' ),
51
+				'help_text' => __('The GitHub repository to commit to, with owner (<code>[OWNER]/[REPOSITORY]</code>), e.g., <code>github/hubot.github.com</code>. The repository should contain an initial commit, which is satisfied by including a README when you create the repository on GitHub.', 'writing-on-github'),
52 52
 			)
53 53
 		);
54 54
 
55
-		register_setting( Writing_On_GitHub::$text_domain, 'wogh_branch' );
56
-		add_settings_field( 'wogh_branch', __( 'Branch', 'writing-on-github' ), array( $this, 'field_callback' ), Writing_On_GitHub::$text_domain, 'general', array(
55
+		register_setting(Writing_On_GitHub::$text_domain, 'wogh_branch');
56
+		add_settings_field('wogh_branch', __('Branch', 'writing-on-github'), array($this, 'field_callback'), Writing_On_GitHub::$text_domain, 'general', array(
57 57
 				'default'   => 'master',
58 58
 				'name'      => 'wogh_branch',
59
-				'help_text' => __( 'The GitHub branch to commit to, default is master.', 'writing-on-github' ),
59
+				'help_text' => __('The GitHub branch to commit to, default is master.', 'writing-on-github'),
60 60
 			)
61 61
 		);
62 62
 
63
-		register_setting( Writing_On_GitHub::$text_domain, 'wogh_oauth_token' );
64
-		add_settings_field( 'wogh_oauth_token', __( 'Oauth Token', 'writing-on-github' ), array( $this, 'field_callback' ), Writing_On_GitHub::$text_domain, 'general', array(
63
+		register_setting(Writing_On_GitHub::$text_domain, 'wogh_oauth_token');
64
+		add_settings_field('wogh_oauth_token', __('Oauth Token', 'writing-on-github'), array($this, 'field_callback'), Writing_On_GitHub::$text_domain, 'general', array(
65 65
 				'default'   => '',
66 66
 				'name'      => 'wogh_oauth_token',
67
-				'help_text' => __( "A <a href='https://github.com/settings/tokens/new'>personal oauth token</a> with <code>public_repo</code> scope.", 'writing-on-github' ),
67
+				'help_text' => __("A <a href='https://github.com/settings/tokens/new'>personal oauth token</a> with <code>public_repo</code> scope.", 'writing-on-github'),
68 68
 			)
69 69
 		);
70 70
 
71
-		register_setting( Writing_On_GitHub::$text_domain, 'wogh_secret' );
72
-		add_settings_field( 'wogh_secret', __( 'Webhook Secret', 'writing-on-github' ), array( $this, 'field_callback' ), Writing_On_GitHub::$text_domain, 'general', array(
71
+		register_setting(Writing_On_GitHub::$text_domain, 'wogh_secret');
72
+		add_settings_field('wogh_secret', __('Webhook Secret', 'writing-on-github'), array($this, 'field_callback'), Writing_On_GitHub::$text_domain, 'general', array(
73 73
 				'default'   => '',
74 74
 				'name'      => 'wogh_secret',
75
-				'help_text' => __( "The webhook's secret phrase. This should be password strength, as it is used to verify the webhook's payload.", 'writing-on-github' ),
75
+				'help_text' => __("The webhook's secret phrase. This should be password strength, as it is used to verify the webhook's payload.", 'writing-on-github'),
76 76
 			)
77 77
 		);
78 78
 
79
-		register_setting( Writing_On_GitHub::$text_domain, 'wogh_default_user' );
80
-		add_settings_field( 'wogh_default_user', __( 'Default Import User', 'writing-on-github' ), array( &$this, 'user_field_callback' ), Writing_On_GitHub::$text_domain, 'general', array(
79
+		register_setting(Writing_On_GitHub::$text_domain, 'wogh_default_user');
80
+		add_settings_field('wogh_default_user', __('Default Import User', 'writing-on-github'), array(&$this, 'user_field_callback'), Writing_On_GitHub::$text_domain, 'general', array(
81 81
 				'default'   => '',
82 82
 				'name'      => 'wogh_default_user',
83
-				'help_text' => __( 'The fallback user for import, in case Writing On GitHub cannot find the committer in the database.', 'writing-on-github' ),
83
+				'help_text' => __('The fallback user for import, in case Writing On GitHub cannot find the committer in the database.', 'writing-on-github'),
84 84
 			)
85 85
 		);
86 86
 
87
-        register_setting( Writing_On_GitHub::$text_domain, 'wogh_ignore_author' );
88
-        add_settings_field( 'wogh_ignore_author', __( 'Ignore author', 'writing-on-github' ), array( &$this, 'checkbox_field_callback' ), Writing_On_GitHub::$text_domain, 'general', array(
87
+        register_setting(Writing_On_GitHub::$text_domain, 'wogh_ignore_author');
88
+        add_settings_field('wogh_ignore_author', __('Ignore author', 'writing-on-github'), array(&$this, 'checkbox_field_callback'), Writing_On_GitHub::$text_domain, 'general', array(
89 89
                 'default'   => '',
90 90
                 'name'      => 'wogh_ignore_author',
91
-                'help_text' => __( 'Do not export author and do not use author info from GitHub.', 'writing-on-github' ),
91
+                'help_text' => __('Do not export author and do not use author info from GitHub.', 'writing-on-github'),
92 92
             )
93 93
         );
94 94
 
@@ -106,8 +106,8 @@  discard block
 block discarded – undo
106 106
 	 *
107 107
 	 * @param array $args Field arguments.
108 108
 	 */
109
-	public function field_callback( $args ) {
110
-		include dirname( dirname( __FILE__ ) ) . '/views/setting-field.php';
109
+	public function field_callback($args) {
110
+		include dirname(dirname(__FILE__)) . '/views/setting-field.php';
111 111
 	}
112 112
 
113 113
 	/**
@@ -115,8 +115,8 @@  discard block
 block discarded – undo
115 115
 	 *
116 116
 	 * @param array $args Field arguments.
117 117
 	 */
118
-	public function user_field_callback( $args ) {
119
-		include dirname( dirname( __FILE__ ) ) . '/views/user-setting-field.php';
118
+	public function user_field_callback($args) {
119
+		include dirname(dirname(__FILE__)) . '/views/user-setting-field.php';
120 120
 	}
121 121
 
122 122
 	/**
@@ -124,8 +124,8 @@  discard block
 block discarded – undo
124 124
 	 *
125 125
 	 * @param array $args Field arguments.
126 126
 	 */
127
-	public function textarea_field_callback( $args ) {
128
-		include dirname( dirname( __FILE__ ) ) . '/views/textarea-setting-field.php';
127
+	public function textarea_field_callback($args) {
128
+		include dirname(dirname(__FILE__)) . '/views/textarea-setting-field.php';
129 129
 	}
130 130
 
131 131
     /**
@@ -133,58 +133,58 @@  discard block
 block discarded – undo
133 133
      *
134 134
      * @param array $args Field arguments.
135 135
      */
136
-    public function checkbox_field_callback( $args ) {
137
-        include dirname( dirname( __FILE__ ) ) . '/views/checkbox-setting-field.php';
136
+    public function checkbox_field_callback($args) {
137
+        include dirname(dirname(__FILE__)) . '/views/checkbox-setting-field.php';
138 138
     }
139 139
 
140 140
 	/**
141 141
 	 * Displays settings messages from background processes
142 142
 	 */
143 143
 	public function section_callback() {
144
-		if ( get_current_screen()->id !== 'settings_page_' . Writing_On_GitHub::$text_domain ) {
144
+		if (get_current_screen()->id !== 'settings_page_' . Writing_On_GitHub::$text_domain) {
145 145
 			return;
146 146
 		}
147 147
 
148
-		if ( 'yes' === get_option( '_wogh_export_started' ) ) { ?>
148
+		if ('yes' === get_option('_wogh_export_started')) { ?>
149 149
 			<div class="updated">
150
-				<p><?php esc_html_e( 'Export to GitHub started.', 'writing-on-github' ); ?></p>
150
+				<p><?php esc_html_e('Export to GitHub started.', 'writing-on-github'); ?></p>
151 151
 			</div><?php
152
-			delete_option( '_wogh_export_started' );
152
+			delete_option('_wogh_export_started');
153 153
 		}
154 154
 
155
-		if ( $message = get_option( '_wogh_export_error' ) ) { ?>
155
+		if ($message = get_option('_wogh_export_error')) { ?>
156 156
 			<div class="error">
157
-				<p><?php esc_html_e( 'Export to GitHub failed with error:', 'writing-on-github' ); ?> <?php echo esc_html( $message );?></p>
157
+				<p><?php esc_html_e('Export to GitHub failed with error:', 'writing-on-github'); ?> <?php echo esc_html($message); ?></p>
158 158
 			</div><?php
159
-			delete_option( '_wogh_export_error' );
159
+			delete_option('_wogh_export_error');
160 160
 		}
161 161
 
162
-		if ( 'yes' === get_option( '_wogh_export_complete' ) ) { ?>
162
+		if ('yes' === get_option('_wogh_export_complete')) { ?>
163 163
 			<div class="updated">
164
-				<p><?php esc_html_e( 'Export to GitHub completed successfully.', 'writing-on-github' );?></p>
164
+				<p><?php esc_html_e('Export to GitHub completed successfully.', 'writing-on-github'); ?></p>
165 165
 			</div><?php
166
-			delete_option( '_wogh_export_complete' );
166
+			delete_option('_wogh_export_complete');
167 167
 		}
168 168
 
169
-		if ( 'yes' === get_option( '_wogh_import_started' ) ) { ?>
169
+		if ('yes' === get_option('_wogh_import_started')) { ?>
170 170
 			<div class="updated">
171
-			<p><?php esc_html_e( 'Import from GitHub started.', 'writing-on-github' ); ?></p>
171
+			<p><?php esc_html_e('Import from GitHub started.', 'writing-on-github'); ?></p>
172 172
 			</div><?php
173
-			delete_option( '_wogh_import_started' );
173
+			delete_option('_wogh_import_started');
174 174
 		}
175 175
 
176
-		if ( $message = get_option( '_wogh_import_error' ) ) { ?>
176
+		if ($message = get_option('_wogh_import_error')) { ?>
177 177
 			<div class="error">
178
-			<p><?php esc_html_e( 'Import from GitHub failed with error:', 'writing-on-github' ); ?> <?php echo esc_html( $message );?></p>
178
+			<p><?php esc_html_e('Import from GitHub failed with error:', 'writing-on-github'); ?> <?php echo esc_html($message); ?></p>
179 179
 			</div><?php
180
-			delete_option( '_wogh_import_error' );
180
+			delete_option('_wogh_import_error');
181 181
 		}
182 182
 
183
-		if ( 'yes' === get_option( '_wogh_import_complete' ) ) { ?>
183
+		if ('yes' === get_option('_wogh_import_complete')) { ?>
184 184
 			<div class="updated">
185
-			<p><?php esc_html_e( 'Import from GitHub completed successfully.', 'writing-on-github' );?></p>
185
+			<p><?php esc_html_e('Import from GitHub completed successfully.', 'writing-on-github'); ?></p>
186 186
 			</div><?php
187
-			delete_option( '_wogh_import_complete' );
187
+			delete_option('_wogh_import_complete');
188 188
 		}
189 189
 	}
190 190
 
@@ -193,11 +193,11 @@  discard block
 block discarded – undo
193 193
 	 */
194 194
 	public function add_admin_menu() {
195 195
 		add_options_page(
196
-			__( 'Writing On GitHub', 'writing-on-github' ),
197
-			__( 'Writing On GitHub', 'writing-on-github' ),
196
+			__('Writing On GitHub', 'writing-on-github'),
197
+			__('Writing On GitHub', 'writing-on-github'),
198 198
 			'manage_options',
199 199
 			Writing_On_GitHub::$text_domain,
200
-			array( $this, 'settings_page' )
200
+			array($this, 'settings_page')
201 201
 		);
202 202
 	}
203 203
 
@@ -205,31 +205,31 @@  discard block
 block discarded – undo
205 205
 	 * Admin callback to trigger import/export because WordPress admin routing lol
206 206
 	 */
207 207
 	public function trigger_cron() {
208
-		if ( ! current_user_can( 'manage_options' ) ) {
208
+		if ( ! current_user_can('manage_options')) {
209 209
 			return;
210 210
 		}
211 211
 
212
-		if ( get_current_screen()->id !== 'settings_page_' . Writing_On_GitHub::$text_domain ) {
212
+		if (get_current_screen()->id !== 'settings_page_' . Writing_On_GitHub::$text_domain) {
213 213
 			return;
214 214
 		}
215 215
 
216
-		if ( ! isset( $_GET['action'] ) ) {
216
+		if ( ! isset($_GET['action'])) {
217 217
 			return;
218 218
 		}
219 219
 
220
-		if ( 'export' === $_GET['action'] ) {
220
+		if ('export' === $_GET['action']) {
221 221
 			Writing_On_GitHub::$instance->start_export();
222 222
 		}
223 223
 
224
-        if ( 'force_export' === $_GET['action'] ) {
224
+        if ('force_export' === $_GET['action']) {
225 225
             Writing_On_GitHub::$instance->start_export(true);
226 226
         }
227 227
 
228
-		if ( 'import' === $_GET['action'] ) {
228
+		if ('import' === $_GET['action']) {
229 229
 			Writing_On_GitHub::$instance->start_import();
230 230
 		}
231 231
 
232
-		wp_redirect( admin_url( 'options-general.php?page=writing-on-github' ) );
232
+		wp_redirect(admin_url('options-general.php?page=writing-on-github'));
233 233
 		die;
234 234
 	}
235 235
 }
Please login to merge, or discard this patch.
lib/blob.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -152,9 +152,9 @@
 block discarded – undo
152 152
 			array_pop( $matches );
153 153
 
154 154
 			$meta = spyc_load( $matches[2] );
155
-            if ( 'yes' == get_option('wogh_ignore_author') ) {
156
-                unset($meta['author']);
157
-            }
155
+			if ( 'yes' == get_option('wogh_ignore_author') ) {
156
+				unset($meta['author']);
157
+			}
158 158
 			// if ( isset( $meta['link'] ) ) {
159 159
 			// 	$meta['link'] = str_replace( home_url(), '', $meta['link'] );
160 160
 			// }
Please login to merge, or discard this patch.
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -49,8 +49,8 @@  discard block
 block discarded – undo
49 49
 	 *
50 50
 	 * @param stdClass $data Raw blob data.
51 51
 	 */
52
-	public function __construct( stdClass $data ) {
53
-		$this->interpret_data( $data );
52
+	public function __construct(stdClass $data) {
53
+		$this->interpret_data($data);
54 54
 	}
55 55
 
56 56
 	public function id() {
@@ -78,12 +78,12 @@  discard block
 block discarded – undo
78 78
 	 *
79 79
 	 * @return $this
80 80
 	 */
81
-	public function set_content( $content, $base64 = false ) {
82
-		if ( $base64 ) {
83
-			$content = base64_decode( $content );
81
+	public function set_content($content, $base64 = false) {
82
+		if ($base64) {
83
+			$content = base64_decode($content);
84 84
 		}
85 85
 
86
-		$this->frontmatter = '---' === substr( $this->content = $content, 0, 3 ) ? true : false;
86
+		$this->frontmatter = '---' === substr($this->content = $content, 0, 3) ? true : false;
87 87
 
88 88
 		return $this;
89 89
 	}
@@ -122,20 +122,20 @@  discard block
 block discarded – undo
122 122
 	public function content_import() {
123 123
 		$content = $this->content();
124 124
 
125
-		if ( $this->has_frontmatter() ) {
125
+		if ($this->has_frontmatter()) {
126 126
 			// Break out content.
127
-			preg_match( '/(^---(.*?)---$)?(.*)/ms', $content, $matches );
128
-			$content = array_pop( $matches );
127
+			preg_match('/(^---(.*?)---$)?(.*)/ms', $content, $matches);
128
+			$content = array_pop($matches);
129 129
 		}
130 130
 
131
-		if ( function_exists( 'wpmarkdown_markdown_to_html' ) ) {
132
-			$content = wpmarkdown_markdown_to_html( $content );
131
+		if (function_exists('wpmarkdown_markdown_to_html')) {
132
+			$content = wpmarkdown_markdown_to_html($content);
133 133
 		}
134 134
 
135 135
 		/**
136 136
 		 * Filters the content for import.
137 137
 		 */
138
-		return apply_filters( 'wogh_content_import', trim( $content ) );
138
+		return apply_filters('wogh_content_import', trim($content));
139 139
 	}
140 140
 
141 141
 	/**
@@ -146,13 +146,13 @@  discard block
 block discarded – undo
146 146
 	public function meta() {
147 147
 		$meta = array();
148 148
 
149
-		if ( $this->has_frontmatter() ) {
149
+		if ($this->has_frontmatter()) {
150 150
 			// Break out meta, if present.
151
-			preg_match( '/(^---(.*?)---$)?(.*)/ms', $this->content(), $matches );
152
-			array_pop( $matches );
151
+			preg_match('/(^---(.*?)---$)?(.*)/ms', $this->content(), $matches);
152
+			array_pop($matches);
153 153
 
154
-			$meta = spyc_load( $matches[2] );
155
-            if ( 'yes' == get_option('wogh_ignore_author') ) {
154
+			$meta = spyc_load($matches[2]);
155
+            if ('yes' == get_option('wogh_ignore_author')) {
156 156
                 unset($meta['author']);
157 157
             }
158 158
 			// if ( isset( $meta['link'] ) ) {
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
 		// $data->type = 'blob';
199 199
 
200 200
 		$data->path = $this->path();
201
-		$data->content = base64_encode( $this->content() );
201
+		$data->content = base64_encode($this->content());
202 202
 		$data->sha = $this->sha;
203 203
 
204 204
 		return $data;
@@ -207,13 +207,13 @@  discard block
 block discarded – undo
207 207
 	/**
208 208
 	 * Interprets the blob's data into properties.
209 209
 	 */
210
-	protected function interpret_data( $data ) {
211
-		$this->sha  = isset( $data->sha  ) ? $data->sha  : '';
212
-		$this->path = isset( $data->path ) ? $data->path : '';
210
+	protected function interpret_data($data) {
211
+		$this->sha  = isset($data->sha) ? $data->sha : '';
212
+		$this->path = isset($data->path) ? $data->path : '';
213 213
 
214 214
 		$this->set_content(
215
-			isset( $data->content ) ? trim( $data->content ) : '',
216
-			isset( $data->encoding ) && 'base64' === $data->encoding ? true : false
215
+			isset($data->content) ? trim($data->content) : '',
216
+			isset($data->encoding) && 'base64' === $data->encoding ? true : false
217 217
 		);
218 218
 	}
219 219
 }
Please login to merge, or discard this patch.
lib/payload.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -29,9 +29,9 @@  discard block
 block discarded – undo
29 29
 	 * @param Writing_On_GitHub $app      Application container.
30 30
 	 * @param string                $raw_data Raw request data.
31 31
 	 */
32
-	public function __construct( Writing_On_GitHub $app, $raw_data ) {
32
+	public function __construct(Writing_On_GitHub $app, $raw_data) {
33 33
 		$this->app  = $app;
34
-		$this->data = json_decode( $raw_data );
34
+		$this->data = json_decode($raw_data);
35 35
 	}
36 36
 
37 37
 	/**
@@ -41,32 +41,32 @@  discard block
 block discarded – undo
41 41
 	 */
42 42
 	public function should_import() {
43 43
 		// @todo how do we get this without importing the whole api object just for this?
44
-		if ( strtolower( $this->data->repository->full_name ) !== strtolower( $this->app->api()->fetch()->repository() ) ) {
44
+		if (strtolower($this->data->repository->full_name) !== strtolower($this->app->api()->fetch()->repository())) {
45 45
 			return false;
46 46
 		}
47 47
 
48 48
 		// The last term in the ref is the payload_branch name.
49
-		$refs   = explode( '/', $this->data->ref );
50
-		$payload_branch = array_pop( $refs );
49
+		$refs   = explode('/', $this->data->ref);
50
+		$payload_branch = array_pop($refs);
51 51
 
52 52
 		$branch = $this->app->api()->fetch()->branch();
53 53
 
54
-		if ( $branch !== $payload_branch ) {
54
+		if ($branch !== $payload_branch) {
55 55
 			return false;
56 56
 		}
57 57
 
58 58
 		// We add a tag to commits we push out, so we shouldn't pull them in again.
59
-		$tag = apply_filters( 'wogh_commit_msg_tag', 'wogh' );
59
+		$tag = apply_filters('wogh_commit_msg_tag', 'wogh');
60 60
 
61
-		if ( ! $tag ) {
62
-			throw new Exception( __( 'Commit message tag not set. Filter `wogh_commit_msg_tag` misconfigured.', 'writing-on-github' ) );
61
+		if ( ! $tag) {
62
+			throw new Exception(__('Commit message tag not set. Filter `wogh_commit_msg_tag` misconfigured.', 'writing-on-github'));
63 63
 		}
64 64
 
65
-		if ( $tag === substr( $this->message(), -1 * strlen( $tag ) ) ) {
65
+		if ($tag === substr($this->message(), -1 * strlen($tag))) {
66 66
 			return false;
67 67
 		}
68 68
 
69
-		if ( ! $this->get_commit_id() ) {
69
+		if ( ! $this->get_commit_id()) {
70 70
 			return false;
71 71
 		}
72 72
 
Please login to merge, or discard this patch.
lib/api.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 	 *
36 36
 	 * @param Writing_On_GitHub $app Application container.
37 37
 	 */
38
-	public function __construct( Writing_On_GitHub $app ) {
38
+	public function __construct(Writing_On_GitHub $app) {
39 39
 		$this->app = $app;
40 40
 	}
41 41
 
@@ -45,8 +45,8 @@  discard block
 block discarded – undo
45 45
 	 * @return Writing_On_GitHub_Fetch_Client
46 46
 	 */
47 47
 	public function fetch() {
48
-		if ( ! $this->fetch ) {
49
-			$this->fetch = new Writing_On_GitHub_Fetch_Client( $this->app );
48
+		if ( ! $this->fetch) {
49
+			$this->fetch = new Writing_On_GitHub_Fetch_Client($this->app);
50 50
 		}
51 51
 
52 52
 		return $this->fetch;
@@ -58,8 +58,8 @@  discard block
 block discarded – undo
58 58
 	 * @return Writing_On_GitHub_Persist_Client
59 59
 	 */
60 60
 	public function persist() {
61
-		if ( ! $this->persist ) {
62
-			$this->persist = new Writing_On_GitHub_Persist_Client( $this->app );
61
+		if ( ! $this->persist) {
62
+			$this->persist = new Writing_On_GitHub_Persist_Client($this->app);
63 63
 		}
64 64
 
65 65
 		return $this->persist;
Please login to merge, or discard this patch.
lib/fileinfo.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -6,13 +6,13 @@
 block discarded – undo
6 6
  */
7 7
 class Writing_On_GitHub_File_Info {
8 8
 
9
-	public function __construct( stdClass $data ) {
9
+	public function __construct(stdClass $data) {
10 10
 		$this->sha 			= $data->sha;
11 11
 		$this->path 		= $data->path;
12
-		$this->status 		= $data->status;
12
+		$this->status = $data->status;
13 13
 	}
14 14
 
15 15
 	public $sha;
16 16
 	public $path;
17
-	public $status;  // added removed modified
17
+	public $status; // added removed modified
18 18
 }
Please login to merge, or discard this patch.
lib/semaphore.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 	 * Clean up the old values on instantiation.
29 29
 	 */
30 30
 	public function __construct() {
31
-		delete_option( self::KEY );
31
+		delete_option(self::KEY);
32 32
 	}
33 33
 
34 34
 	/**
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 	 * @return bool
41 41
 	 */
42 42
 	public function is_open() {
43
-		if ( self::VALUE_LOCKED === get_transient( self::KEY ) ) {
43
+		if (self::VALUE_LOCKED === get_transient(self::KEY)) {
44 44
 			return false;
45 45
 		}
46 46
 
@@ -51,13 +51,13 @@  discard block
 block discarded – undo
51 51
 	 * Enables the push lock.
52 52
 	 */
53 53
 	public function lock() {
54
-		set_transient( self::KEY, self::VALUE_LOCKED, MINUTE_IN_SECONDS );
54
+		set_transient(self::KEY, self::VALUE_LOCKED, MINUTE_IN_SECONDS);
55 55
 	}
56 56
 
57 57
 	/**
58 58
 	 * Disables the push lock.
59 59
 	 */
60 60
 	public function unlock() {
61
-		set_transient( self::KEY, self::VALUE_UNLOCKED, MINUTE_IN_SECONDS );
61
+		set_transient(self::KEY, self::VALUE_UNLOCKED, MINUTE_IN_SECONDS);
62 62
 	}
63 63
 }
Please login to merge, or discard this patch.
lib/cli.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -44,28 +44,28 @@  discard block
 block discarded – undo
44 44
 	 *
45 45
 	 * @param array $args Command arguments.
46 46
 	 */
47
-	public function export( $args ) {
48
-		list( $post_id, $user_id ) = $args;
47
+	public function export($args) {
48
+		list($post_id, $user_id) = $args;
49 49
 
50
-		if ( ! is_numeric( $user_id ) ) {
51
-			WP_CLI::error( __( 'Invalid user ID', 'writing-on-github' ) );
50
+		if ( ! is_numeric($user_id)) {
51
+			WP_CLI::error(__('Invalid user ID', 'writing-on-github'));
52 52
 		}
53 53
 
54
-		$this->app->export()->set_user( $user_id );
54
+		$this->app->export()->set_user($user_id);
55 55
 
56
-		if ( 'all' === $post_id ) {
57
-			WP_CLI::line( __( 'Starting full export to GitHub.', 'writing-on-github' ) );
56
+		if ('all' === $post_id) {
57
+			WP_CLI::line(__('Starting full export to GitHub.', 'writing-on-github'));
58 58
 			$this->app->controller()->export_all();
59
-		} elseif ( is_numeric( $post_id ) ) {
59
+		} elseif (is_numeric($post_id)) {
60 60
 			WP_CLI::line(
61 61
 				sprintf(
62
-					__( 'Exporting post ID to GitHub: %d', 'writing-on-github' ),
62
+					__('Exporting post ID to GitHub: %d', 'writing-on-github'),
63 63
 					$post_id
64 64
 				)
65 65
 			);
66
-			$this->app->controller()->export_post( (int) $post_id );
66
+			$this->app->controller()->export_post((int) $post_id);
67 67
 		} else {
68
-			WP_CLI::error( __( 'Invalid post ID', 'writing-on-github' ) );
68
+			WP_CLI::error(__('Invalid post ID', 'writing-on-github'));
69 69
 		}
70 70
 	}
71 71
 
@@ -86,16 +86,16 @@  discard block
 block discarded – undo
86 86
 	 *
87 87
 	 * @param array $args Command arguments.
88 88
 	 */
89
-	public function import( $args ) {
90
-		list( $user_id ) = $args;
89
+	public function import($args) {
90
+		list($user_id) = $args;
91 91
 
92
-		if ( ! is_numeric( $user_id ) ) {
93
-			WP_CLI::error( __( 'Invalid user ID', 'writing-on-github' ) );
92
+		if ( ! is_numeric($user_id)) {
93
+			WP_CLI::error(__('Invalid user ID', 'writing-on-github'));
94 94
 		}
95 95
 
96
-		update_option( '_wogh_export_user_id', (int) $user_id );
96
+		update_option('_wogh_export_user_id', (int) $user_id);
97 97
 
98
-		WP_CLI::line( __( 'Starting import from GitHub.', 'writing-on-github' ) );
98
+		WP_CLI::line(__('Starting import from GitHub.', 'writing-on-github'));
99 99
 
100 100
 		$this->app->controller()->import_master();
101 101
 	}
@@ -119,40 +119,40 @@  discard block
 block discarded – undo
119 119
 	 * @param array $args Command arguments.
120 120
 	 * @param array $assoc_args Command associated arguments.
121 121
 	 */
122
-	public function prime( $args, $assoc_args ) {
123
-		if ( isset( $assoc_args['branch'] ) ) {
124
-			WP_CLI::line( __( 'Starting branch import.', 'writing-on-github' ) );
122
+	public function prime($args, $assoc_args) {
123
+		if (isset($assoc_args['branch'])) {
124
+			WP_CLI::line(__('Starting branch import.', 'writing-on-github'));
125 125
 
126 126
 			$commit = $this->app->api()->fetch()->master();
127 127
 
128
-			if ( is_wp_error( $commit ) ) {
128
+			if (is_wp_error($commit)) {
129 129
 				WP_CLI::error(
130 130
 					sprintf(
131
-						__( 'Failed to import and cache branch with error: %s', 'writing-on-github' ),
131
+						__('Failed to import and cache branch with error: %s', 'writing-on-github'),
132 132
 						$commit->get_error_message()
133 133
 					)
134 134
 				);
135 135
 			} else {
136 136
 				WP_CLI::success(
137 137
 					sprintf(
138
-						__( 'Successfully imported and cached commit %s from branch.', 'writing-on-github' ),
138
+						__('Successfully imported and cached commit %s from branch.', 'writing-on-github'),
139 139
 						$commit->sha()
140 140
 					)
141 141
 				);
142 142
 			}
143
-		} else if ( isset( $assoc_args['sha'] ) ) {
144
-			WP_CLI::line( 'Starting sha import.' );
143
+		} else if (isset($assoc_args['sha'])) {
144
+			WP_CLI::line('Starting sha import.');
145 145
 
146
-			$commit = $this->app->api()->fetch()->commit( $assoc_args['sha'] );
146
+			$commit = $this->app->api()->fetch()->commit($assoc_args['sha']);
147 147
 
148 148
 			WP_CLI::success(
149 149
 				sprintf(
150
-					__( 'Successfully imported and cached commit %s.', 'writing-on-github' ),
150
+					__('Successfully imported and cached commit %s.', 'writing-on-github'),
151 151
 					$commit->sha()
152 152
 				)
153 153
 			);
154 154
 		} else {
155
-			WP_CLI::error( 'Invalid fetch.' );
155
+			WP_CLI::error('Invalid fetch.');
156 156
 		}
157 157
 	}
158 158
 }
Please login to merge, or discard this patch.
lib/post.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -376,9 +376,9 @@
 block discarded – undo
376 376
 		if ( empty($this->post->post_excerpt) ) {
377 377
 			unset($meta['post_excerpt']);
378 378
 		}
379
-        if ( 'yes' == get_option('wogh_ignore_author') ) {
380
-            unset($meta['author']);
381
-        }
379
+		if ( 'yes' == get_option('wogh_ignore_author') ) {
380
+			unset($meta['author']);
381
+		}
382 382
 
383 383
 		//convert traditional post_meta values, hide hidden values, skip already populated values
384 384
 		// foreach ( get_post_custom( $this->id ) as $key => $value ) {
Please login to merge, or discard this patch.
Spacing   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -60,26 +60,26 @@  discard block
 block discarded – undo
60 60
 	 *
61 61
 	 * @todo remove database operations from this method
62 62
 	 */
63
-	public function __construct( $id_or_args, Writing_On_GitHub_Api $api ) {
63
+	public function __construct($id_or_args, Writing_On_GitHub_Api $api) {
64 64
 		$this->api = $api;
65 65
 
66
-		if ( is_numeric( $id_or_args ) ) {
66
+		if (is_numeric($id_or_args)) {
67 67
 			$this->id   = (int) $id_or_args;
68
-			$this->post = get_post( $this->id );
68
+			$this->post = get_post($this->id);
69 69
 			$this->new  = false;
70 70
 		}
71 71
 
72
-		if ( is_array( $id_or_args ) ) {
72
+		if (is_array($id_or_args)) {
73 73
 			$this->args = $id_or_args;
74 74
 
75
-			if ( isset( $this->args['ID'] ) ) {
76
-				$this->post = get_post( $this->args['ID'] );
75
+			if (isset($this->args['ID'])) {
76
+				$this->post = get_post($this->args['ID']);
77 77
 
78
-				if ( $this->post ) {
78
+				if ($this->post) {
79 79
 					$this->id  = $this->post->ID;
80 80
 					$this->new = false;
81 81
 				} else {
82
-					unset( $this->args['ID'] );
82
+					unset($this->args['ID']);
83 83
 				}
84 84
 			}
85 85
 		}
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 	 * @return bool
116 116
 	 */
117 117
 	public function has_password() {
118
-		return ! empty( $this->post->post_password );
118
+		return ! empty($this->post->post_password);
119 119
 	}
120 120
 
121 121
 	/**
@@ -123,9 +123,9 @@  discard block
 block discarded – undo
123 123
 	 */
124 124
 	public function github_content() {
125 125
 		$content = $this->front_matter() . $this->post_content();
126
-		$ending  = apply_filters( 'wogh_line_endings', "\n" );
126
+		$ending  = apply_filters('wogh_line_endings', "\n");
127 127
 
128
-		return preg_replace( '~(*BSR_ANYCRLF)\R~', $ending, $content );
128
+		return preg_replace('~(*BSR_ANYCRLF)\R~', $ending, $content);
129 129
 	}
130 130
 
131 131
 	/**
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 	 * Returns String the YAML frontmatter, ready to be written to the file
135 135
 	 */
136 136
 	public function front_matter() {
137
-		return "---\n" . spyc_dump( $this->meta() ) . "---\n";
137
+		return "---\n" . spyc_dump($this->meta()) . "---\n";
138 138
 	}
139 139
 
140 140
 	/**
@@ -145,24 +145,24 @@  discard block
 block discarded – undo
145 145
 	public function post_content() {
146 146
 		$content = $this->post->post_content;
147 147
 
148
-		if ( function_exists( 'wpmarkdown_html_to_markdown' ) ) {
149
-			$content = wpmarkdown_html_to_markdown( $content );
150
-		} else if ( class_exists( 'WPCom_Markdown' ) ) {
151
-			if ( WPCom_Markdown::get_instance()->is_markdown( $this->post->ID ) ) {
148
+		if (function_exists('wpmarkdown_html_to_markdown')) {
149
+			$content = wpmarkdown_html_to_markdown($content);
150
+		} else if (class_exists('WPCom_Markdown')) {
151
+			if (WPCom_Markdown::get_instance()->is_markdown($this->post->ID)) {
152 152
 				$content = $this->post->post_content_filtered;
153 153
 			}
154 154
 		}
155 155
 
156
-		return apply_filters( 'wogh_content_export', $content, $this );
156
+		return apply_filters('wogh_content_export', $content, $this);
157 157
 	}
158 158
 
159 159
 	public function old_github_path() {
160 160
 		return $this->old_github_path;
161 161
 	}
162 162
 
163
-	public function set_old_github_path( $path ) {
163
+	public function set_old_github_path($path) {
164 164
 		$this->old_github_path = $path;
165
-		update_post_meta( $this->id, '_wogh_github_path', $path);
165
+		update_post_meta($this->id, '_wogh_github_path', $path);
166 166
 	}
167 167
 
168 168
 
@@ -184,13 +184,13 @@  discard block
 block discarded – undo
184 184
 	 * @return string
185 185
 	 */
186 186
 	public function github_directory() {
187
-		if ( 'publish' !== $this->status() ) {
188
-			return apply_filters( 'wogh_directory_unpublished', '_drafts/', $this );
187
+		if ('publish' !== $this->status()) {
188
+			return apply_filters('wogh_directory_unpublished', '_drafts/', $this);
189 189
 		}
190 190
 
191 191
 		$name = '';
192 192
 
193
-		switch ( $this->type() ) {
193
+		switch ($this->type()) {
194 194
 			case 'post':
195 195
 				$name = 'posts';
196 196
 				break;
@@ -198,35 +198,35 @@  discard block
 block discarded – undo
198 198
 				$name = 'pages';
199 199
 				break;
200 200
 			default:
201
-				$obj = get_post_type_object( $this->type() );
201
+				$obj = get_post_type_object($this->type());
202 202
 
203
-				if ( $obj ) {
204
-					$name = strtolower( $obj->labels->name );
203
+				if ($obj) {
204
+					$name = strtolower($obj->labels->name);
205 205
 				}
206 206
 
207
-				if ( ! $name ) {
207
+				if ( ! $name) {
208 208
 					$name = '';
209 209
 				}
210 210
 		}
211 211
 
212
-		if ( $name ) {
212
+		if ($name) {
213 213
 			$name = '_' . $name . '/';
214 214
 		}
215 215
 
216
-		return apply_filters( 'wogh_directory_published', $name, $this );
216
+		return apply_filters('wogh_directory_published', $name, $this);
217 217
 	}
218 218
 
219 219
 	/**
220 220
 	 * Build GitHub filename based on post
221 221
 	 */
222 222
 	public function github_filename() {
223
-		if ( 'post' === $this->type() ) {
224
-			$filename = get_the_time( 'Y-m-d-', $this->id ) . $this->get_name() . '.md';
223
+		if ('post' === $this->type()) {
224
+			$filename = get_the_time('Y-m-d-', $this->id) . $this->get_name() . '.md';
225 225
 		} else {
226 226
 			$filename = $this->get_name() . '.md';
227 227
 		}
228 228
 
229
-		return apply_filters( 'wogh_filename', $filename, $this );
229
+		return apply_filters('wogh_filename', $filename, $this);
230 230
 	}
231 231
 
232 232
 	/**
@@ -235,11 +235,11 @@  discard block
 block discarded – undo
235 235
 	 * @return string
236 236
 	 */
237 237
 	protected function get_name() {
238
-		if ( '' !== $this->name() ) {
238
+		if ('' !== $this->name()) {
239 239
 			return $this->name();
240 240
 		}
241 241
 
242
-		return sanitize_title( get_the_title( $this->post ) );
242
+		return sanitize_title(get_the_title($this->post));
243 243
 	}
244 244
 
245 245
 	/**
@@ -247,9 +247,9 @@  discard block
 block discarded – undo
247 247
 	 * @return boolean
248 248
 	 */
249 249
 	public function is_on_github() {
250
-		$sha = get_post_meta( $this->id, '_wogh_sha', true );
251
-		$github_path = get_post_meta( $this->id, '_wogh_github_path', true );
252
-		if ( $sha && $github_path ) {
250
+		$sha = get_post_meta($this->id, '_wogh_sha', true);
251
+		$github_path = get_post_meta($this->id, '_wogh_github_path', true);
252
+		if ($sha && $github_path) {
253 253
 			return true;
254 254
 		}
255 255
 		return false;
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
 	 * @return string
262 262
 	 */
263 263
 	public function github_view_url() {
264
-		$github_path = get_post_meta( $this->id, '_wogh_github_path', true );
264
+		$github_path = get_post_meta($this->id, '_wogh_github_path', true);
265 265
 		$repository = $this->api->fetch()->repository();
266 266
 		$branch = $this->api->fetch()->branch();
267 267
 
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
 	 * @return string
275 275
 	 */
276 276
 	public function github_edit_url() {
277
-		$github_path = get_post_meta( $this->id, '_wogh_github_path', true );
277
+		$github_path = get_post_meta($this->id, '_wogh_github_path', true);
278 278
 		$repository = $this->api->fetch()->repository();
279 279
 		$branch = $this->api->fetch()->branch();
280 280
 
@@ -288,9 +288,9 @@  discard block
 block discarded – undo
288 288
 	 *
289 289
 	 * @return string
290 290
 	 */
291
-	public function get_directory_from_path( $path ) {
292
-		$directory = explode( '/', $path );
293
-		$directory = count( $directory ) > 0 ? $directory[0] : '';
291
+	public function get_directory_from_path($path) {
292
+		$directory = explode('/', $path);
293
+		$directory = count($directory) > 0 ? $directory[0] : '';
294 294
 
295 295
 		return $directory;
296 296
 	}
@@ -301,11 +301,11 @@  discard block
 block discarded – undo
301 301
 	 * Returns Array an array containing the author name and email
302 302
 	 */
303 303
 	public function last_modified_author() {
304
-		if ( $last_id = get_post_meta( $this->id, '_edit_last', true ) ) {
305
-			$user = get_userdata( $last_id );
304
+		if ($last_id = get_post_meta($this->id, '_edit_last', true)) {
305
+			$user = get_userdata($last_id);
306 306
 
307
-			if ( $user ) {
308
-				return array( 'name' => $user->display_name, 'email' => $user->user_email );
307
+			if ($user) {
308
+				return array('name' => $user->display_name, 'email' => $user->user_email);
309 309
 			}
310 310
 		}
311 311
 
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
 	 * Returns String the sha1 hash
320 320
 	 */
321 321
 	public function sha() {
322
-		$sha = get_post_meta( $this->id, '_wogh_sha', true );
322
+		$sha = get_post_meta($this->id, '_wogh_sha', true);
323 323
 
324 324
 		// If we've done a full export and we have no sha
325 325
 		// then we should try a live check to see if it exists.
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
 		// }
336 336
 
337 337
 		// if the sha still doesn't exist, then it's empty
338
-		if ( ! $sha || is_wp_error( $sha ) ) {
338
+		if ( ! $sha || is_wp_error($sha)) {
339 339
 			$sha = '';
340 340
 		}
341 341
 
@@ -347,8 +347,8 @@  discard block
 block discarded – undo
347 347
 	 *
348 348
 	 * @param string $sha
349 349
 	 */
350
-	public function set_sha( $sha ) {
351
-		update_post_meta( $this->id, '_wogh_sha', $sha );
350
+	public function set_sha($sha) {
351
+		update_post_meta($this->id, '_wogh_sha', $sha);
352 352
 	}
353 353
 
354 354
 	/**
@@ -359,24 +359,24 @@  discard block
 block discarded – undo
359 359
 	public function meta() {
360 360
 		$meta = array(
361 361
 			'ID'           => $this->id,
362
-			'post_title'   => get_the_title( $this->post ),
362
+			'post_title'   => get_the_title($this->post),
363 363
 			'post_name'    => $this->post->post_name,
364
-			'author'       => ( $author = get_userdata( $this->post->post_author ) ) ? $author->display_name : '',
364
+			'author'       => ($author = get_userdata($this->post->post_author)) ? $author->display_name : '',
365 365
 			'post_date'    => $this->post->post_date,
366 366
 			'post_excerpt' => $this->post->post_excerpt,
367
-			'layout'       => get_post_type( $this->post ),
368
-			'link'		   => get_permalink( $this->post ),
367
+			'layout'       => get_post_type($this->post),
368
+			'link'		   => get_permalink($this->post),
369 369
 			'published'    => 'publish' === $this->status() ? true : false,
370
-			'tags'         => wp_get_post_tags( $this->id, array( 'fields' => 'names' ) ),
371
-			'categories'   => wp_get_post_categories( $this->id, array( 'fields' => 'names' ) )
370
+			'tags'         => wp_get_post_tags($this->id, array('fields' => 'names')),
371
+			'categories'   => wp_get_post_categories($this->id, array('fields' => 'names'))
372 372
 		);
373
-		if ( empty($this->post->post_name) ) {
373
+		if (empty($this->post->post_name)) {
374 374
 			unset($meta['post_name']);
375 375
 		}
376
-		if ( empty($this->post->post_excerpt) ) {
376
+		if (empty($this->post->post_excerpt)) {
377 377
 			unset($meta['post_excerpt']);
378 378
 		}
379
-        if ( 'yes' == get_option('wogh_ignore_author') ) {
379
+        if ('yes' == get_option('wogh_ignore_author')) {
380 380
             unset($meta['author']);
381 381
         }
382 382
 
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
 
392 392
 		// }
393 393
 
394
-		return apply_filters( 'wogh_post_meta', $meta, $this );
394
+		return apply_filters('wogh_post_meta', $meta, $this);
395 395
 	}
396 396
 
397 397
 	/**
@@ -408,7 +408,7 @@  discard block
 block discarded – undo
408 408
 	 *
409 409
 	 * @param array $meta
410 410
 	 */
411
-	public function set_meta( $meta ) {
411
+	public function set_meta($meta) {
412 412
 		$this->meta = $meta;
413 413
 	}
414 414
 
@@ -437,7 +437,7 @@  discard block
 block discarded – undo
437 437
 	 *
438 438
 	 * @return $this
439 439
 	 */
440
-	public function set_post( WP_Post $post ) {
440
+	public function set_post(WP_Post $post) {
441 441
 		$this->post = $post;
442 442
 		$this->id   = $post->ID;
443 443
 
@@ -456,6 +456,6 @@  discard block
 block discarded – undo
456 456
 		$data->content = $this->github_content();
457 457
 		$data->sha     = $this->sha();
458 458
 
459
-		return new Writing_On_GitHub_Blob( $data );
459
+		return new Writing_On_GitHub_Blob($data);
460 460
 	}
461 461
 }
Please login to merge, or discard this patch.