Skip to content

Commit 40a6403

Browse files
dev: formatting
1 parent 429e066 commit 40a6403

60 files changed

Lines changed: 696 additions & 759 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

class-rop-autoloader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ public static function loader( $class_name ) {
119119
$filename = 'class-' . str_replace( '_', '-', strtolower( $class_name ) ) . static::$file_ext;
120120
foreach ( static::$file_iterator as $file ) {
121121
if ( strtolower( $file->getFileName() ) === strtolower( $filename ) && is_readable( $file->getPathName() ) ) {
122-
require( $file->getPathName() );
122+
require $file->getPathName();
123123
return true;
124124
}
125125
}

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
"build": "sh bin/dist.sh",
2424
"test": "vendor/bin/phpunit",
2525
"lint": "vendor/bin/phpcs --standard=phpcs.xml --extensions=php -s",
26+
"lint:errors": "phpcs --standard=phpcs.xml -n",
2627
"format": "vendor/bin/phpcbf --standard=phpcs.xml --report-summary --report-source",
2728
"phpstan": "phpstan",
2829
"phpstan:generate:baseline": "phpstan --generate-baseline"

cron-system/class-rop-cron-core.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ function __construct() {
5353
* Register local end-points used by ROP Cron Service.
5454
*/
5555
add_action( 'init', array( &$this, 'init_endpoint_items' ) );
56-
5756
}
5857

5958
/**
@@ -153,7 +152,5 @@ public function server_register_client() {
153152
'request_path' => ':register_account:',
154153
);
155154
$call_response = $request_call->create_call_process( $arguments );
156-
157155
}
158-
159156
}

cron-system/includes/class-debug-page.php

Lines changed: 30 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
namespace RopCronSystem\Pages;
55

6-
76
use RopCronSystem\Curl_Helpers\Rop_Curl_Methods;
87
use RopCronSystem\ROP_Helpers\Rop_Helpers;
98

@@ -163,12 +162,12 @@ public function rop_service_debug() {
163162
}
164163

165164
?>
166-
<div class="wrap" id="rop-debug-table">
165+
<div class="wrap" id="rop-debug-table">
167166
<h1><?php _e( 'Debug Info: ', 'tweet-old-post' ); ?></h1>
168167
<br/>
169168

170169
<table>
171-
<tr>
170+
<tr>
172171
<td valign="top"><?php _e( 'PHP Version: ', 'tweet-old-post' ); ?></td>
173172
<td>
174173
<?php
@@ -179,10 +178,10 @@ public function rop_service_debug() {
179178
}
180179

181180
?>
182-
<br/>
181+
<br/>
183182
</td>
184-
</tr>
185-
<tr>
183+
</tr>
184+
<tr>
186185
<td valign="top"><?php _e( 'cURL Info: ', 'tweet-old-post' ); ?></td>
187186
<td>
188187
<?php
@@ -199,69 +198,69 @@ public function rop_service_debug() {
199198
echo '<strong style="color:darkred">' . __( 'No version of CURL detected.', 'tweet-old-post' ) . '</strong>';
200199
}
201200
?>
202-
<br/>
201+
<br/>
203202
</td>
204-
</tr>
205-
<tr>
203+
</tr>
204+
<tr>
206205
<td valign="top"><?php _e( 'Check connection with<br/>Revive Social Cron SyStem: ', 'tweet-old-post' ); ?></td>
207206
<td>
208207
<?php _e( 'WordPress -> Server:', 'tweet-old-post' ); ?>
209-
<span id="server_responded">N/A</span>
210-
<br/>
208+
<span id="server_responded">N/A</span>
209+
<br/>
211210
<?php _e( 'Server -> WordPress:', 'tweet-old-post' ); ?>
212-
<span id="website_responded">N/A</span>
213-
<br/>
214-
<br/>
215-
<input type="button" value="<?php _e( 'Check connection', 'tweet-old-post' ); ?>" id="rop_conection_check"/>
211+
<span id="website_responded">N/A</span>
212+
<br/>
213+
<br/>
214+
<input type="button" value="<?php _e( 'Check connection', 'tweet-old-post' ); ?>" id="rop_conection_check"/>
216215
</td>
217-
</tr>
216+
</tr>
218217
</table>
219218

220219
<br/>
221220
<hr/>
222221
<br/>
223222

224223
<table>
225-
<tr>
224+
<tr>
226225
<td>
227-
<input type="button" value="<?php _e( 'Delete Remote Cron Service Data', 'tweet-old-post' ); ?>" id="rop_remove_account"/>
228-
<span id="ajax_rop_remove_account">
226+
<input type="button" value="<?php _e( 'Delete Remote Cron Service Data', 'tweet-old-post' ); ?>" id="rop_remove_account"/>
227+
<span id="ajax_rop_remove_account">
229228

230-
</span>
229+
</span>
231230

232-
<p>
231+
<p>
233232
<em>
234233
<?php
235234
$labels = new \Rop_I18n();
236235
echo $labels::get_labels( 'cron_system.delete_cron_service_account_info' );
237236
?>
238237
</em>
239-
</p>
238+
</p>
240239
</td>
241-
</tr>
240+
</tr>
242241
</table>
243242

244243
<table>
245-
<tr>
244+
<tr>
246245
<td>
247-
<input type="button" value="<?php _e( 'Clear Local Cron Data', 'tweet-old-post' ); ?>" id="rop_clear_local"/>
248-
<span id="ajax_rop_clear_local">
246+
<input type="button" value="<?php _e( 'Clear Local Cron Data', 'tweet-old-post' ); ?>" id="rop_clear_local"/>
247+
<span id="ajax_rop_clear_local">
249248

250-
</span>
249+
</span>
251250

252-
<p>
251+
<p>
253252
<em>
254253
<?php
255254
echo $labels::get_labels( 'cron_system.clear_local_cron_info' );
256255
?>
257256
</em>
258-
</p>
257+
</p>
259258
</td>
260-
</tr>
259+
</tr>
261260
</table>
262261

263262

264-
</div>
263+
</div>
265264
<?php
266265
}
267266
}

cron-system/includes/class-rop-curl-methods.php

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -126,35 +126,32 @@ public function create_call_process( $args = array() ) {
126126
$this->server_url = self::SERVER_URL . $this->server_paths[ $args['request_path'] ];
127127
$this->connection = curl_init( $this->server_url );
128128
$this->register_to_top_server();
129-
} else {
129+
} elseif ( empty( $token ) && ':delete_account:' !== $args['request_path'] ) {
130130

131-
if ( empty( $token ) && ':delete_account:' !== $args['request_path'] ) {
132131
$this->server_url = self::SERVER_URL . $this->server_paths[':register_account:'];
133132
$this->connection = curl_init( $this->server_url );
134133

135134
// If the request comes with "Stop cron" action, there's no need for it in account registration.
136-
if ( ':disable_account:' === $args['request_path'] ) {
137-
$args = array();
138-
}
135+
if ( ':disable_account:' === $args['request_path'] ) {
136+
$args = array();
137+
}
139138

140139
$this->register_to_top_server( $args );
141-
} else {
142-
143-
$this->server_url = self::SERVER_URL . $this->server_paths[ $args['request_path'] ];
144-
$this->connection = curl_init( $this->server_url );
140+
} else {
145141

146-
if ( isset( $args['time_to_share'] ) && ! empty( $args['time_to_share'] ) ) {
147-
$post_fields = array( 'next_ping' => $args['time_to_share'] );
142+
$this->server_url = self::SERVER_URL . $this->server_paths[ $args['request_path'] ];
143+
$this->connection = curl_init( $this->server_url );
148144

149-
}
145+
if ( isset( $args['time_to_share'] ) && ! empty( $args['time_to_share'] ) ) {
146+
$post_fields = array( 'next_ping' => $args['time_to_share'] );
150147

151-
return $this->request_type_post( $post_fields, $args['request_path'] );
152148
}
149+
150+
return $this->request_type_post( $post_fields, $args['request_path'] );
153151
}
154152
}
155153

156154
return true;
157-
158155
}
159156

160157

@@ -404,7 +401,6 @@ private function register_to_top_server( $callback_param = array() ) {
404401

405402
return false;
406403
}
407-
408404
}
409405

410406
/**
@@ -447,7 +443,6 @@ private function fetch_attach_auth_token( $custom_value = '', $post_data = '' )
447443

448444
return false;
449445
}
450-
451446
}
452447

453448

@@ -482,7 +477,6 @@ private function create_register_data() {
482477
$url_encode_data = http_build_query( $account_data );
483478

484479
return base64_encode( $url_encode_data );
485-
486480
}
487481

488482
/**

cron-system/includes/class-rop-helpers.php

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace RopCronSystem\ROP_Helpers;
44

5-
65
use Rop_Exception_Handler;
76
use Rop_Logger;
87
use Rop_Scheduler_Model;
@@ -31,7 +30,7 @@ class Rop_Helpers {
3130
* @static
3231
* @since 8.5.5
3332
*/
34-
static public function extract_time_to_share() {
33+
public static function extract_time_to_share() {
3534
// dates are stored into variable "rop_schedules_data".
3635
$scheduler = new Rop_Scheduler_Model();
3736

@@ -82,7 +81,7 @@ static public function extract_time_to_share() {
8281
* @static
8382
* @since 8.5.5
8483
*/
85-
static public function local_timezone() {
84+
public static function local_timezone() {
8685

8786
// WordPress saves timezone in 2 different variables.
8887
// If it's UTC the option name is "".
@@ -107,7 +106,7 @@ static public function local_timezone() {
107106
* @access public
108107
* @static
109108
*/
110-
static public function apache_request_headers() {
109+
public static function apache_request_headers() {
111110
$headers_output = array();
112111
$headers_output_return = array();
113112
if ( ! function_exists( 'apache_request_headers' ) ) {
@@ -140,7 +139,7 @@ static public function apache_request_headers() {
140139
*
141140
* @return false|string
142141
*/
143-
static public function openssl_random_pseudo_bytes( $count = 40 ) {
142+
public static function openssl_random_pseudo_bytes( $count = 40 ) {
144143
if ( function_exists( 'openssl_random_pseudo_bytes' ) ) {
145144
return openssl_random_pseudo_bytes( $count );
146145
} else {
@@ -169,7 +168,7 @@ static public function openssl_random_pseudo_bytes( $count = 40 ) {
169168
*
170169
* @return bool|string
171170
*/
172-
static public function custom_curl_post_request( $url = '', $post_arguments = array() ) {
171+
public static function custom_curl_post_request( $url = '', $post_arguments = array() ) {
173172

174173
$logger = new Rop_Logger();
175174

@@ -284,5 +283,3 @@ static public function custom_curl_post_request( $url = '', $post_arguments = ar
284283
return $server_response_body;
285284
}
286285
}
287-
288-

cron-system/rest-endpoints/class-rop-debug-ping.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,5 +135,4 @@ public function catch_authorization_data_permissions() {
135135
public function init_rest_api_route() {
136136
add_action( 'rest_api_init', array( &$this, 'register_routes' ) );
137137
}
138-
139138
}

cron-system/rest-endpoints/class-rop-registration-check.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,5 +141,4 @@ public function catch_authorization_data_permissions() {
141141
public function init_rest_api_route() {
142142
add_action( 'rest_api_init', array( &$this, 'register_routes' ) );
143143
}
144-
145144
}

includes/admin/abstract/class-rop-model-abstract.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ protected function set( $key, $value = '', $refresh = false ) {
8787
}
8888

8989
if ( $refresh ) {
90-
$this->data = get_option( 'rop_data' );
90+
$this->data = get_option( 'rop_data' );
9191
}
9292

9393
$this->data[ $key ] = apply_filters( 'rop_set_key_' . $key, $value );
@@ -132,5 +132,4 @@ protected function handle_underscore_exception( $index, $is_treat_any = false )
132132

133133
return $return_correct_format;
134134
}
135-
136135
}

0 commit comments

Comments
 (0)