Skip to content

Commit

Permalink
Merge pull request #27 from iamsayan/develop
Browse files Browse the repository at this point in the history
release v1.4.8
  • Loading branch information
iamsayan authored Jan 22, 2023
2 parents 88cf4cd + d3c2a11 commit bb8bde7
Show file tree
Hide file tree
Showing 25 changed files with 351 additions and 178 deletions.
24 changes: 24 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,30 @@
# Changelog
All notable changes to this project will be documented in this file.

## 1.4.8
Release Date: 22nd January, 2023

= Premium Version =
* Added: Option to select post statuses which can be republished.
* Added: Taxonomies and Author filters to Custom Republish Rules.
* Added: Option to set Post Status after individual post republish.
* Tweak: Only published posts are eligible for Social Share and OneSignal Notification.
* Fixed: Republish on Queue is showing even after successful single republish.
* Fixed: Auto Log History removal not working properly.
* Fixed: Account Name was not showing on Pinterest Edit Template Popup.
* And all Free Version Improvements and Fixes.

= Free Version =
* Updated: Action Schedular Library to v3.5.4.
* Improved: Code Optimizations.
* Fixed: Dashboard CSS issue.
* Fixed: Typos.

## 1.4.7.1
Release Date: 17th January, 2023

* Fixed: Permission issue after deactivation.

## 1.4.7
Release Date: 10th January, 2023

Expand Down
2 changes: 1 addition & 1 deletion assets/js/admin.min.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.

