Skip to content

Commit 45640d4

Browse files
dev: fix errors
1 parent 40a6403 commit 45640d4

30 files changed

Lines changed: 506 additions & 400 deletions

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class Rop_Cron_Core {
3131
/**
3232
* Rop_Cron_Core constructor.
3333
*/
34-
function __construct() {
34+
public function __construct() {
3535

3636
/**
3737
* Register to ROP Cron the share start.

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

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class Debug_Page {
2626
*
2727
* Debug_Page constructor.
2828
*/
29-
function __construct() {
29+
public function __construct() {
3030
add_action( 'admin_menu', array( &$this, 'debug_page_menu' ) );
3131

3232
add_action( 'admin_enqueue_scripts', array( &$this, 'load_custom_wp_admin_style' ) );
@@ -163,55 +163,55 @@ public function rop_service_debug() {
163163

164164
?>
165165
<div class="wrap" id="rop-debug-table">
166-
<h1><?php _e( 'Debug Info: ', 'tweet-old-post' ); ?></h1>
166+
<h1><?php esc_html_e( 'Debug Info: ', 'tweet-old-post' ); ?></h1>
167167
<br/>
168168

169169
<table>
170170
<tr>
171-
<td valign="top"><?php _e( 'PHP Version: ', 'tweet-old-post' ); ?></td>
171+
<td valign="top"><?php esc_html_e( 'PHP Version: ', 'tweet-old-post' ); ?></td>
172172
<td>
173173
<?php
174-
echo $version;
174+
echo esc_html( $version );
175175

176176
if ( version_compare( $version, '7.0.0', '<' ) ) {
177-
echo ' <strong style="color:darkred">' . __( 'PHP 7 is recommended', 'tweet-old-post' ) . '</strong>';
177+
echo ' <strong style="color:darkred">' . esc_html__( 'PHP 7 is recommended', 'tweet-old-post' ) . '</strong>';
178178
}
179179

180180
?>
181181
<br/>
182182
</td>
183183
</tr>
184184
<tr>
185-
<td valign="top"><?php _e( 'cURL Info: ', 'tweet-old-post' ); ?></td>
185+
<td valign="top"><?php esc_html_e( 'cURL Info: ', 'tweet-old-post' ); ?></td>
186186
<td>
187187
<?php
188188
if ( ! empty( $curl_version ) ) {
189-
echo 'version: ' . $curl_version['version'] . ' (' . $curl_version['version_number'] . ') ' . '<br/>';
190-
echo 'libz version: ' . $curl_version['libz_version'] . '<br/>';
191-
echo 'OpenSSL: ' . $curl_version['ssl_version'] . '<br/>';
189+
echo 'version: ' . esc_html( $curl_version['version'] ) . ' (' . esc_html( $curl_version['version_number'] ) . ')<br/>';
190+
echo 'libz version: ' . esc_html( $curl_version['libz_version'] ) . '<br/>';
191+
echo 'OpenSSL: ' . esc_html( $curl_version['ssl_version'] ) . '<br/>';
192192
echo '<strong>Protocols</strong>: <br/>'; // . implode( ',', $curl_version['protocols'] ) . '<br/>';
193193

194194
echo 'HTTP: ' . ( ( in_array( 'http', $curl_version['protocols'] ) ) ? '<span style="color:darkgreen">&#10004;</span>' : '<span style="color:darkred">&#10006;</span>' ) . '<br/>';
195195
echo 'HTTPS: ' . ( ( in_array( 'https', $curl_version['protocols'] ) ) ? '<span style="color:darkgreen">&#10004;</span>' : '<span style="color:darkred">&#10006;</span>' ) . '<br/>';
196196

197197
} else {
198-
echo '<strong style="color:darkred">' . __( 'No version of CURL detected.', 'tweet-old-post' ) . '</strong>';
198+
echo '<strong style="color:darkred">' . esc_html__( 'No version of CURL detected.', 'tweet-old-post' ) . '</strong>';
199199
}
200200
?>
201201
<br/>
202202
</td>
203203
</tr>
204204
<tr>
205-
<td valign="top"><?php _e( 'Check connection with<br/>Revive Social Cron SyStem: ', 'tweet-old-post' ); ?></td>
205+
<td valign="top"><?php esc_html_e( 'Check connection with<br/>Revive Social Cron SyStem: ', 'tweet-old-post' ); ?></td>
206206
<td>
207-
<?php _e( 'WordPress -> Server:', 'tweet-old-post' ); ?>
207+
<?php esc_html_e( 'WordPress -> Server:', 'tweet-old-post' ); ?>
208208
<span id="server_responded">N/A</span>
209209
<br/>
210-
<?php _e( 'Server -> WordPress:', 'tweet-old-post' ); ?>
210+
<?php esc_html_e( 'Server -> WordPress:', 'tweet-old-post' ); ?>
211211
<span id="website_responded">N/A</span>
212212
<br/>
213213
<br/>
214-
<input type="button" value="<?php _e( 'Check connection', 'tweet-old-post' ); ?>" id="rop_conection_check"/>
214+
<input type="button" value="<?php esc_attr_e( 'Check connection', 'tweet-old-post' ); ?>" id="rop_conection_check"/>
215215
</td>
216216
</tr>
217217
</table>
@@ -223,7 +223,7 @@ public function rop_service_debug() {
223223
<table>
224224
<tr>
225225
<td>
226-
<input type="button" value="<?php _e( 'Delete Remote Cron Service Data', 'tweet-old-post' ); ?>" id="rop_remove_account"/>
226+
<input type="button" value="<?php esc_attr_e( 'Delete Remote Cron Service Data', 'tweet-old-post' ); ?>" id="rop_remove_account"/>
227227
<span id="ajax_rop_remove_account">
228228

229229
</span>
@@ -232,7 +232,7 @@ public function rop_service_debug() {
232232
<em>
233233
<?php
234234
$labels = new \Rop_I18n();
235-
echo $labels::get_labels( 'cron_system.delete_cron_service_account_info' );
235+
echo esc_html( $labels::get_labels( 'cron_system.delete_cron_service_account_info' ) );
236236
?>
237237
</em>
238238
</p>
@@ -243,15 +243,15 @@ public function rop_service_debug() {
243243
<table>
244244
<tr>
245245
<td>
246-
<input type="button" value="<?php _e( 'Clear Local Cron Data', 'tweet-old-post' ); ?>" id="rop_clear_local"/>
246+
<input type="button" value="<?php esc_attr_e( 'Clear Local Cron Data', 'tweet-old-post' ); ?>" id="rop_clear_local"/>
247247
<span id="ajax_rop_clear_local">
248248

249249
</span>
250250

251251
<p>
252252
<em>
253253
<?php
254-
echo $labels::get_labels( 'cron_system.clear_local_cron_info' );
254+
echo esc_html( $labels::get_labels( 'cron_system.clear_local_cron_info' ) );
255255
?>
256256
</em>
257257
</p>

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

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ class Rop_Curl_Methods {
8181
*
8282
* Rop_Curl_Methods constructor.
8383
*/
84-
function __construct() {
84+
public function __construct() {
8585
$this->error = new Rop_Exception_Handler();
8686
$this->logger = new Rop_Logger();
8787
}
@@ -115,9 +115,10 @@ public function create_call_process( $args = array() ) {
115115

116116
if ( 'post' === strtolower( $args['type'] ) ) {
117117

118-
if ( ':delete_account:' !== $args['request_path'] ) {
119-
// unset( $args['remove_location'] );
120-
}
118+
// if ( ':delete_account:' !== $args['request_path'] ) {
119+
// This condition is intentionally left for future use
120+
// when we might need to handle specific request paths differently
121+
// }
121122

122123
$post_fields = array();
123124

@@ -484,7 +485,7 @@ private function create_register_data() {
484485
*
485486
* @since 8.5.5
486487
*/
487-
function __destruct() {
488+
public function __destruct() {
488489
unset( $this->connection );
489490
}
490491
}

cron-system/rest-endpoints/class-rop-system-base.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class Rop_System_Base extends WP_REST_Controller {
4141
*
4242
* Rop_System_Base constructor.
4343
*/
44-
function __construct() {
44+
public function __construct() {
4545
$this->error = new Rop_Exception_Handler();
4646
$this->logger = new Rop_Logger();
4747
}

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ abstract class Rop_Services_Abstract {
110110
public function __construct() {
111111
$this->error = new Rop_Exception_Handler();
112112
$this->logger = new Rop_Logger();
113-
$this->user_default['created'] = date( 'd/m/Y H:i' );
113+
$this->user_default['created'] = gmdate( 'd/m/Y H:i' );
114114
$this->user_default['service'] = $this->service_name;
115115
$this->init();
116116
}
@@ -201,7 +201,8 @@ public function authorize() {
201201
$this->error->throw_exception( 'Error', sprintf( 'The service "' . $this->display_name . '" can not be authorized %s', $exception->getMessage() ) );
202202
}
203203

204-
exit( wp_redirect( admin_url( 'admin.php?page=TweetOldPost' ) ) );
204+
wp_redirect( admin_url( 'admin.php?page=TweetOldPost' ) );
205+
exit;
205206
}
206207

207208
/**

includes/admin/class-rop-admin.php

Lines changed: 76 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public function display_global_status_warning() {
8888
<div id="rop-status-error" class="notice notice-error is-dismissible">
8989
<p>
9090
<strong><?php echo esc_html( Rop_I18n::get_labels( 'general.plugin_name' ) ); ?></strong>:
91-
<?php echo Rop_I18n::get_labels( 'general.status_error_global' ); ?>
91+
<?php echo wp_kses_post( Rop_I18n::get_labels( 'general.status_error_global' ) ); ?>
9292
</p>
9393
</div>
9494
<?php
@@ -168,7 +168,20 @@ public function bitly_shortener_upgrade_notice() {
168168
}
169169
?>
170170
<div class="notice notice-error is-dismissible">
171-
<?php printf( __( '%1$s%2$sRevive Social:%3$s Please upgrade your Bit.ly keys. See this %4$sarticle for instructions.%5$s%6$s', 'tweet-old-post' ), '<p>', '<b>', '</b>', '<a href="https://docs.revive.social/article/976-how-to-connect-bit-ly-to-revive-old-posts" target="_blank">', '</a>', '</p>' ); ?>
171+
<?php
172+
echo wp_kses_post(
173+
sprintf(
174+
// translators: 1: <p> tag, 2: <b> tag, 3: </b> tag, 4: <a> tag with URL to docs, 5: </a> tag, 6: </p> tag.
175+
__( '%1$s%2$sRevive Social:%3$s Please upgrade your Bit.ly keys. See this %4$sarticle for instructions.%5$s%6$s', 'tweet-old-post' ),
176+
'<p>',
177+
'<b>',
178+
'</b>',
179+
'<a href="' . esc_url( 'https://docs.revive.social/article/976-how-to-connect-bit-ly-to-revive-old-posts' ) . '" target="_blank">',
180+
'</a>',
181+
'</p>'
182+
)
183+
);
184+
?>
172185
</div>
173186
<?php
174187
}
@@ -702,14 +715,17 @@ function () {
702715
}
703716
);
704717

705-
global $submenu;
706-
if ( isset( $submenu['TweetOldPost'] ) ) {
707-
$submenu['TweetOldPost'][2] = array(
708-
$rss_to_social,
709-
'manage_options',
710-
tsdk_utmify( self::RN_LINK, 'admin', 'admin_menu' ),
711-
);
712-
}
718+
add_submenu_page(
719+
'TweetOldPost',
720+
__( 'RSS to Social', 'tweet-old-post' ),
721+
$rss_to_social,
722+
'manage_options',
723+
'rop_rss_to_social',
724+
function () {
725+
wp_redirect( esc_url_raw( tsdk_utmify( self::RN_LINK, 'admin', 'admin_menu' ) ) );
726+
exit;
727+
}
728+
);
713729
}
714730
}
715731

@@ -731,12 +747,10 @@ public function publish_now_upsell() {
731747
$active_accounts = $services->get_active_accounts();
732748

733749
if ( $settings->get_instant_sharing() && count( $active_accounts ) >= 2 && ! defined( 'ROP_PRO_VERSION' ) ) {
734-
echo '<div class="misc-pub-section " style="font-size: 11px;text-align: center;line-height: 1.7em;color: #888;"><span class="dashicons dashicons-lock"></span>' .
735-
__(
736-
'Share to more accounts by upgrading to the extended version for ',
737-
'tweet-old-post'
738-
) . '<a href="' . tsdk_utmify( Rop_I18n::UPSELL_LINK, 'editor', 'publish_now' ) . '" target="_blank">Revive Social </a>
739-
</div>';
750+
echo '<div class="misc-pub-section " style="font-size: 11px;text-align: center;line-height: 1.7em;color: #888;"><span class="dashicons dashicons-lock"></span>'
751+
. esc_html__( 'Share to more accounts by upgrading to the extended version for ', 'tweet-old-post' )
752+
. '<a href="' . esc_url( tsdk_utmify( Rop_I18n::UPSELL_LINK, 'editor', 'publish_now' ) ) . '" target="_blank">' . esc_html( 'Revive Social' ) . '</a>'
753+
. '</div>';
740754
}
741755
}
742756

@@ -1331,8 +1345,21 @@ public function rop_linkedin_api_v2_notice() {
13311345

13321346
?>
13331347
<div class="notice notice-error">
1334-
<?php printf( __( '%1$s%2$sRevive Social:%3$s The Linkedin API Has been updated. You need to reconnect your LinkedIn account to continue posting to LinkedIn. Please see %4$sthis article for instructions.%5$s%6$s%7$s', 'tweet-old-post' ), '<p>', '<b>', '</b>', '<a href="https://docs.revive.social/article/1040-how-to-move-to-linkedin-api-v2" target="_blank">', '</a>', '<a style="float: right;" href="?rop-linkedin-api-notice-dismissed">Dismiss</a>', '</p>' ); ?>
1335-
1348+
<?php
1349+
echo wp_kses_post(
1350+
sprintf(
1351+
// translators: 1: <p> tag, 2: <b> tag, 3: </b> tag, 4: <a> tag with URL to docs, 5: </a> tag, 6: Dismiss link, 7: </p> tag.
1352+
__( '%1$s%2$sRevive Social:%3$s The Linkedin API Has been updated. You need to reconnect your LinkedIn account to continue posting to LinkedIn. Please see %4$sthis article for instructions.%5$s%6$s%7$s', 'tweet-old-post' ),
1353+
'<p>',
1354+
'<b>',
1355+
'</b>',
1356+
'<a href="' . esc_url( 'https://docs.revive.social/article/1040-how-to-move-to-linkedin-api-v2' ) . '" target="_blank">',
1357+
'</a>',
1358+
'<a style="float: right;" href="' . esc_url( add_query_arg( 'rop-linkedin-api-notice-dismissed', '1' ) ) . '">Dismiss</a>',
1359+
'</p>'
1360+
)
1361+
);
1362+
?>
13361363
</div>
13371364
<?php
13381365
}
@@ -1393,28 +1420,27 @@ public function rop_wp_cron_notice() {
13931420

13941421
?>
13951422
<div class="notice notice-error">
1396-
<?php printf( __( '%1$s%2$sRevive Social:%3$s The WordPress Cron seems is disabled on your website. This can cause sharing issues with Revive Social. If sharing is not working, then see %4$shere for solutions.%5$s%6$s%7$s', 'tweet-old-post' ), '<p>', '<b>', '</b>', '<a href="https://docs.revive.social/article/686-fix-revive-old-post-not-posting" target="_blank">', '</a>', '<a style="float: right;" href="?rop-wp-cron-notice-dismissed">Dismiss</a>', '</p>' ); ?>
1397-
1423+
<?php
1424+
echo wp_kses_post(
1425+
sprintf(
1426+
// translators: 1: <p> tag, 2: <b> tag, 3: </b> tag, 4: <a> tag with URL to docs, 5: </a> tag, 6: Dismiss link, 7: </p> tag.
1427+
__( '%1$s%2$sRevive Social:%3$s The WordPress Cron seems is disabled on your website. This can cause sharing issues with Revive Social. If sharing is not working, then see %4$shere for solutions.%5$s%6$s%7$s', 'tweet-old-post' ),
1428+
'<p>',
1429+
'<b>',
1430+
'</b>',
1431+
'<a href="' . esc_url( 'https://docs.revive.social/article/686-fix-revive-old-post-not-posting' ) . '" target="_blank">',
1432+
'</a>',
1433+
'<a style="float: right;" href="' . esc_url( add_query_arg( 'rop-wp-cron-notice-dismissed', '1' ) ) . '">Dismiss</a>',
1434+
'</p>'
1435+
)
1436+
);
1437+
?>
13981438
</div>
13991439
<?php
14001440

14011441
}
14021442
}
14031443

1404-
/**
1405-
* Dismiss WordPress Cron disabled notice.
1406-
*
1407-
* @since 8.2.5
1408-
* @access public
1409-
*/
1410-
public function rop_dismiss_cron_disabled_notice() {
1411-
1412-
$user_id = get_current_user_id();
1413-
if ( isset( $_GET['rop-wp-cron-notice-dismissed'] ) ) {
1414-
add_user_meta( $user_id, 'rop-wp-cron-notice-dismissed', 'true', true );
1415-
}
1416-
}
1417-
14181444
/**
14191445
* Migrate the taxonomies from General Settings to Post Format for Pro users.
14201446
*
@@ -1493,7 +1519,7 @@ public function migrate_taxonomies_to_post_format() {
14931519

14941520
if ( true === $update_took_place ) {
14951521
// Create the option so that the migrate code will not run again.
1496-
add_option( 'rop_data_migrated_tax', 'yes', null, 'no' );
1522+
add_option( 'rop_data_migrated_tax', 'yes', '', 'no' );
14971523
// Update the plugin data containing the changes.
14981524
update_option( 'rop_data', $option );
14991525
}
@@ -1537,8 +1563,21 @@ public function rop_cron_event_status_notice() {
15371563

15381564
?>
15391565
<div class="notice notice-error">
1540-
<?php printf( __( '%1$s%2$sRevive Social:%3$s There might be an issue preventing Revive Social from sharing to your connected accounts. If sharing is not working, then see %4$shere for solutions.%5$s%6$s%7$s', 'tweet-old-post' ), '<p>', '<b>', '</b>', '<a href="https://docs.revive.social/article/686-fix-revive-old-post-not-posting" target="_blank">', '</a>', '<a style="float: right;" href="?rop-cron-event-status-notice-dismissed">Dismiss</a>', '</p>' ); ?>
1541-
1566+
<?php
1567+
echo wp_kses_post(
1568+
sprintf(
1569+
// translators: 1: <p> tag, 2: <b> tag, 3: </b> tag, 4: <a> tag with URL to docs, 5: </a> tag, 6: Dismiss link, 7: </p> tag.
1570+
__( '%1$s%2$sRevive Social:%3$s There might be an issue preventing Revive Social from sharing to your connected accounts. If sharing is not working, then see %4$shere for solutions.%5$s%6$s%7$s', 'tweet-old-post' ),
1571+
'<p>',
1572+
'<b>',
1573+
'</b>',
1574+
'<a href="' . esc_url( 'https://docs.revive.social/article/686-fix-revive-old-post-not-posting' ) . '" target="_blank">',
1575+
'</a>',
1576+
'<a style="float: right;" href="' . esc_url( add_query_arg( 'rop-cron-event-status-notice-dismissed', '1' ) ) . '">Dismiss</a>',
1577+
'</p>'
1578+
)
1579+
);
1580+
?>
15421581
</div>
15431582
<?php
15441583

includes/admin/class-rop-global-settings.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,7 @@ public function get_license_data_view() {
597597
}
598598

599599
if ( isset( $license_data->expires ) ) {
600-
$view_license_data['expires'] = date( 'F j, Y', strtotime( $license_data->expires ) );
600+
$view_license_data['expires'] = gmdate( 'F j, Y', strtotime( $license_data->expires ) );
601601
if ( 'valid' === $view_license_data['license'] ) {
602602
$view_license_data['expires'] = sprintf( Rop_I18n::get_labels( 'general.expires' ), $view_license_data['expires'] );
603603
} else {
@@ -832,7 +832,7 @@ public function check_is_new_license() {
832832
}
833833

834834
// Is after 9.1?
835-
$created_at = strtotime( date( 'Y-m-d', strtotime( $license_data->created_at ) ) );
835+
$created_at = strtotime( gmdate( 'Y-m-d', strtotime( $license_data->created_at ) ) );
836836
$compare_to = strtotime( '2024-07-21' );
837837

838838
return $created_at > $compare_to;

0 commit comments

Comments
 (0)