Skip to content

Commit 47da4d6

Browse files
dev: fix errors
1 parent c427921 commit 47da4d6

30 files changed

+506
-400
lines changed

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

@@ -1324,8 +1338,21 @@ public function rop_linkedin_api_v2_notice() {
13241338

13251339
?>
13261340
<div class="notice notice-error">
1327-
<?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>' ); ?>
1328-
1341+
<?php
1342+
echo wp_kses_post(
1343+
sprintf(
1344+
// 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.
1345+
__( '%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' ),
1346+
'<p>',
1347+
'<b>',
1348+
'</b>',
1349+
'<a href="' . esc_url( 'https://docs.revive.social/article/1040-how-to-move-to-linkedin-api-v2' ) . '" target="_blank">',
1350+
'</a>',
1351+
'<a style="float: right;" href="' . esc_url( add_query_arg( 'rop-linkedin-api-notice-dismissed', '1' ) ) . '">Dismiss</a>',
1352+
'</p>'
1353+
)
1354+
);
1355+
?>
13291356
</div>
13301357
<?php
13311358
}
@@ -1386,28 +1413,27 @@ public function rop_wp_cron_notice() {
13861413

13871414
?>
13881415
<div class="notice notice-error">
1389-
<?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>' ); ?>
1390-
1416+
<?php
1417+
echo wp_kses_post(
1418+
sprintf(
1419+
// 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.
1420+
__( '%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' ),
1421+
'<p>',
1422+
'<b>',
1423+
'</b>',
1424+
'<a href="' . esc_url( 'https://docs.revive.social/article/686-fix-revive-old-post-not-posting' ) . '" target="_blank">',
1425+
'</a>',
1426+
'<a style="float: right;" href="' . esc_url( add_query_arg( 'rop-wp-cron-notice-dismissed', '1' ) ) . '">Dismiss</a>',
1427+
'</p>'
1428+
)
1429+
);
1430+
?>
13911431
</div>
13921432
<?php
13931433

13941434
}
13951435
}
13961436

1397-
/**
1398-
* Dismiss WordPress Cron disabled notice.
1399-
*
1400-
* @since 8.2.5
1401-
* @access public
1402-
*/
1403-
public function rop_dismiss_cron_disabled_notice() {
1404-
1405-
$user_id = get_current_user_id();
1406-
if ( isset( $_GET['rop-wp-cron-notice-dismissed'] ) ) {
1407-
add_user_meta( $user_id, 'rop-wp-cron-notice-dismissed', 'true', true );
1408-
}
1409-
}
1410-
14111437
/**
14121438
* Migrate the taxonomies from General Settings to Post Format for Pro users.
14131439
*
@@ -1486,7 +1512,7 @@ public function migrate_taxonomies_to_post_format() {
14861512

14871513
if ( true === $update_took_place ) {
14881514
// Create the option so that the migrate code will not run again.
1489-
add_option( 'rop_data_migrated_tax', 'yes', null, 'no' );
1515+
add_option( 'rop_data_migrated_tax', 'yes', '', 'no' );
14901516
// Update the plugin data containing the changes.
14911517
update_option( 'rop_data', $option );
14921518
}
@@ -1530,8 +1556,21 @@ public function rop_cron_event_status_notice() {
15301556

15311557
?>
15321558
<div class="notice notice-error">
1533-
<?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>' ); ?>
1534-
1559+
<?php
1560+
echo wp_kses_post(
1561+
sprintf(
1562+
// 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.
1563+
__( '%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' ),
1564+
'<p>',
1565+
'<b>',
1566+
'</b>',
1567+
'<a href="' . esc_url( 'https://docs.revive.social/article/686-fix-revive-old-post-not-posting' ) . '" target="_blank">',
1568+
'</a>',
1569+
'<a style="float: right;" href="' . esc_url( add_query_arg( 'rop-cron-event-status-notice-dismissed', '1' ) ) . '">Dismiss</a>',
1570+
'</p>'
1571+
)
1572+
);
1573+
?>
15351574
</div>
15361575
<?php
15371576

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

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

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

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

837837
return $created_at > $compare_to;

0 commit comments

Comments
 (0)