Skip to content

Commit 603f7bc

Browse files
committed
run phpcbf
1 parent c1415fc commit 603f7bc

11 files changed

+76
-111
lines changed

admin/class-shifter-admin.php

Lines changed: 52 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
* @subpackage Shifter/admin
2020
* @author DigitalCube <hello@getshifter.io>
2121
*/
22-
class Shifter_Admin
23-
{
22+
class Shifter_Admin {
23+
2424

2525
/**
2626
* The ID of this plugin.
@@ -47,8 +47,7 @@ class Shifter_Admin
4747
* @param string $plugin_name The name of this plugin.
4848
* @param string $version The version of this plugin.
4949
*/
50-
public function __construct($plugin_name, $version)
51-
{
50+
public function __construct( $plugin_name, $version ) {
5251
$this->plugin_name = $plugin_name;
5352
$this->version = $version;
5453
}
@@ -58,30 +57,31 @@ public function __construct($plugin_name, $version)
5857
*
5958
* @since 1.0.0
6059
*/
61-
public function notice_shifter_dashboard_timer()
62-
{
60+
public function notice_shifter_dashboard_timer() {
6361
$bootup_filename = '../.bootup';
6462
$hard_limit = 180;
65-
if ($_ENV["SHIFTER_LOCAL"]) return;
63+
if ( $_ENV['SHIFTER_LOCAL'] ) {
64+
return;
65+
}
6666

67-
if (file_exists($bootup_filename)) {
68-
$unixtime = file_get_contents($bootup_filename, true);
69-
$shifter_remain = $hard_limit - round((time() - intval($unixtime)) / 60);
70-
if ($shifter_remain < 3) { ?>
67+
if ( file_exists( $bootup_filename ) ) {
68+
$unixtime = file_get_contents( $bootup_filename, true );
69+
$shifter_remain = $hard_limit - round( ( time() - intval( $unixtime ) ) / 60 );
70+
if ( $shifter_remain < 3 ) { ?>
7171
<div class="error">
7272
<ul>
7373
Notice: Shifter will power down WordPress in a few minutes. Please restart WordPress from the Shifter Dashboard.
7474
</ul>
7575
</div>
76-
<?php
77-
} elseif ($shifter_remain < 30) {
78-
?>
76+
<?php
77+
} elseif ( $shifter_remain < 30 ) {
78+
?>
7979
<div class="error">
8080
<ul>
81-
Notice: Shifter will power down WordPress in <?php echo esc_html($shifter_remain); ?> minutes. Please restart WordPress from the Shifter Dashboard.
81+
Notice: Shifter will power down WordPress in <?php echo esc_html( $shifter_remain ); ?> minutes. Please restart WordPress from the Shifter Dashboard.
8282
</ul>
8383
</div>
84-
<?php
84+
<?php
8585
}
8686
}
8787
}
@@ -94,20 +94,19 @@ public function notice_shifter_dashboard_timer()
9494
* @param string $old_value Old Value.
9595
* @param string $value Value.
9696
*/
97-
public function option_cache_flush($option, $old_value = '', $value = '')
98-
{
99-
if (!empty($option)) {
100-
wp_cache_delete($option, 'options');
101-
foreach (array('alloptions', 'notoptions') as $options_name) {
102-
$options = wp_cache_get($options_name, 'options');
103-
if (!is_array($options)) {
97+
public function option_cache_flush( $option, $old_value = '', $value = '' ) {
98+
if ( ! empty( $option ) ) {
99+
wp_cache_delete( $option, 'options' );
100+
foreach ( array( 'alloptions', 'notoptions' ) as $options_name ) {
101+
$options = wp_cache_get( $options_name, 'options' );
102+
if ( ! is_array( $options ) ) {
104103
$options = array();
105104
}
106-
if (isset($options[$option])) {
107-
unset($options[$option]);
108-
wp_cache_set($options_name, $options, 'options');
105+
if ( isset( $options[ $option ] ) ) {
106+
unset( $options[ $option ] );
107+
wp_cache_set( $options_name, $options, 'options' );
109108
}
110-
unset($options);
109+
unset( $options );
111110
}
112111
}
113112
}
@@ -118,22 +117,21 @@ public function option_cache_flush($option, $old_value = '', $value = '')
118117
*
119118
* @since 1.0.0
120119
*/
121-
public function shifter_heartbert_on_sitepreview_write_script()
122-
{
123-
if (is_user_logged_in()) {
120+
public function shifter_heartbert_on_sitepreview_write_script() {
121+
if ( is_user_logged_in() ) {
124122
?>
125123
<script>
126124
function shifter_heartbert_getajax() {
127125
var xhr = new XMLHttpRequest();
128-
xhr.open("GET", "<?php echo esc_url(add_query_arg('action', 'nopriv_heartbeat', site_url('/wp-admin/admin-ajax.php'))); ?>");
126+
xhr.open("GET", "<?php echo esc_url( add_query_arg( 'action', 'nopriv_heartbeat', site_url( '/wp-admin/admin-ajax.php' ) ) ); ?>");
129127
xhr.send();
130128
}
131129
var shifterHB = setInterval("shifter_heartbert_getajax()", 30000);
132130
setTimeout(function() {
133131
clearInterval(shifterHB)
134132
}, 1500000);
135133
</script>
136-
<?php
134+
<?php
137135
}
138136
}
139137

@@ -144,8 +142,7 @@ function shifter_heartbert_getajax() {
144142
* @since 1.0.0
145143
* @param string $email_address Email address.
146144
*/
147-
public function shifter_mail_from($email_address)
148-
{
145+
public function shifter_mail_from( $email_address ) {
149146
return 'wordpress@app.getshifter.io';
150147
}
151148

@@ -157,19 +154,18 @@ public function shifter_mail_from($email_address)
157154
*
158155
* @since 1.1.1
159156
*/
160-
private function replace_url_to_public_domain($url)
161-
{
162-
$replaced_domain = getenv('SHIFTER_DOMAIN');
163-
if (!$replaced_domain) {
164-
$replaced_domain = getenv('CF_DOMAIN');
157+
private function replace_url_to_public_domain( $url ) {
158+
$replaced_domain = getenv( 'SHIFTER_DOMAIN' );
159+
if ( ! $replaced_domain ) {
160+
$replaced_domain = getenv( 'CF_DOMAIN' );
165161
}
166-
if ($replaced_domain) {
167-
$parsed_url = wp_parse_url($url);
162+
if ( $replaced_domain ) {
163+
$parsed_url = wp_parse_url( $url );
168164
$replace_target = $parsed_url['host'];
169-
if (isset($parsed_url['port']) && $parsed_url['port']) {
165+
if ( isset( $parsed_url['port'] ) && $parsed_url['port'] ) {
170166
$replace_target .= ":{$parsed_url['port']}";
171167
}
172-
return preg_replace("#{$replace_target}#i", $replaced_domain, $url);
168+
return preg_replace( "#{$replace_target}#i", $replaced_domain, $url );
173169
}
174170
return $url;
175171
}
@@ -181,9 +177,8 @@ private function replace_url_to_public_domain($url)
181177
*
182178
* @since 1.0.0
183179
*/
184-
public function replace_algolia_posts_permalink($record)
185-
{
186-
$record['permalink'] = $this->replace_url_to_public_domain($record['permalink']);
180+
public function replace_algolia_posts_permalink( $record ) {
181+
$record['permalink'] = $this->replace_url_to_public_domain( $record['permalink'] );
187182
return $record;
188183
}
189184
/**
@@ -193,9 +188,8 @@ public function replace_algolia_posts_permalink($record)
193188
*
194189
* @since 1.1.0
195190
*/
196-
public function replace_algolia_terms_permalink($record)
197-
{
198-
$record['permalink'] = $this->replace_url_to_public_domain($record['permalink']);
191+
public function replace_algolia_terms_permalink( $record ) {
192+
$record['permalink'] = $this->replace_url_to_public_domain( $record['permalink'] );
199193
return $record;
200194
}
201195

@@ -206,9 +200,8 @@ public function replace_algolia_terms_permalink($record)
206200
*
207201
* @since 1.1.0
208202
*/
209-
public function replace_algolia_users_posts_url($record)
210-
{
211-
$record['posts_url'] = $this->replace_url_to_public_domain($record['posts_url']);
203+
public function replace_algolia_users_posts_url( $record ) {
204+
$record['posts_url'] = $this->replace_url_to_public_domain( $record['posts_url'] );
212205
return $record;
213206
}
214207

@@ -217,8 +210,7 @@ public function replace_algolia_users_posts_url($record)
217210
*
218211
* @since 1.0.0
219212
*/
220-
public function shifter_icon()
221-
{
213+
public function shifter_icon() {
222214
return 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAC4jAAAuIwF4pT92AAAAB3RJTUUH4QUQCAwVRk5ANwAAAeFJREFUOMu9lEFIVEEYx38zs7LiQSja7BAaHcIoaqGDslFIyEadYusU0cki6yAaBV0FD8kSBGlLeVEwIcgkKMukDmEYLLXtJamI7dihQ0Qs+t73psM+t0V9vidI32mGmfl98/2/+Y/Cj9nMSN6IHIiJgxEHI+6ftplrW9hgxGrGFqgLWIscmk2OWqDajGS1ZS0A5RpwGeBDR7824hITB+05Xut8llLystKeKCNuRW/XVUpZ2fZlogKczYzQOdl1LiBpCYgD9aAO+vMe4Ea1Mq0KWDkO2BhA52QXr07dw3jSqj25YMTJp6Z7J/wDiQoMwC7L0ABs93lvEp/H06t0OjZ1EavUDNAHPHiXzu6PINnXHQujR3/sPR8ofKL6hpRKhMB+WaP3ATR9GgsAWo4Aj4Du9hdXX68D+yi6fuvO4v2l9bpMx5NLeeAMwNsTt0hN961J21UYflpKXtnYww6C/YMO/R+nRPHruO/xOuB32OaVdmPu5G2lrBf3fxyMuN6yU4y4uuoOcW1zMbcY5YaNvg3jIRf5BhyKAiz7TmgMqe5hpKYcftazhGUwBOY1F3M3I3c59bx3AMvjtVkWqzgN8D3ZHQ04n87S9vJ6BjgLzAGLFn4COWDP7vd3pgBaCndXnf0LIlef9HGSOIAAAAAASUVORK5CYII=';
223215
}
224216

@@ -227,10 +219,9 @@ public function shifter_icon()
227219
*
228220
* @since 1.0.0
229221
*/
230-
public function shifter_mu_admin()
231-
{
222+
public function shifter_mu_admin() {
232223
echo "<div class='wrap'>";
233-
echo '<h1>' . esc_html__('Shifter', 'shifter-mu-admin') . '</h1>';
224+
echo '<h1>' . esc_html__( 'Shifter', 'shifter-mu-admin' ) . '</h1>';
234225
echo "<div class='card'>
235226
<h2 class='title'>Generator Settings</h2>
236227
<span>Customize your static site generator settings for faster build times.</span>
@@ -254,8 +245,7 @@ public function shifter_mu_admin()
254245
*
255246
* @since 1.0.0
256247
*/
257-
public function shifter_mu_admin_page()
258-
{
248+
public function shifter_mu_admin_page() {
259249
add_menu_page(
260250
'Shifter',
261251
'Shifter',
@@ -274,18 +264,16 @@ public function shifter_mu_admin_page()
274264
*
275265
* @since 1.0.3
276266
*/
277-
public function hide_update_notice()
278-
{
279-
remove_action('admin_notices', 'update_nag', 3);
267+
public function hide_update_notice() {
268+
remove_action( 'admin_notices', 'update_nag', 3 );
280269
}
281270

282271
/**
283272
* Remove Core Update
284273
*
285274
* @since 1.0.4
286275
*/
287-
public function remove_core_updates()
288-
{
276+
public function remove_core_updates() {
289277
global $wp_version;
290278
return (object) array(
291279
'last_checked' => time(),

api/class-shifter-api.php

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -97,12 +97,12 @@ public function __construct() {
9797
$this->access_token = getenv( 'SHIFTER_ACCESS_TOKEN' );
9898
$this->refresh_token = getenv( 'SHIFTER_REFRESH_TOKEN' );
9999

100-
$shifter_api = getenv( 'SHIFTER_API_URL' );
101-
$this->terminate_url = "$shifter_api/sites/$this->site_id/wordpress_site/stop";
102-
$this->generate_url = "$shifter_api/sites/$this->site_id/artifacts";
100+
$shifter_api = getenv( 'SHIFTER_API_URL' );
101+
$this->terminate_url = "$shifter_api/sites/$this->site_id/wordpress_site/stop";
102+
$this->generate_url = "$shifter_api/sites/$this->site_id/artifacts";
103103
$this->update_active_user_url = "$shifter_api/sites/$this->site_id/wordpress_site/update_active_user";
104-
$this->refresh_url = "$shifter_api/login";
105-
$this->shifter_dashboard_url = "https://go.getshifter.io/admin/sites/$this->site_id";
104+
$this->refresh_url = "$shifter_api/login";
105+
$this->shifter_dashboard_url = "https://go.getshifter.io/admin/sites/$this->site_id";
106106

107107
$bootup_unixtimestamp = file_get_contents( ABSPATH . '/.bootup' );
108108
$bootup_date = new DateTime();
@@ -166,7 +166,7 @@ public function notify_login( $username ) {
166166
* @since 1.2.0
167167
*/
168168
public function notify_logout( $user_id ) {
169-
$user = get_user_by('ID', $user_id);
169+
$user = get_user_by( 'ID', $user_id );
170170
$result = $this->call_update_active_user( false, $user->user_login );
171171
}
172172

@@ -184,15 +184,17 @@ private function call_update_active_user( $append, $username ) {
184184
'authorization' => $this->access_token,
185185
'content-Type' => 'application/json',
186186
);
187-
$body = wp_json_encode( array(
188-
'append' => $append,
189-
'username' => $username
190-
) );
191-
$args = array(
187+
$body = wp_json_encode(
188+
array(
189+
'append' => $append,
190+
'username' => $username,
191+
)
192+
);
193+
$args = array(
192194
'method' => 'POST',
193195
'headers' => $headers,
194196
'blocking' => false,
195-
'body' => $body,
197+
'body' => $body,
196198
);
197199

198200
return wp_remote_request( $this->update_active_user_url, $args );

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
},
1010
"scripts": {
1111
"post-install-cmd": [
12-
"\"vendor/bin/phpcs\" --config-set installed_paths vendor/wp-coding-standards/wpcs"
12+
"\"vendor/bin/phpcs\" --config-set installed_paths vendor/wp-coding-standards/wpcs,vendor/phpcsstandards/phpcsutils,vendor/phpcsstandards/phpcsextra"
1313
],
1414
"post-update-cmd": [
15-
"\"vendor/bin/phpcs\" --config-set installed_paths vendor/wp-coding-standards/wpcs"
15+
"\"vendor/bin/phpcs\" --config-set installed_paths vendor/wp-coding-standards/wpcs,vendor/phpcsstandards/phpcsutils,vendor/phpcsstandards/phpcsextra"
1616
],
1717
"cs-fix": [
1818
"phpcbf . -pwv --ignore=vendor,node_modules,volume --extensions=php --standard=WordPress || git diff"

global/class-shifter-global.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ public function enqueue_styles() {
7373
wp_register_style( 'sweetalert2', 'https://cdnjs.cloudflare.com/ajax/libs/limonte-sweetalert2/7.26.11/sweetalert2.min.css', array(), '7.26.11' );
7474
wp_enqueue_style( 'sweetalert2' );
7575
}
76-
7776
}
7877

7978
/**
@@ -90,7 +89,6 @@ public function enqueue_scripts() {
9089
wp_localize_script( 'sweetalert2', 'ajax_object', array( 'ajax_url' => admin_url( 'admin-ajax.php' ) ) );
9190
wp_enqueue_script( 'sweetalert2' );
9291
}
93-
9492
}
9593

9694

@@ -183,5 +181,4 @@ public function shifter_admin_bar() {
183181
)
184182
);
185183
}
186-
187184
}

includes/class-shifter-activator.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,5 @@ class Shifter_Activator {
3232
* @since 1.0.0
3333
*/
3434
public static function activate() {
35-
3635
}
37-
3836
}

includes/class-shifter-deactivator.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,5 @@ class Shifter_Deactivator {
3232
* @since 1.0.0
3333
*/
3434
public static function deactivate() {
35-
3635
}
37-
3836
}

includes/class-shifter-i18n.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,5 @@ public function load_plugin_textdomain() {
4141
false,
4242
dirname( dirname( plugin_basename( __FILE__ ) ) ) . '/languages/'
4343
);
44-
4544
}
46-
47-
48-
4945
}

includes/class-shifter-loader.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ public function __construct() {
5252

5353
$this->actions = array();
5454
$this->filters = array();
55-
5655
}
5756

5857
/**
@@ -108,7 +107,6 @@ private function add( $hooks, $hook, $component, $callback, $priority, $accepted
108107
);
109108

110109
return $hooks;
111-
112110
}
113111

114112
/**
@@ -125,7 +123,5 @@ public function run() {
125123
foreach ( $this->actions as $hook ) {
126124
add_action( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] );
127125
}
128-
129126
}
130-
131127
}

0 commit comments

Comments
 (0)