2 changes: 1 addition & 1 deletion includes/Api/Callbacks/ManagerCallbacks.php
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ public function republish_info( $args ) {
'id' => $args['label_for'],
'name' => 'wpar_republish_position',
'value' => $this->get_data( 'wpar_republish_position', 'disable' ),
'description' => __( 'Select how you want to show original published date of the post on frontend. Before Content option will push Republish info to top and After Content will pust post content to top. You can keep it disable if you don\'t want to use this.', 'wp-auto-republish' ),
'description' => __( 'Select how you want to show original published date of the post on frontend. Before Content option will push Republish info to top and After Content will push post content to top. You can keep it disable if you don\'t want to use this.', 'wp-auto-republish' ),
'options' => [
'disable' => __( 'Disable', 'wp-auto-republish' ),
'before_content' => __( 'Before Content', 'wp-auto-republish' ),
Expand Down
6 changes: 3 additions & 3 deletions includes/Base/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,10 @@ public function as_exclude_pastdue_actions( $null ) {
$num_pastdue_actions = (int) $store->query_actions( $query_args, 'count' );

if ( 0 !== $num_pastdue_actions ) {
$query_args['group'] = 'wp-auto-republish';
$num_pastdue_rm_actions = (int) $store->query_actions( $query_args, 'count' );
$query_args['group'] = 'wp-auto-republish';
$num_pastdue_rvp_actions = (int) $store->query_actions( $query_args, 'count' );

$num_pastdue_actions -= $num_pastdue_rm_actions;
$num_pastdue_actions -= $num_pastdue_rvp_actions;
}

$threshold_seconds = (int) apply_filters( 'action_scheduler_pastdue_actions_seconds', DAY_IN_SECONDS );
Expand Down
85 changes: 43 additions & 42 deletions includes/Base/Enqueue.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,48 +119,49 @@ public function load_assets( $hook ) {
wp_enqueue_script( 'revivepress-confirm' );
wp_enqueue_script( 'revivepress-admin' );
wp_localize_script( 'revivepress-admin', 'rvpAdminL10n', [
'ajaxurl' => admin_url( 'admin-ajax.php' ),
'select_weekdays' => __( 'Select weekdays (required)', 'wp-auto-republish' ),
'select_post_types' => __( 'Select post types (required)', 'wp-auto-republish' ),
'select_user_roles' => __( 'Select user roles (required)', 'wp-auto-republish' ),
'select_taxonomies' => __( 'Select taxonomies', 'wp-auto-republish' ),
'post_ids' => __( 'Enter post or page or custom post ids (comma separated)', 'wp-auto-republish' ),
'saving' => __( 'Saving...', 'wp-auto-republish' ),
'saving_text' => __( 'Please wait while we are saving your settings...', 'wp-auto-republish' ),
'done' => __( 'Done!', 'wp-auto-republish' ),
'error' => __( 'Error!', 'wp-auto-republish' ),
'deleting' => __( 'Deleting...', 'wp-auto-republish' ),
'processing' => __( 'Processing...', 'wp-auto-republish' ),
'warning' => __( 'Warning!', 'wp-auto-republish' ),
'under_process' => __( 'Please wait while we are processing your request...', 'wp-auto-republish' ),
'save_button' => __( 'Save Settings', 'wp-auto-republish' ),
'save_success' => __( 'Settings Saved Successfully!', 'wp-auto-republish' ),
'are_you_sure' => __( 'Are you sure that you want to delete this item?', 'wp-auto-republish' ),
'process_failed' => __( 'Invalid Nonce! We could not process your request.', 'wp-auto-republish' ),
'ok_button' => __( 'OK', 'wp-auto-republish' ),
'confirm_button' => __( 'Confirm', 'wp-auto-republish' ),
'cancel_button' => __( 'Cancel', 'wp-auto-republish' ),
'close_btn' => __( 'Close', 'wp-auto-republish' ),
'paste_data' => __( 'Paste Here', 'wp-auto-republish' ),
'import_btn' => __( 'Import', 'wp-auto-republish' ),
'importing' => __( 'Importing...', 'wp-auto-republish' ),
'please_wait' => __( 'Please wait...', 'wp-auto-republish' ),
'no_logs_found' => __( 'No logs found.', 'wp-auto-republish' ),
'filter_btn' => __( 'Filter', 'wp-auto-republish' ),
'activating' => __( 'Activating...', 'wp-auto-republish' ),
'deactivating' => __( 'Deactivating...', 'wp-auto-republish' ),
'activate' => __( 'Activate', 'wp-auto-republish' ),
'deactivate' => __( 'Deactivate', 'wp-auto-republish' ),
'enabled' => __( 'Enabled', 'wp-auto-republish' ),
'disabled' => __( 'Disabled', 'wp-auto-republish' ),
'verify' => __( 'Verify', 'wp-auto-republish' ),
'new_account' => __( 'New Account', 'wp-auto-republish' ),
'is_empty' => __( 'Please enter the required data first!', 'wp-auto-republish' ),
'edit_template' => __( 'Edit Template', 'wp-auto-republish' ),
'save_template' => __( 'Save Template', 'wp-auto-republish' ),
'is_premium' => revivepress_fs()->can_use_premium_code__premium_only(),
'security' => wp_create_nonce( 'rvp_admin_nonce' ),
'api' => [
'ajaxurl' => admin_url( 'admin-ajax.php' ),
'select_weekdays' => __( 'Select weekdays (required)', 'wp-auto-republish' ),
'select_post_types' => __( 'Select post types (required)', 'wp-auto-republish' ),
'select_post_statuses' => __( 'Select post statuses (required)', 'wp-auto-republish' ),
'select_user_roles' => __( 'Select user roles (required)', 'wp-auto-republish' ),
'select_taxonomies' => __( 'Select taxonomies', 'wp-auto-republish' ),
'post_ids' => __( 'Enter post or page or custom post ids (comma separated)', 'wp-auto-republish' ),
'saving' => __( 'Saving...', 'wp-auto-republish' ),
'saving_text' => __( 'Please wait while we are saving your settings...', 'wp-auto-republish' ),
'done' => __( 'Done!', 'wp-auto-republish' ),
'error' => __( 'Error!', 'wp-auto-republish' ),
'deleting' => __( 'Deleting...', 'wp-auto-republish' ),
'processing' => __( 'Processing...', 'wp-auto-republish' ),
'warning' => __( 'Warning!', 'wp-auto-republish' ),
'under_process' => __( 'Please wait while we are processing your request...', 'wp-auto-republish' ),
'save_button' => __( 'Save Settings', 'wp-auto-republish' ),
'save_success' => __( 'Settings Saved Successfully!', 'wp-auto-republish' ),
'are_you_sure' => __( 'Are you sure that you want to delete this item?', 'wp-auto-republish' ),
'process_failed' => __( 'Invalid Nonce! We could not process your request.', 'wp-auto-republish' ),
'ok_button' => __( 'OK', 'wp-auto-republish' ),
'confirm_button' => __( 'Confirm', 'wp-auto-republish' ),
'cancel_button' => __( 'Cancel', 'wp-auto-republish' ),
'close_btn' => __( 'Close', 'wp-auto-republish' ),
'paste_data' => __( 'Paste Here', 'wp-auto-republish' ),
'import_btn' => __( 'Import', 'wp-auto-republish' ),
'importing' => __( 'Importing...', 'wp-auto-republish' ),
'please_wait' => __( 'Please wait...', 'wp-auto-republish' ),
'no_logs_found' => __( 'No logs found.', 'wp-auto-republish' ),
'filter_btn' => __( 'Filter', 'wp-auto-republish' ),
'activating' => __( 'Activating...', 'wp-auto-republish' ),
'deactivating' => __( 'Deactivating...', 'wp-auto-republish' ),
'activate' => __( 'Activate', 'wp-auto-republish' ),
'deactivate' => __( 'Deactivate', 'wp-auto-republish' ),
'enabled' => __( 'Enabled', 'wp-auto-republish' ),
'disabled' => __( 'Disabled', 'wp-auto-republish' ),
'verify' => __( 'Verify', 'wp-auto-republish' ),
'new_account' => __( 'New Account', 'wp-auto-republish' ),
'is_empty' => __( 'Please enter the required data first!', 'wp-auto-republish' ),
'edit_template' => __( 'Edit Template', 'wp-auto-republish' ),
'save_template' => __( 'Save Template', 'wp-auto-republish' ),
'is_premium' => revivepress_fs()->can_use_premium_code__premium_only(),
'security' => wp_create_nonce( 'rvp_admin_nonce' ),
'api' => [
'root' => esc_url_raw( get_rest_url() ),
'nonce' => ( wp_installing() && ! is_multisite() ? '' : wp_create_nonce( 'wp_rest' ) ),
],
Expand Down
2 changes: 1 addition & 1 deletion includes/Core/FetchPosts.php
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ public function complete() {
}
$args = [
'post_type' => $post_types,
'post_status' => 'publish',
'post_status' => 'any',
'post__in' => wp_parse_id_list( $post_ids ),
'numberposts' => $this->do_filter( 'number_of_posts', $number_posts ),
'orderby' => $orderby,
Expand Down
24 changes: 2 additions & 22 deletions includes/Core/PostRepublish.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,14 @@ public function call_republish( array $args ) {
* @param int $post_id Post ID
*/
public function do_republish( $post_id ) {
// check if given post is not published.
if ( 'publish' === get_post_status( $post_id ) ) {
$this->handle( (int) $post_id );
}
// delete metas
$this->delete_meta( $post_id, 'wpar_global_republish_status' );
$this->delete_meta( $post_id, '_wpar_global_republish_datetime' );
$this->delete_meta( $post_id, 'wpar_filter_republish_status' );
$this->delete_meta( $post_id, '_wpar_filter_republish_datetime' );
$this->delete_meta( $post_id, 'wpar_republish_rule_action' );
// Republish.
$this->handle( (int) $post_id );
}

/**
Expand Down Expand Up @@ -122,7 +120,6 @@ public function update_old_post(
);
//error_log( print_r( $args, true ) );
wp_update_post( $args );
$this->set_occurence( $post );
$this->do_action( 'clear_site_cache' );
// reinit kses filters
\kses_init_filters();
Expand Down Expand Up @@ -177,22 +174,5 @@ private function get_publish_time( int $post_id, bool $single = false, bool $sch
$scheduled
);
}

/**
* Custom post type support.
*
* @param object $post WP Post object.
*/
private function set_occurence( WP_Post $post ) {
$repeat = $this->get_meta( $post->ID, '_wpar_post_republish_occurrence' );

if ( ! empty($repeat) && is_numeric( $repeat ) ) {
$repeat++;
} else {
$repeat = 1;
}

$this->update_meta( $post->ID, '_wpar_post_republish_occurrence', $repeat );
}

}
11 changes: 11 additions & 0 deletions includes/Helpers/HelperFunctions.php
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,17 @@ protected function is_enabled( $name, $prefix = false ) {
return false;
}

/**
* Get available post statuses
*
* @since 1.4.8
* @return array
*/
protected function get_post_statuses() {
$statuses = get_post_statuses();
return apply_filters( 'wpar/post_statuses', $statuses );
}

/**
* Check current user roles.
*
Expand Down
12 changes: 8 additions & 4 deletions includes/Tools/Database.php
Original file line number Diff line number Diff line change
Expand Up @@ -222,10 +222,14 @@ public function run_cleanup() {
'fields' => 'ids',
];
$post_ids = $this->get_posts( $args );
$post_ids = implode( ', ', $post_ids );
$where = $wpdb->prepare( "WHERE post_id IN ( {$post_ids} ) AND meta_key LIKE %s OR meta_key LIKE %s", '%' . $wpdb->esc_like( 'wpar_' ) . '%', '%' . $wpdb->esc_like( 'rvp_' ) . '%' );
$wpdb->query( "DELETE FROM {$wpdb->postmeta} {$where}" );
// phpcs:ignore

if ( ! empty($post_ids) ) {
$post_ids = join( ', ', $post_ids );
$where = $wpdb->prepare( "WHERE post_id IN ( {$post_ids} ) AND meta_key LIKE %s OR meta_key LIKE %s", '%' . $wpdb->esc_like( 'wpar_' ) . '%', '%' . $wpdb->esc_like( 'rvp_' ) . '%' );
$wpdb->query( "DELETE FROM {$wpdb->postmeta} {$where}" );
// phpcs:ignore
}

return __( 'Cleanup task started. It might take a couple of minutes.', 'wp-auto-republish' );
}

Expand Down
Loading

0 comments on commit bb8bde7

Please sign in to comment.