Skip to content
Merged

Release #1173

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion assets/js/build/dashboard.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/js/build/exclude.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/js/build/publish_now.js

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 15 additions & 15 deletions includes/admin/abstract/class-rop-services-abstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -539,69 +539,69 @@ protected function rop_get_error_docs( $response ) {
// Facebook errors
'Only owners of the URL have the ability' => array(
'message' => __( 'You need to verify your website with Facebook before sharing posts as article posts.', 'tweet-old-post' ),
'link' => 'https://is.gd/fix_owners_url',
'link' => Rop_I18n::docs_url( 'faqs/fix-error-100-only-owners-of-the-url-have-the-ability-to-specify-the-picture-name-thumbnail-or-description-params', 'facebook-url-owners', 'sharing-logs' ),
),
'manage_pages and publish_pages as an admin' => array(
'message' => __( 'You need to put your Facebook app through review.', 'tweet-old-post' ),
'link' => 'https://is.gd/fix_manage_pages_error',
'link' => Rop_I18n::docs_url( 'general-guides/fix-error-200-requires-managepages-and-publishpages', 'facebook-app-review', 'sharing-logs' ),
),
'The session has been invalidated because the user changed their password' => array(
'message' => __( 'You need to reconnect your Facebook account.', 'tweet-old-post' ),
'link' => 'https://is.gd/fix_fb_invalid_session',
'link' => Rop_I18n::docs_url( 'general-guides/fix-facebook-invalidated-session-error-in-revive-old-posts', 'facebook-invalid-session', 'sharing-logs' ),
),
'Invalid parameter' => array(
'message' => 'There might be an issue with link creations on your website.',
'link' => 'https://is.gd/fix_link_issue',
'link' => Rop_I18n::docs_url( 'general-guides/fix-invalid-parameter-linkedin-submitted-url-cannot-be-empty-tweets-with-no-link', 'link-issue', 'sharing-logs' ),
),
'The \'manage_pages\' permission must be granted before impersonating' => array(
'message' => 'You might need to reconnect your Facebook account.',
'link' => 'https://is.gd/fix_pages_group_permissions',
'link' => Rop_I18n::docs_url( 'general-guides/fix-the-managepages-permission-must-be-granted-before-impersonating-a-users-page', 'facebook-permissions', 'sharing-logs' ),
),
'If posting to a group, requires app being installed in the group' => array(
'message' => 'If posting to a page, then you might have to reconnect your Facebook account. If posting to a group then you need to install the Revive Social App on the group.',
'link' => 'https://is.gd/fix_pages_group_permissions',
'link' => Rop_I18n::docs_url( 'general-guides/fix-the-managepages-permission-must-be-granted-before-impersonating-a-users-page', 'facebook-permissions', 'sharing-logs' ),
),

// Twitter errors
'Desktop applications only support the oauth_callback value' => array(
'message' => 'Your Callback URL for your Twitter app might not be correct.',
'link' => 'https://is.gd/fix_oauth_callback_value',
'link' => Rop_I18n::docs_url( 'general-guides/desktop-applications-only-support-the-oauthcallback-value', 'twitter-callback-url', 'sharing-logs' ),
),
'User is over daily status update limit' => array(
'message' => 'You might be over your daily limit for sending tweets or our app has hit a limit.',
'link' => 'https://is.gd/fix_over_daily_limit',
'link' => Rop_I18n::docs_url( 'faqs/fix-twitter-error-185-user-is-over-daily-status-update-limit', 'twitter-daily-limit', 'sharing-logs' ),
),
'Invalid media_id: Some' => array(
'message' => 'Our plugin might be having an issue posting tweets with an image to your account.',
'link' => 'https://is.gd/fix_invalid_media',
'link' => Rop_I18n::docs_url( 'general-guides/fix-twitter-invalid-mediaid-some', 'twitter-invalid-media', 'sharing-logs' ),
),
'Callback URL not approved for this client application' => array(
'message' => 'Your Callback URL for your Twitter app might not be correct.',
'link' => 'https://is.gd/fix_oauth_callback_value',
'link' => Rop_I18n::docs_url( 'general-guides/desktop-applications-only-support-the-oauthcallback-value', 'twitter-callback-url', 'sharing-logs' ),
),

// LinkedIn errors
''submitted-url' can not be empty' => array(
'message' => 'There might be an issue with link creations on your website.',
'link' => 'https://is.gd/fix_link_issue',
'link' => Rop_I18n::docs_url( 'general-guides/fix-invalid-parameter-linkedin-submitted-url-cannot-be-empty-tweets-with-no-link', 'link-issue', 'sharing-logs' ),
),
'[ unauthorized_scope_error ] Scope "r_organization_social"' => array(
'message' => 'You might need to reconnect your LinkedIn account.',
'link' => 'https://is.gd/linkedin_scope_error',
'link' => Rop_I18n::docs_url( 'general-guides/how-to-move-to-linkedin-api-v2', 'linkedin-scope', 'sharing-logs' ),
),
'The token used in the request has expired' => array(
'message' => 'You need to reconnect your LinkedIn account.',
'link' => 'https://is.gd/refresh_linkedin_token',
'link' => Rop_I18n::docs_url( 'general-guides/how-to-refresh-linkedin-access-token', 'linkedin-token', 'sharing-logs' ),
),
'You are using an old method of sharing to LinkedIn' => array(
'message' => 'You need to reconnect your LinkedIn account.',
'link' => 'https://is.gd/switch_linkedin_signon_method',
'link' => Rop_I18n::docs_url( 'general-guides/how-to-move-to-linkedin-api-v2', 'linkedin-sign-in-method', 'sharing-logs' ),
),

// Pinterest errors
'Pinterest error (code: 429) with message: You have exceeded your rate limit' => array(
'message' => 'You\'ve hit the Pinterest rate limit.',
'link' => 'https://is.gd/pinterest_rate_limit',
'link' => Rop_I18n::docs_url( 'getting-started/rop-troubleshooting-guide', 'pinterest-rate-limit', 'sharing-logs' ),
),

// Add more common errors as necessary
Expand Down
45 changes: 38 additions & 7 deletions includes/admin/class-rop-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ public function bitly_shortener_upgrade_notice() {
}
?>
<div class="notice notice-error is-dismissible">
<?php echo sprintf( __( '%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>' ); ?>
<?php echo sprintf( __( '%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="' . esc_url( Rop_I18n::docs_url( 'getting-started/how-to-connect-bit-ly-to-revive-old-posts', 'bitly', 'admin-notice' ) ) . '" target="_blank">', '</a>', '</p>' ); ?>
</div>
<?php
}
Expand Down Expand Up @@ -356,6 +356,7 @@ public function enqueue_scripts() {
$rop_api_settings['fb_domain_toast_display'] = $this->facebook_exception_toast_display();
$rop_api_settings['labels'] = Rop_I18n::get_labels_frontend();
$rop_api_settings['upsell_link'] = Rop_I18n::UPSELL_LINK;
$rop_api_settings['docs_link'] = esc_url_raw( Rop_I18n::docs_url( '', 'documentation', 'dashboard' ) );
$rop_api_settings['pro_installed'] = ( defined( 'ROP_PRO_VERSION' ) ) ? true : false;
$rop_api_settings['show_li_app_btn'] = $li_service->rop_show_li_app_btn();
$rop_api_settings['show_tmblr_app_btn'] = $tmblr_service->rop_show_tmblr_app_btn();
Expand Down Expand Up @@ -415,7 +416,7 @@ public function enqueue_scripts() {
}

$rop_api_settings['tracking'] = 'yes' === get_option( 'tweet_old_post_logger_flag', 'no' );
$rop_api_settings['tracking_info_link'] = sanitize_url( 'https://docs.revive.social/article/2008-revive-old-posts-usage-tracking' );
$rop_api_settings['tracking_info_link'] = esc_url_raw( Rop_I18n::docs_url( 'general-guides/revive-old-posts-usage-tracking', 'usage-tracking', 'general-settings' ) );

$is_new_user = (int) get_option( 'rop_is_new_user', 0 );
$install_time = ! $is_new_user ? (int) get_option( 'rop_first_install_date', 0 ) : 0;
Expand Down Expand Up @@ -1386,7 +1387,7 @@ public function rop_linkedin_api_v2_notice() {

?>
<div class="notice notice-error">
<?php echo sprintf( __( '%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>' ); ?>
<?php echo sprintf( __( '%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="' . esc_url( Rop_I18n::docs_url( 'general-guides/how-to-move-to-linkedin-api-v2', 'linkedin-api', 'admin-notice' ) ) . '" target="_blank">', '</a>', '<a style="float: right;" href="?rop-linkedin-api-notice-dismissed">Dismiss</a>', '</p>' ); ?>

</div>
<?php
Expand Down Expand Up @@ -1450,7 +1451,7 @@ public function rop_wp_cron_notice() {

?>
<div class="notice notice-error">
<?php echo sprintf( __( '%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>' ); ?>
<?php echo sprintf( __( '%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="' . esc_url( Rop_I18n::docs_url( 'general-guides/fix-revive-old-post-not-posting', 'wp-cron-disabled', 'admin-notice' ) ) . '" target="_blank">', '</a>', '<a style="float: right;" href="?rop-wp-cron-notice-dismissed">Dismiss</a>', '</p>' ); ?>

</div>
<?php
Expand Down Expand Up @@ -1596,7 +1597,7 @@ public function rop_cron_event_status_notice() {

?>
<div class="notice notice-error">
<?php echo sprintf( __( '%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>' ); ?>
<?php echo sprintf( __( '%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="' . esc_url( Rop_I18n::docs_url( 'general-guides/fix-revive-old-post-not-posting', 'cron-event-status', 'admin-notice' ) ) . '" target="_blank">', '</a>', '<a style="float: right;" href="?rop-cron-event-status-notice-dismissed">Dismiss</a>', '</p>' ); ?>

</div>
<?php
Expand Down Expand Up @@ -2027,10 +2028,40 @@ public function register_meta() {
return current_user_can( 'edit_posts' );
};

// JSON-encoded automatically by WP
// JSON-encoded automatically by WP.
$sanitize_passthrough = function ( $value ) {
return $value;
};
$sanitize_share_messages = function ( $messages ) {
if ( ! is_array( $messages ) ) {
return array();
}

$sanitized = array();
foreach ( $messages as $message ) {
if ( ! is_array( $message ) || ! isset( $message['rop_custom_description'] ) || ! is_scalar( $message['rop_custom_description'] ) ) {
continue;
}

// Strip tags but keep the text as typed: every "&" is encoded first, so the decode
// reverses only the encoding added here. A "<" that cannot open a tag, or has no
// closing ">", is encoded so strip_tags() keeps it; edge whitespace is not trimmed.
// Repeat until nothing is stripped, because a decoded lone "<" can join the text after a removed tag.
$description = wp_check_invalid_utf8( (string) $message['rop_custom_description'] );
do {
$previous = $description;
$description = preg_replace( '/<(?![a-zA-Z!?]|\/[a-zA-Z])/', '&lt;', str_replace( '&', '&amp;', $description ) );
$description = preg_replace( '@<(script|style)[^>]*?>.*?</\\1>@si', '', wp_pre_kses_less_than( $description ) );
$description = html_entity_decode( strip_tags( $description ), ENT_QUOTES, 'UTF-8' );
} while ( $description !== $previous );

$sanitized[] = array(
'rop_custom_description' => $description,
);
}

return $sanitized;
};

register_post_meta(
'',
Expand Down Expand Up @@ -2063,7 +2094,7 @@ public function register_meta() {
array(
'single' => true,
'type' => 'array',
'sanitize_callback' => $sanitize_passthrough,
'sanitize_callback' => $sanitize_share_messages,
'auth_callback' => $auth_can_edit_posts,
'show_in_rest' => array(
'schema' => array(
Expand Down
Loading
Loading