From 1b124c75e5be911ada393add37b72b730f933345 Mon Sep 17 00:00:00 2001 From: Sayan Datta Date: Fri, 24 Jun 2022 20:17:11 +0530 Subject: [PATCH 1/3] fixed code --- CHANGELOG.md | 10 +- README.md | 10 +- composer.json | 6 +- includes/Base/Actions.php | 17 +-- includes/Base/Activate.php | 10 +- includes/Base/AdminNotice.php | 127 ++++++++++++++++-- includes/Base/BaseController.php | 10 +- includes/Base/Deactivate.php | 14 +- includes/Base/DonateNotice.php | 102 -------------- includes/Base/Localization.php | 10 +- includes/Base/RatingNotice.php | 103 -------------- includes/Core/Connection.php | 18 +-- includes/Core/MigrateActions.php | 18 +-- includes/Helpers/HelperFunctions.php | 8 +- includes/Helpers/Hooker.php | 10 +- .../Helpers/{Schedular.php => Scheduler.php} | 12 +- includes/Loader.php | 8 +- includes/Tools/DatabaseTable.php | 93 ------------- .../migrate-wp-cron-to-action-scheduler.pot | 50 +++---- migrate-wp-cron-to-action-scheduler.php | 44 +++--- readme.txt | 28 ++-- vendor/composer/autoload_classmap.php | 27 ++-- vendor/composer/autoload_files.php | 2 +- vendor/composer/autoload_psr4.php | 2 +- vendor/composer/autoload_static.php | 35 +++-- 25 files changed, 289 insertions(+), 485 deletions(-) delete mode 100644 includes/Base/DonateNotice.php delete mode 100644 includes/Base/RatingNotice.php rename includes/Helpers/{Schedular.php => Scheduler.php} (95%) delete mode 100644 includes/Tools/DatabaseTable.php diff --git a/CHANGELOG.md b/CHANGELOG.md index 9ac3dc0..20b777c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,15 @@ # Changelog -If you like WP Cron Action Schedular plugin, please take a moment to [give a 5-star rating](https://wordpress.org/support/plugin/migrate-wp-cron-to-action-scheduler/reviews/#new-post). It helps to keep development and support going strong. Thank you! +If you like Advanced Cron Scheduler plugin, please take a moment to [give a 5-star rating](https://wordpress.org/support/plugin/migrate-wp-cron-to-action-scheduler/reviews/?filter=5#new-post). It helps to keep development and support going strong. Thank you! All notable changes to this project will be documented in this file. +## 1.0.7 +Release Date: 24th June, 2022 + +* Removed: Unused code. +* Fixed: Typo. + ## 1.0.6 Release Date: 24th June, 2022 @@ -15,7 +21,7 @@ Release Date: 24th June, 2022 ## 1.0.5 Release Date: 3rd December, 2021 -* Fixed: An errors which occurs if cron is creating early before initialization of Action schedular library. +* Fixed: An errors which occurs if cron is creating early before initialization of Action scheduler library. ## 1.0.4 Release Date: 2nd December, 2021 diff --git a/README.md b/README.md index 9b9a72b..39cb385 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# WP Cron Action Schedular +# Advanced Cron Scheduler for WordPress -The WP Cron Action Schedular plugin helps to easily replace or migrate Native WordPress Cron to the Action Scheduler Library. +The Advanced Cron Scheduler for WordPress plugin helps to easily replace or migrate Native WordPress Cron to the Action Scheduler Library. The WP-Cron system in WordPress is not a "real" cron system, which means events may not run exactly according to their schedule because the system relies on regular traffic to the website in order to trigger scheduled events. @@ -15,7 +15,7 @@ The WP-Cron system in WordPress is not a "real" cron system, which means events * Long-running events may temporarily block the event runner * High traffic websites may suffer from sequential processing issues that block the event runner -The WP Cron Action Schedular plugin does alter the way that WordPress core runs cron events using the Action Scheduler Library. +The Advanced Cron Scheduler for WordPress plugin does alter the way that WordPress core runs cron events using the Action Scheduler Library. Action Scheduler is a scalable, traceable job queue for background processing large sets of actions in WordPress. It's specially designed to be distributed in WordPress plugins. @@ -51,8 +51,8 @@ There you will find: ## Contribute -* Active development of this plugin is handled [on GitHub](https://github.com/iamsayan/migrate-wp-cron-to-action-scheduler/). -* Feel free to [fork the project on GitHub](https://github.com/iamsayan/migrate-wp-cron-to-action-scheduler/) and submit your contributions via pull request. +* Active development of this plugin is handled [on GitHub](https://github.com/iamsayan/advanced-cron-scheduler/). +* Feel free to [fork the project on GitHub](https://github.com/iamsayan/advanced-cron-scheduler/) and submit your contributions via pull request. ## Credits diff --git a/composer.json b/composer.json index 75728d6..7e1f9b8 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { - "name": "iamsayan/migrate-wp-cron-to-action-scheduler", - "description": "The WP Cron Action Schedular plugin helps to easily migrate Native WordPress Cron to the Action Scheduler Library", + "name": "iamsayan/advanced-cron-scheduler", + "description": "The Advanced Cron Scheduler plugin helps to easily migrate Native WordPress Cron to the Action Scheduler Library", "type": "wordpress-plugin", "license": "GPL-3.0", "authors": [ @@ -23,7 +23,7 @@ "minimum-stability": "stable", "autoload": { "psr-4": { - "Mwpcac\\": "./includes" + "ACSWP\\Plugin\\": "./includes" }, "files": [ "vendor/woocommerce/action-scheduler/action-scheduler.php" ] }, diff --git a/includes/Base/Actions.php b/includes/Base/Actions.php index b188095..0b531b7 100644 --- a/includes/Base/Actions.php +++ b/includes/Base/Actions.php @@ -3,15 +3,15 @@ * Action links. * * @since 1.0.0 - * @package WP Cron Action Schedular - * @subpackage Mwpcac\Base + * @package Advanced Cron Scheduler + * @subpackage ACSWP\Plugin\Base * @author Sayan Datta */ -namespace Mwpcac\Base; +namespace ACSWP\Plugin\Base; -use Mwpcac\Helpers\Hooker; -use Mwpcac\Base\BaseController; +use ACSWP\Plugin\Helpers\Hooker; +use ACSWP\Plugin\Base\BaseController; defined( 'ABSPATH' ) || exit; @@ -44,9 +44,10 @@ public function settings_link( $links ) { */ public function meta_links( $links, $file ) { if ( $file === $this->plugin ) { // only for this plugin - $links[] = '' . __( 'Usage', 'migrate-wp-cron-to-action-scheduler' ) . ''; - $links[] = '' . __( 'FAQ', 'migrate-wp-cron-to-action-scheduler' ) . ''; - $links[] = '' . __( 'GitHub', 'migrate-wp-cron-to-action-scheduler' ) . ''; + $links[] = '' . __( 'Usage', 'migrate-wp-cron-to-action-scheduler' ) . ''; + $links[] = '' . __( 'FAQ', 'migrate-wp-cron-to-action-scheduler' ) . ''; + $links[] = '' . __( 'GitHub', 'migrate-wp-cron-to-action-scheduler' ) . ''; + $links[] = '★★★★★'; } return $links; diff --git a/includes/Base/Activate.php b/includes/Base/Activate.php index 298a56d..a549492 100644 --- a/includes/Base/Activate.php +++ b/includes/Base/Activate.php @@ -3,12 +3,12 @@ * Activation. * * @since 1.1.0 - * @package WP Cron Action Schedular - * @subpackage Mwpcac\Base + * @package Advanced Cron Scheduler + * @subpackage ACSWP\Plugin\Base * @author Sayan Datta */ -namespace Mwpcac\Base; +namespace ACSWP\Plugin\Base; /** * Activation class. @@ -23,9 +23,9 @@ public static function activate() { return; } - set_transient( 'mwpcac-show-notice-on-activation', true, 15 ); + set_transient( 'acswp-show-notice-on-activation', true, 15 ); // action - do_action( 'mwpcac/plugin_activate' ); + do_action( 'acswp/plugin_activate' ); } } \ No newline at end of file diff --git a/includes/Base/AdminNotice.php b/includes/Base/AdminNotice.php index 8b2bd98..f650a9d 100644 --- a/includes/Base/AdminNotice.php +++ b/includes/Base/AdminNotice.php @@ -3,15 +3,15 @@ * Admin notices. * * @since 1.0.0 - * @package WP Cron Action Schedular - * @subpackage Mwpcac\Base + * @package Advanced Cron Scheduler + * @subpackage ACSWP\Plugin\Base * @author Sayan Datta */ -namespace Mwpcac\Base; +namespace ACSWP\Plugin\Base; -use Mwpcac\Helpers\Hooker; -use Mwpcac\Base\BaseController; +use ACSWP\Plugin\Helpers\Hooker; +use ACSWP\Plugin\Base\BaseController; defined( 'ABSPATH' ) || exit; @@ -26,18 +26,22 @@ class AdminNotice extends BaseController * Register functions. */ public function register() { - $this->action( 'admin_notices', 'install_notice' ); + $this->action( 'admin_notices', 'notice' ); + $this->action( 'admin_init', 'dismiss_notice' ); } /** * Show internal admin notices. */ - public function install_notice() { + public function notice() { global $wp_version; // Show a warning to sites running PHP < 5.6 if ( version_compare( $wp_version, '5.2.0', '<' ) ) { deactivate_plugins( $this->plugin ); + if ( isset( $_GET['activate'] ) ) { // phpcs:ignore + unset( $_GET['activate'] ); // phpcs:ignore + } /* translators: %s: Plugin Name */ echo '

' . sprintf( __( 'Your version of WordPress is below the minimum version of WordPress required by %s plugin. Please upgrade WordPress to 5.2.0 or later.', 'migrate-wp-cron-to-action-scheduler' ), $this->name ) . '

'; return; @@ -46,19 +50,124 @@ public function install_notice() { // Show a warning to sites running PHP < 5.6 if ( version_compare( PHP_VERSION, '5.6', '<' ) ) { deactivate_plugins( $this->plugin ); + if ( isset( $_GET['activate'] ) ) { // phpcs:ignore + unset( $_GET['activate'] ); // phpcs:ignore + } /* translators: %s: Plugin Name */ echo '

' . sprintf( __( 'Your version of PHP is below the minimum version of PHP required by %s plugin. Please contact your host and request that your version be upgraded to 5.6 or later.', 'migrate-wp-cron-to-action-scheduler' ), $this->name ) . '

'; return; } // Check transient, if available display notice - if ( get_transient( 'mwpcac-show-notice-on-activation' ) !== false ) { ?> + if ( get_transient( 'acswp-show-notice-on-activation' ) !== false ) { ?>

here to view Action Scheduler tasks.', 'migrate-wp-cron-to-action-scheduler' ), $this->name, $this->version, admin_url( 'tools.php?page=action-scheduler' ) ); ?>

calculate_time() > strtotime( '-7 days' ) + || '1' === get_option( 'acswp_plugin_dismiss_rating_notice' ) + || apply_filters( 'acswp/hide_sticky_rating_notice', false ) ) { + $show_rating = false; + } + + if ( $show_rating ) { + $dismiss = wp_nonce_url( add_query_arg( 'acswp_notice_action', 'dismiss_rating' ), 'acswp_notice_nonce' ); + $no_thanks = wp_nonce_url( add_query_arg( 'acswp_notice_action', 'no_thanks_rating' ), 'acswp_notice_nonce' ); ?> + +
+

5-star rating on WordPress? Just to help us spread the word and boost my motivation.', 'migrate-wp-cron-to-action-scheduler' ); ?>

+

  +  | +

+
+ calculate_time() > strtotime( '-240 hours' ) + || '1' === get_option( 'acswp_plugin_dismiss_donate_notice' ) + || apply_filters( 'acswp/hide_sticky_donate_notice', false ) ) { + $show_donate = false; + } + + if ( $show_donate ) { + $dismiss = wp_nonce_url( add_query_arg( 'acswp_notice_action', 'dismiss_donate' ), 'acswp_notice_nonce' ); + $no_thanks = wp_nonce_url( add_query_arg( 'acswp_notice_action', 'no_thanks_donate' ), 'acswp_notice_nonce' ); ?> + +
+

+

  +  | +

+
+ */ -namespace Mwpcac\Base; +namespace ACSWP\Plugin\Base; /** * Base Controller class. @@ -64,8 +64,8 @@ public function __construct() { $this->plugin_path = plugin_dir_path( $this->dirname_r( __FILE__, 2 ) ); $this->plugin_url = plugin_dir_url( $this->dirname_r( __FILE__, 2 ) ); $this->plugin = plugin_basename( $this->dirname_r( __FILE__, 3 ) ) . '/migrate-wp-cron-to-action-scheduler.php'; - $this->version = '1.0.5'; - $this->name = 'WP Cron Action Schedular'; + $this->version = ACS_PLUGIN_VERSION; + $this->name = 'Advanced Cron Scheduler'; } /** diff --git a/includes/Base/Deactivate.php b/includes/Base/Deactivate.php index 9b55bac..27125d3 100644 --- a/includes/Base/Deactivate.php +++ b/includes/Base/Deactivate.php @@ -3,12 +3,12 @@ * Deactivation. * * @since 1.0.0 - * @package WP Cron Action Schedular - * @subpackage Mwpcac\Base + * @package Advanced Cron Scheduler + * @subpackage ACSWP\Plugin\Base * @author Sayan Datta */ -namespace Mwpcac\Base; +namespace ACSWP\Plugin\Base; /** * Deactivation class. @@ -23,11 +23,11 @@ public static function deactivate() { return; } - delete_option( 'mwpcac_plugin_dismiss_rating_notice' ); - delete_option( 'mwpcac_plugin_no_thanks_rating_notice' ); - delete_option( 'mwpcac_plugin_installed_time' ); + delete_option( 'acswp_plugin_dismiss_rating_notice' ); + delete_option( 'acswp_plugin_no_thanks_rating_notice' ); + delete_option( 'acswp_plugin_installed_time' ); // action - do_action( 'mwpcac/plugin_deactivate' ); + do_action( 'acswp/plugin_deactivate' ); } } \ No newline at end of file diff --git a/includes/Base/DonateNotice.php b/includes/Base/DonateNotice.php deleted file mode 100644 index 2439018..0000000 --- a/includes/Base/DonateNotice.php +++ /dev/null @@ -1,102 +0,0 @@ - - */ - -namespace Mwpcac\Base; - -use Mwpcac\Helpers\Hooker; - -defined( 'ABSPATH' ) || exit; - -/** - * Donation Notice class. - */ -class DonateNotice -{ - use Hooker; - - /** - * Register functions. - */ - public function register() { - $this->action( 'admin_notices', 'show_notice' ); - $this->action( 'admin_init', 'dismiss_notice' ); - } - - /** - * Show admin notices. - */ - public function show_notice() { - // Show notice after 240 hours (10 days) from installed time. - if ( $this->calculate_time() > strtotime( '-360 hours' ) - || '1' === get_option( 'mwpcac_plugin_dismiss_donate_notice' ) - || ! current_user_can( 'manage_options' ) - || apply_filters( 'mwpcac/hide_sticky_donate_notice', false ) ) { - return; - } - - $dismiss = wp_nonce_url( add_query_arg( 'mwpcac_donate_notice_action', 'dismiss_donate_true' ), 'mwpcac_dismiss_donate_true' ); - $no_thanks = wp_nonce_url( add_query_arg( 'mwpcac_donate_notice_action', 'no_thanks_donate_true' ), 'mwpcac_no_thanks_donate_true' ); ?> - -
-

-

  -  | -  | -

-
- strtotime( '-360 hours' ) ) { - return; - } - delete_option( 'mwpcac_plugin_dismiss_donate_notice' ); - delete_option( 'mwpcac_plugin_no_thanks_donate_notice' ); - } - - if ( ! isset( $_REQUEST['mwpcac_donate_notice_action'] ) ) { - return; - } - - if ( 'dismiss_donate_true' === $_REQUEST['mwpcac_donate_notice_action'] ) { - check_admin_referer( 'mwpcac_dismiss_donate_true' ); - update_option( 'mwpcac_plugin_dismiss_donate_notice', '1' ); - } - - if ( 'no_thanks_donate_true' === $_REQUEST['mwpcac_donate_notice_action'] ) { - check_admin_referer( 'mwpcac_no_thanks_donate_true' ); - update_option( 'mwpcac_plugin_no_thanks_donate_notice', '1' ); - update_option( 'mwpcac_plugin_dismiss_donate_notice', '1' ); - update_option( 'mwpcac_plugin_dismissed_time_donate', time() ); - } - - wp_redirect( remove_query_arg( 'mwpcac_donate_notice_action' ) ); - exit; - } - - /** - * Calculate install time. - */ - private function calculate_time() { - $installed_time = get_option( 'mwpcac_plugin_installed_time_donate' ); - - if ( ! $installed_time ) { - $installed_time = time(); - update_option( 'mwpcac_plugin_installed_time_donate', $installed_time ); - } - - return $installed_time; - } -} \ No newline at end of file diff --git a/includes/Base/Localization.php b/includes/Base/Localization.php index 21bface..7506d6b 100644 --- a/includes/Base/Localization.php +++ b/includes/Base/Localization.php @@ -3,15 +3,15 @@ * Localization loader. * * @since 1.0.0 - * @package WP Cron Action Schedular - * @subpackage Mwpcac\Base + * @package Advanced Cron Scheduler + * @subpackage ACSWP\Plugin\Base * @author Sayan Datta */ -namespace Mwpcac\Base; +namespace ACSWP\Plugin\Base; -use Mwpcac\Helpers\Hooker; -use Mwpcac\Base\BaseController; +use ACSWP\Plugin\Helpers\Hooker; +use ACSWP\Plugin\Base\BaseController; defined( 'ABSPATH' ) || exit; diff --git a/includes/Base/RatingNotice.php b/includes/Base/RatingNotice.php deleted file mode 100644 index 360f44f..0000000 --- a/includes/Base/RatingNotice.php +++ /dev/null @@ -1,103 +0,0 @@ - - */ - -namespace Mwpcac\Base; - -use Mwpcac\Helpers\Hooker; -use Mwpcac\Base\BaseController; - -defined( 'ABSPATH' ) || exit; - -/** - * Rating notice class. - */ -class RatingNotice -{ - use Hooker; - - /** - * Register functions. - */ - public function register() { - $this->action( 'admin_notices', 'show_notice' ); - $this->action( 'admin_init', 'dismiss_notice' ); - } - - /** - * Show admin notices. - */ - public function show_notice() { - // Show notice after 240 hours (10 days) from installed time. - if ( $this->calculate_time() > strtotime( '-360 hours' ) - || '1' === get_option( 'mwpcac_plugin_dismiss_rating_notice' ) - || ! current_user_can( 'manage_options' ) - || apply_filters( 'mwpcac/hide_sticky_rating_notice', false ) ) { - return; - } - - $dismiss = wp_nonce_url( add_query_arg( 'mwpcac_rating_notice_action', 'dismiss_rating_true' ), 'dismiss_rating_true' ); - $no_thanks = wp_nonce_url( add_query_arg( 'mwpcac_rating_notice_action', 'no_thanks_rating_true' ), 'no_thanks_rating_true' ); ?> - -
-

5-star rating on WordPress? Just to help us spread the word and boost my motivation.', 'migrate-wp-cron-to-action-scheduler' ); ?>

-

  -  | -  | -

-
- strtotime( '-168 hours' ) ) { - return; - } - delete_option( 'mwpcac_plugin_dismiss_rating_notice' ); - delete_option( 'mwpcac_plugin_no_thanks_rating_notice' ); - } - - if ( ! isset( $_REQUEST['mwpcac_rating_notice_action'] ) ) { - return; - } - - if ( 'dismiss_rating_true' === $_REQUEST['mwpcac_rating_notice_action'] ) { - check_admin_referer( 'dismiss_rating_true' ); - update_option( 'mwpcac_plugin_dismiss_rating_notice', '1' ); - } - - if ( 'no_thanks_rating_true' === $_REQUEST['mwpcac_rating_notice_action'] ) { - check_admin_referer( 'no_thanks_rating_true' ); - update_option( 'mwpcac_plugin_no_thanks_rating_notice', '1' ); - update_option( 'mwpcac_plugin_dismiss_rating_notice', '1' ); - update_option( 'mwpcac_plugin_dismissed_time', time() ); - } - - wp_redirect( remove_query_arg( 'mwpcac_rating_notice_action' ) ); - exit; - } - - /** - * Calculate install time. - */ - private function calculate_time() { - $installed_time = get_option( 'mwpcac_plugin_installed_time' ); - - if ( ! $installed_time ) { - $installed_time = time(); - update_option( 'mwpcac_plugin_installed_time', $installed_time ); - } - - return $installed_time; - } -} \ No newline at end of file diff --git a/includes/Core/Connection.php b/includes/Core/Connection.php index ae3df7e..cb5756b 100644 --- a/includes/Core/Connection.php +++ b/includes/Core/Connection.php @@ -3,16 +3,16 @@ * Action links. * * @since 1.0.0 - * @package WP Cron Action Schedular - * @subpackage Mwpcac\Base + * @package Advanced Cron Scheduler + * @subpackage ACSWP\Plugin\Base * @author Sayan Datta */ -namespace Mwpcac\Core; +namespace ACSWP\Plugin\Core; -use Mwpcac\Helpers\Hooker; -use Mwpcac\Helpers\Schedular; -use Mwpcac\Helpers\HelperFunctions; +use ACSWP\Plugin\Helpers\Hooker; +use ACSWP\Plugin\Helpers\Scheduler; +use ACSWP\Plugin\Helpers\HelperFunctions; defined( 'ABSPATH' ) || exit; @@ -21,7 +21,7 @@ */ class Connection { - use Hooker, HelperFunctions, Schedular; + use Hooker, HelperFunctions, Scheduler; /** * List of Events. @@ -136,8 +136,8 @@ public function pre_schedule_event( $pre, $event ) { /** * Reschedules a recurring event. * - * Note: The Action Schedular reschedule behaviour is intentionally different to WordPress's. - * To avoid drift of cron schedules, Action Schedular adds the interval to the next scheduled + * Note: The Action Scheduler reschedule behaviour is intentionally different to WordPress's. + * To avoid drift of cron schedules, Action Scheduler adds the interval to the next scheduled * run time without checking if this time is in the past. * * To ensure the next run time is in the future, it is recommended you delete and reschedule diff --git a/includes/Core/MigrateActions.php b/includes/Core/MigrateActions.php index c184fee..d708f31 100644 --- a/includes/Core/MigrateActions.php +++ b/includes/Core/MigrateActions.php @@ -3,16 +3,16 @@ * Migrate Crons to Action Scheduler. * * @since 1.0.0 - * @package WP Cron Action Schedular - * @subpackage Mwpcac\Base + * @package Advanced Cron Scheduler + * @subpackage ACSWP\Plugin\Base * @author Sayan Datta */ -namespace Mwpcac\Core; +namespace ACSWP\Plugin\Core; -use Mwpcac\Helpers\Hooker; -use Mwpcac\Helpers\Schedular; -use Mwpcac\Helpers\HelperFunctions; +use ACSWP\Plugin\Helpers\Hooker; +use ACSWP\Plugin\Helpers\Scheduler; +use ACSWP\Plugin\Helpers\HelperFunctions; defined( 'ABSPATH' ) || exit; @@ -21,14 +21,14 @@ */ class MigrateActions { - use Hooker, HelperFunctions, Schedular; + use Hooker, HelperFunctions, Scheduler; /** * Register functions. */ public function register() { - $this->action( 'mwpcac/plugin_activate', 'migrate_old_crons' ); - $this->action( 'mwpcac/plugin_deactivate', 'regenerate_crons' ); + $this->action( 'acswp/plugin_activate', 'migrate_old_crons' ); + $this->action( 'acswp/plugin_deactivate', 'regenerate_crons' ); } /** diff --git a/includes/Helpers/HelperFunctions.php b/includes/Helpers/HelperFunctions.php index ec7c838..d7236ef 100644 --- a/includes/Helpers/HelperFunctions.php +++ b/includes/Helpers/HelperFunctions.php @@ -3,12 +3,12 @@ * Helper Functions. * * @since 1.0.0 - * @package WP Cron Action Schedular - * @subpackage Mwpcac\Helpers + * @package Advanced Cron Scheduler + * @subpackage ACSWP\Plugin\Helpers * @author Sayan Datta */ -namespace Mwpcac\Helpers; +namespace ACSWP\Plugin\Helpers; defined( 'ABSPATH' ) || exit; @@ -21,7 +21,7 @@ trait HelperFunctions /** * Get the WP Cron schedule names by interval. * - * This is used as a fallback when Action Schedular does not have the + * This is used as a fallback when Action Scheduler does not have the * schedule name stored in the database to make a best guest as * the schedules name. * diff --git a/includes/Helpers/Hooker.php b/includes/Helpers/Hooker.php index 1956d24..c76d51e 100644 --- a/includes/Helpers/Hooker.php +++ b/includes/Helpers/Hooker.php @@ -3,12 +3,12 @@ * The Hooker. * * @since 1.0.0 - * @package WP Cron Action Schedular - * @subpackage Mwpcac\Helpers + * @package Advanced Cron Scheduler + * @subpackage ACSWP\Plugin\Helpers * @author Sayan Datta */ -namespace Mwpcac\Helpers; +namespace ACSWP\Plugin\Helpers; defined( 'ABSPATH' ) || exit; @@ -83,7 +83,7 @@ protected function do_action( ...$args ) { return; } - $action = 'mwpcac/' . $args[0]; + $action = 'acswp/' . $args[0]; unset( $args[0] ); \do_action_ref_array( $action, \array_merge( [], $args ) ); @@ -97,7 +97,7 @@ protected function do_filter( ...$args ) { return; } - $action = 'mwpcac/' . $args[0]; + $action = 'acswp/' . $args[0]; unset( $args[0] ); return \apply_filters_ref_array( $action, \array_merge( [], $args ) ); diff --git a/includes/Helpers/Schedular.php b/includes/Helpers/Scheduler.php similarity index 95% rename from includes/Helpers/Schedular.php rename to includes/Helpers/Scheduler.php index c69e888..58528d8 100644 --- a/includes/Helpers/Schedular.php +++ b/includes/Helpers/Scheduler.php @@ -1,21 +1,21 @@ */ -namespace Mwpcac\Helpers; +namespace ACSWP\Plugin\Helpers; defined( 'ABSPATH' ) || exit; /** - * Action Schedular Class + * Action Scheduler Class */ -trait Schedular +trait Scheduler { /** * Create the recurring action event. diff --git a/includes/Loader.php b/includes/Loader.php index 09a5fb2..6316adb 100644 --- a/includes/Loader.php +++ b/includes/Loader.php @@ -3,12 +3,12 @@ * Register all classes * * @since 1.0.0 - * @package WP Cron Action Schedular - * @subpackage Mwpcac\Core + * @package Advanced Cron Scheduler + * @subpackage ACSWP\Plugin\Core * @author Sayan Datta */ -namespace Mwpcac; +namespace ACSWP\Plugin; /** * Mwpcac Main Class. @@ -24,9 +24,7 @@ public static function get_services() { $services = [ Base\Actions::class, Base\AdminNotice::class, - Base\DonateNotice::class, Base\Localization::class, - Base\RatingNotice::class, Core\Connection::class, Core\MigrateActions::class, ]; diff --git a/includes/Tools/DatabaseTable.php b/includes/Tools/DatabaseTable.php deleted file mode 100644 index 45ec77f..0000000 --- a/includes/Tools/DatabaseTable.php +++ /dev/null @@ -1,93 +0,0 @@ - - */ - -namespace Mwpcac\Tools; - -use Mwpcac\Helpers\Hooker; - -defined( 'ABSPATH' ) || exit; - -/** - * Database Table class. - */ -class DatabaseTable -{ - use Hooker; - - /** - * Register functions. - */ - public function register() { - $this->action( 'plugins_loaded', 'maybe_recreate_actionscheduler_tables', 5 ); - } - - /** - * Recreate ActionScheduler tables if missing. - */ - public function maybe_recreate_actionscheduler_tables() { - global $wpdb; - - if ( $this->is_woocommerce_active() ) { - return; - } - - if ( - ! class_exists( 'ActionScheduler_HybridStore' ) - || ! class_exists( 'ActionScheduler_StoreSchema' ) - || ! class_exists( 'ActionScheduler_LoggerSchema' ) - ) { - return; - } - - $table_list = [ - 'actionscheduler_actions', - 'actionscheduler_logs', - 'actionscheduler_groups', - 'actionscheduler_claims', - ]; - - $found_tables = $wpdb->get_col( "SHOW TABLES LIKE '{$wpdb->prefix}actionscheduler%'" ); - foreach ( $table_list as $table_name ) { - if ( ! in_array( $wpdb->prefix . $table_name, $found_tables, true ) ) { - $this->recreate_actionscheduler_tables(); - return; - } - } - } - - /** - * Force the data store schema updates. - */ - private function recreate_actionscheduler_tables() { - $store = new \ActionScheduler_HybridStore(); - add_action( 'action_scheduler/created_table', [ $store, 'set_autoincrement' ], 10, 2 ); - - $store_schema = new \ActionScheduler_StoreSchema(); - $logger_schema = new \ActionScheduler_LoggerSchema(); - $store_schema->register_tables( true ); - $logger_schema->register_tables( true ); - - remove_action( 'action_scheduler/created_table', [ $store, 'set_autoincrement' ], 10 ); - } - - /** - * Is WooCommerce Installed - * - * @return bool - */ - private function is_woocommerce_active() { - // @codeCoverageIgnoreStart - if ( ! function_exists( 'is_plugin_active' ) ) { - include_once ABSPATH . 'wp-admin/includes/plugin.php'; - } - // @codeCoverageIgnoreEnd - return is_plugin_active( 'woocommerce/woocommerce.php' ) && function_exists( 'is_woocommerce' ); - } -} \ No newline at end of file diff --git a/languages/migrate-wp-cron-to-action-scheduler.pot b/languages/migrate-wp-cron-to-action-scheduler.pot index 8d7a795..ae0bf2b 100644 --- a/languages/migrate-wp-cron-to-action-scheduler.pot +++ b/languages/migrate-wp-cron-to-action-scheduler.pot @@ -2,20 +2,20 @@ # This file is distributed under the GPLv3. msgid "" msgstr "" -"Project-Id-Version: WP Cron Action Schedular 1.0.6\n" +"Project-Id-Version: Advanced Cron Scheduler 1.0.7\n" "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/migrate-wp-cron-to-action-scheduler\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"POT-Creation-Date: 2022-06-24T11:50:41+00:00\n" +"POT-Creation-Date: 2022-06-24T14:47:02+00:00\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "X-Generator: WP-CLI 2.5.0\n" "X-Domain: migrate-wp-cron-to-action-scheduler\n" #. Plugin Name of the plugin -msgid "WP Cron Action Schedular" +msgid "Advanced Cron Scheduler" msgstr "" #. Plugin URI of the plugin @@ -23,7 +23,7 @@ msgid "https://wordpress.org/plugins/migrate-wp-cron-to-action-scheduler/" msgstr "" #. Description of the plugin -msgid "The WP Cron Action Schedular plugin helps to easily replace or migrate Native WordPress Cron to the Action Scheduler Library." +msgid "The Advanced Cron Scheduler plugin helps to easily replace or migrate Native WordPress Cron to the Action Scheduler Library." msgstr "" #. Author of the plugin @@ -51,53 +51,37 @@ msgid "GitHub" msgstr "" #. translators: %s: Plugin Name -#: includes/Base/AdminNotice.php:42 +#: includes/Base/AdminNotice.php:46 msgid "Your version of WordPress is below the minimum version of WordPress required by %s plugin. Please upgrade WordPress to 5.2.0 or later." msgstr "" #. translators: %s: Plugin Name -#: includes/Base/AdminNotice.php:50 +#: includes/Base/AdminNotice.php:57 msgid "Your version of PHP is below the minimum version of PHP required by %s plugin. Please contact your host and request that your version be upgraded to 5.6 or later." msgstr "" #. translators: %s: Plugin Name -#: includes/Base/AdminNotice.php:59 +#: includes/Base/AdminNotice.php:66 msgid "Thanks for installing %1$s v%2$s plugin. Click here to view Action Scheduler tasks." msgstr "" -#: includes/Base/DonateNotice.php:48 -msgid "Hey, I noticed you've been using WP Cron Action Schedular for more than 2 week – that’s awesome! If you like WP Cron Action Schedular and you are satisfied with the plugin, isn’t that worth a coffee or two? Please consider donating. Donations help me to continue support and development of this free plugin! Thank you very much!" -msgstr "" - -#: includes/Base/DonateNotice.php:49 -msgid "Donate Now" +#: includes/Base/AdminNotice.php:84 +msgid "Ok, you deserve it" msgstr "" -#: includes/Base/DonateNotice.php:50 -msgid "I already donated" +#: includes/Base/AdminNotice.php:85 +msgid "I already did" msgstr "" -#: includes/Base/DonateNotice.php:51 -#: includes/Base/RatingNotice.php:52 +#: includes/Base/AdminNotice.php:86 +#: includes/Base/AdminNotice.php:106 msgid "Nope, maybe later" msgstr "" -#: includes/Base/DonateNotice.php:52 -msgid "I don't want to donate" -msgstr "" - -#: includes/Base/RatingNotice.php:49 -msgid "Hey, I noticed you've been using WP Cron Action Schedular for more than 1 week – that’s awesome! Could you please do me a BIG favor and give it a 5-star rating on WordPress? Just to help us spread the word and boost my motivation." -msgstr "" - -#: includes/Base/RatingNotice.php:50 -msgid "Ok, you deserve it" -msgstr "" - -#: includes/Base/RatingNotice.php:51 -msgid "I already did" +#: includes/Base/AdminNotice.php:104 +msgid "Donate Now" msgstr "" -#: includes/Base/RatingNotice.php:53 -msgid "I don't want to rate" +#: includes/Base/AdminNotice.php:105 +msgid "I already donated" msgstr "" diff --git a/migrate-wp-cron-to-action-scheduler.php b/migrate-wp-cron-to-action-scheduler.php index b233c8d..41e6e23 100644 --- a/migrate-wp-cron-to-action-scheduler.php +++ b/migrate-wp-cron-to-action-scheduler.php @@ -1,28 +1,28 @@ . + * along with Advanced Cron Scheduler. If not, see . * * @category Core - * @package WP Cron Action Schedular + * @package Advanced Cron Scheduler * @author Sayan Datta * @license http://www.gnu.org/licenses/ GNU General Public License * @link https://wordpress.org/plugins/migrate-wp-cron-to-action-scheduler/ @@ -34,6 +34,10 @@ exit; } +if ( ! defined( 'ACS_PLUGIN_VERSION' ) ) { + define( 'ACS_PLUGIN_VERSION', '1.0.7' ); +} + // Require once the Composer Autoload if ( file_exists( dirname( __FILE__ ) . '/vendor/autoload.php' ) ) { require_once dirname( __FILE__ ) . '/vendor/autoload.php'; @@ -42,31 +46,31 @@ /** * The code that runs during plugin activation */ -if ( ! function_exists( 'mwpcac_plugin_activation' ) ) { - function mwpcac_plugin_activation() { - Mwpcac\Base\Activate::activate(); +if ( ! function_exists( 'acswp_plugin_activation' ) ) { + function acswp_plugin_activation() { + ACSWP\Plugin\Base\Activate::activate(); } } -register_activation_hook( __FILE__, 'mwpcac_plugin_activation' ); +register_activation_hook( __FILE__, 'acswp_plugin_activation' ); /** * The code that runs during plugin deactivation */ -if ( ! function_exists( 'mwpcac_plugin_deactivation' ) ) { - function mwpcac_plugin_deactivation() { - Mwpcac\Base\Deactivate::deactivate(); +if ( ! function_exists( 'acswp_plugin_deactivation' ) ) { + function acswp_plugin_deactivation() { + ACSWP\Plugin\Base\Deactivate::deactivate(); } } -register_deactivation_hook( __FILE__, 'mwpcac_plugin_deactivation' ); +register_deactivation_hook( __FILE__, 'acswp_plugin_deactivation' ); /** * Initialize all the core classes of the plugin */ -if ( ! function_exists( 'mwpcac_plugin_init' ) ) { - function mwpcac_plugin_init() { - if ( class_exists( 'Mwpcac\\Loader' ) ) { - Mwpcac\Loader::register_services(); +if ( ! function_exists( 'acswp_plugin_init' ) ) { + function acswp_plugin_init() { + if ( class_exists( 'ACSWP\Plugin\\Loader' ) ) { + ACSWP\Plugin\Loader::register_services(); } } } -mwpcac_plugin_init(); \ No newline at end of file +acswp_plugin_init(); \ No newline at end of file diff --git a/readme.txt b/readme.txt index b887680..016b49c 100644 --- a/readme.txt +++ b/readme.txt @@ -1,15 +1,15 @@ -=== WP Cron Action Schedular === +=== Advanced Cron Scheduler for WordPress === Contributors: Infosatech Tags: scheduler, cron, wp cron, debug, cron manager Requires at least: 5.2 Tested up to: 6.0 -Stable tag: 1.0.6 +Stable tag: 1.0.7 Requires PHP: 5.6 Donate link: https://www.paypal.me/iamsayan/ License: GPLv3 License URI: http://www.gnu.org/licenses/gpl.html -The WP Cron Action Schedular plugin helps to easily replace or migrate Native WordPress Cron to the Action Scheduler Library. +The Advanced Cron Scheduler for WordPress plugin helps to easily replace or migrate Native WordPress Cron to the Action Scheduler Library. == Description == @@ -26,7 +26,7 @@ The WP-Cron system in WordPress is not a "real" cron system, which means events * Long-running events may temporarily block the event runner * High traffic websites may suffer from sequential processing issues that block the event runner -The WP Cron Action Schedular plugin does alter the way that WordPress core runs cron events using the Action Scheduler Library. +The Advanced Cron Scheduler for WordPress plugin does alter the way that WordPress core runs cron events using the Action Scheduler Library. Action Scheduler is a scalable, traceable job queue for background processing large sets of actions in WordPress. It's specially designed to be distributed in WordPress plugins. @@ -62,8 +62,8 @@ There you will find: ## Contribute -* Active development of this plugin is handled [on GitHub](https://github.com/iamsayan/migrate-wp-cron-to-action-scheduler/). -* Feel free to [fork the project on GitHub](https://github.com/iamsayan/migrate-wp-cron-to-action-scheduler/) and submit your contributions via pull request. +* Active development of this plugin is handled [on GitHub](https://github.com/iamsayan/advanced-cron-scheduler/). +* Feel free to [fork the project on GitHub](https://github.com/iamsayan/advanced-cron-scheduler/) and submit your contributions via pull request. ## Credits @@ -72,9 +72,9 @@ Action Scheduler is developed and maintained by [Automattic](http://automattic.c == Installation == 1. Visit 'Plugins > Add New' -2. Search for 'WP Cron Action Schedular' and install it. +2. Search for 'Advanced Cron Scheduler' and install it. 3. Or you can upload the `migrate-wp-cron-to-action-scheduler` folder to the `/wp-content/plugins/` directory manually. -4. Activate WP Cron Action Schedular from your Plugins page. +4. Activate Advanced Cron Scheduler from your Plugins page. 5. After activation go to 'Tools > Scheduled Actions'. == Frequently Asked Questions == @@ -85,7 +85,7 @@ To Avoid all limitations of WP Cron, this plugin automatically replaces all the = Will it work with my theme? = -Yes, our plugins work independently of themes you are using. As long as your website is running on WordPress version 5.1 or later, it will work. +Yes, our plugins work independently of themes you are using. As long as your website is running on WordPress version 5.2 or later, it will work. == Screenshots == @@ -93,7 +93,13 @@ Yes, our plugins work independently of themes you are using. As long as your web == Changelog == -If you like WP Cron Action Schedular, please take a moment to [give a 5-star rating](https://wordpress.org/support/plugin/migrate-wp-cron-to-action-scheduler/reviews/#new-post). It helps to keep development and support going strong. Thank you! +If you like Advanced Cron Scheduler, please take a moment to [give a 5-star rating](https://wordpress.org/support/plugin/migrate-wp-cron-to-action-scheduler/reviews/#new-post). It helps to keep development and support going strong. Thank you! + += 1.0.7 = +Release Date: 24th June, 2022 + +* Removed: Unused code. +* Fixed: Typo. = 1.0.6 = Release Date: 24th June, 2022 @@ -106,7 +112,7 @@ Release Date: 24th June, 2022 = 1.0.5 = Release Date: 3rd December, 2021 -* Fixed: An errors which occurs if cron is creating early before initialization of Action schedular library. +* Fixed: An errors which occurs if cron is creating early before initialization of Action scheduler library. = 1.0.4 = Release Date: 2nd December, 2021 diff --git a/vendor/composer/autoload_classmap.php b/vendor/composer/autoload_classmap.php index 0a9924e..5aae49c 100644 --- a/vendor/composer/autoload_classmap.php +++ b/vendor/composer/autoload_classmap.php @@ -6,20 +6,17 @@ $baseDir = dirname($vendorDir); return array( + 'ACSWP\\Plugin\\Base\\Actions' => $baseDir . '/includes/Base/Actions.php', + 'ACSWP\\Plugin\\Base\\Activate' => $baseDir . '/includes/Base/Activate.php', + 'ACSWP\\Plugin\\Base\\AdminNotice' => $baseDir . '/includes/Base/AdminNotice.php', + 'ACSWP\\Plugin\\Base\\BaseController' => $baseDir . '/includes/Base/BaseController.php', + 'ACSWP\\Plugin\\Base\\Deactivate' => $baseDir . '/includes/Base/Deactivate.php', + 'ACSWP\\Plugin\\Base\\Localization' => $baseDir . '/includes/Base/Localization.php', + 'ACSWP\\Plugin\\Core\\Connection' => $baseDir . '/includes/Core/Connection.php', + 'ACSWP\\Plugin\\Core\\MigrateActions' => $baseDir . '/includes/Core/MigrateActions.php', + 'ACSWP\\Plugin\\Helpers\\HelperFunctions' => $baseDir . '/includes/Helpers/HelperFunctions.php', + 'ACSWP\\Plugin\\Helpers\\Hooker' => $baseDir . '/includes/Helpers/Hooker.php', + 'ACSWP\\Plugin\\Helpers\\Scheduler' => $baseDir . '/includes/Helpers/Scheduler.php', + 'ACSWP\\Plugin\\Loader' => $baseDir . '/includes/Loader.php', 'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php', - 'Mwpcac\\Base\\Actions' => $baseDir . '/includes/Base/Actions.php', - 'Mwpcac\\Base\\Activate' => $baseDir . '/includes/Base/Activate.php', - 'Mwpcac\\Base\\AdminNotice' => $baseDir . '/includes/Base/AdminNotice.php', - 'Mwpcac\\Base\\BaseController' => $baseDir . '/includes/Base/BaseController.php', - 'Mwpcac\\Base\\Deactivate' => $baseDir . '/includes/Base/Deactivate.php', - 'Mwpcac\\Base\\DonateNotice' => $baseDir . '/includes/Base/DonateNotice.php', - 'Mwpcac\\Base\\Localization' => $baseDir . '/includes/Base/Localization.php', - 'Mwpcac\\Base\\RatingNotice' => $baseDir . '/includes/Base/RatingNotice.php', - 'Mwpcac\\Core\\Connection' => $baseDir . '/includes/Core/Connection.php', - 'Mwpcac\\Core\\MigrateActions' => $baseDir . '/includes/Core/MigrateActions.php', - 'Mwpcac\\Helpers\\HelperFunctions' => $baseDir . '/includes/Helpers/HelperFunctions.php', - 'Mwpcac\\Helpers\\Hooker' => $baseDir . '/includes/Helpers/Hooker.php', - 'Mwpcac\\Helpers\\Schedular' => $baseDir . '/includes/Helpers/Schedular.php', - 'Mwpcac\\Loader' => $baseDir . '/includes/Loader.php', - 'Mwpcac\\Tools\\DatabaseTable' => $baseDir . '/includes/Tools/DatabaseTable.php', ); diff --git a/vendor/composer/autoload_files.php b/vendor/composer/autoload_files.php index 719cab7..7ac524f 100644 --- a/vendor/composer/autoload_files.php +++ b/vendor/composer/autoload_files.php @@ -6,5 +6,5 @@ $baseDir = dirname($vendorDir); return array( - '62ef5cb38872bf3bcee7b3fb2b386395' => $vendorDir . '/woocommerce/action-scheduler/action-scheduler.php', + '8cd7f51cf36fd92d77543838a7a7b6f0' => $vendorDir . '/woocommerce/action-scheduler/action-scheduler.php', ); diff --git a/vendor/composer/autoload_psr4.php b/vendor/composer/autoload_psr4.php index 6d854c5..4cd4f6e 100644 --- a/vendor/composer/autoload_psr4.php +++ b/vendor/composer/autoload_psr4.php @@ -6,5 +6,5 @@ $baseDir = dirname($vendorDir); return array( - 'Mwpcac\\' => array($baseDir . '/includes'), + 'ACSWP\\Plugin\\' => array($baseDir . '/includes'), ); diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index f262924..45c2658 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -7,40 +7,37 @@ class ComposerStaticInit89768520ea85c32bebf6f7d5c391bf98 { public static $files = array ( - '62ef5cb38872bf3bcee7b3fb2b386395' => __DIR__ . '/..' . '/woocommerce/action-scheduler/action-scheduler.php', + '8cd7f51cf36fd92d77543838a7a7b6f0' => __DIR__ . '/..' . '/woocommerce/action-scheduler/action-scheduler.php', ); public static $prefixLengthsPsr4 = array ( - 'M' => + 'A' => array ( - 'Mwpcac\\' => 7, + 'ACSWP\\Plugin\\' => 13, ), ); public static $prefixDirsPsr4 = array ( - 'Mwpcac\\' => + 'ACSWP\\Plugin\\' => array ( 0 => __DIR__ . '/../..' . '/includes', ), ); public static $classMap = array ( + 'ACSWP\\Plugin\\Base\\Actions' => __DIR__ . '/../..' . '/includes/Base/Actions.php', + 'ACSWP\\Plugin\\Base\\Activate' => __DIR__ . '/../..' . '/includes/Base/Activate.php', + 'ACSWP\\Plugin\\Base\\AdminNotice' => __DIR__ . '/../..' . '/includes/Base/AdminNotice.php', + 'ACSWP\\Plugin\\Base\\BaseController' => __DIR__ . '/../..' . '/includes/Base/BaseController.php', + 'ACSWP\\Plugin\\Base\\Deactivate' => __DIR__ . '/../..' . '/includes/Base/Deactivate.php', + 'ACSWP\\Plugin\\Base\\Localization' => __DIR__ . '/../..' . '/includes/Base/Localization.php', + 'ACSWP\\Plugin\\Core\\Connection' => __DIR__ . '/../..' . '/includes/Core/Connection.php', + 'ACSWP\\Plugin\\Core\\MigrateActions' => __DIR__ . '/../..' . '/includes/Core/MigrateActions.php', + 'ACSWP\\Plugin\\Helpers\\HelperFunctions' => __DIR__ . '/../..' . '/includes/Helpers/HelperFunctions.php', + 'ACSWP\\Plugin\\Helpers\\Hooker' => __DIR__ . '/../..' . '/includes/Helpers/Hooker.php', + 'ACSWP\\Plugin\\Helpers\\Scheduler' => __DIR__ . '/../..' . '/includes/Helpers/Scheduler.php', + 'ACSWP\\Plugin\\Loader' => __DIR__ . '/../..' . '/includes/Loader.php', 'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php', - 'Mwpcac\\Base\\Actions' => __DIR__ . '/../..' . '/includes/Base/Actions.php', - 'Mwpcac\\Base\\Activate' => __DIR__ . '/../..' . '/includes/Base/Activate.php', - 'Mwpcac\\Base\\AdminNotice' => __DIR__ . '/../..' . '/includes/Base/AdminNotice.php', - 'Mwpcac\\Base\\BaseController' => __DIR__ . '/../..' . '/includes/Base/BaseController.php', - 'Mwpcac\\Base\\Deactivate' => __DIR__ . '/../..' . '/includes/Base/Deactivate.php', - 'Mwpcac\\Base\\DonateNotice' => __DIR__ . '/../..' . '/includes/Base/DonateNotice.php', - 'Mwpcac\\Base\\Localization' => __DIR__ . '/../..' . '/includes/Base/Localization.php', - 'Mwpcac\\Base\\RatingNotice' => __DIR__ . '/../..' . '/includes/Base/RatingNotice.php', - 'Mwpcac\\Core\\Connection' => __DIR__ . '/../..' . '/includes/Core/Connection.php', - 'Mwpcac\\Core\\MigrateActions' => __DIR__ . '/../..' . '/includes/Core/MigrateActions.php', - 'Mwpcac\\Helpers\\HelperFunctions' => __DIR__ . '/../..' . '/includes/Helpers/HelperFunctions.php', - 'Mwpcac\\Helpers\\Hooker' => __DIR__ . '/../..' . '/includes/Helpers/Hooker.php', - 'Mwpcac\\Helpers\\Schedular' => __DIR__ . '/../..' . '/includes/Helpers/Schedular.php', - 'Mwpcac\\Loader' => __DIR__ . '/../..' . '/includes/Loader.php', - 'Mwpcac\\Tools\\DatabaseTable' => __DIR__ . '/../..' . '/includes/Tools/DatabaseTable.php', ); public static function getInitializer(ClassLoader $loader) From 0a5a42d4fbb8763b2ef9874da6dffd17073031d3 Mon Sep 17 00:00:00 2001 From: Sayan Datta Date: Fri, 24 Jun 2022 20:32:21 +0530 Subject: [PATCH 2/3] Add menu item --- includes/Base/Actions.php | 1 + includes/Core/AdminBar.php | 49 +++++++++++++++++++ includes/Loader.php | 1 + .../migrate-wp-cron-to-action-scheduler.pot | 10 +++- vendor/composer/autoload_classmap.php | 1 + vendor/composer/autoload_static.php | 1 + 6 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 includes/Core/AdminBar.php diff --git a/includes/Base/Actions.php b/includes/Base/Actions.php index 0b531b7..eacbce6 100644 --- a/includes/Base/Actions.php +++ b/includes/Base/Actions.php @@ -47,6 +47,7 @@ public function meta_links( $links, $file ) { $links[] = '' . __( 'Usage', 'migrate-wp-cron-to-action-scheduler' ) . ''; $links[] = '' . __( 'FAQ', 'migrate-wp-cron-to-action-scheduler' ) . ''; $links[] = '' . __( 'GitHub', 'migrate-wp-cron-to-action-scheduler' ) . ''; + $links[] = '' . __( 'Donate', 'migrate-wp-cron-to-action-scheduler' ) . ''; $links[] = '★★★★★'; } diff --git a/includes/Core/AdminBar.php b/includes/Core/AdminBar.php new file mode 100644 index 0000000..17fc4a2 --- /dev/null +++ b/includes/Core/AdminBar.php @@ -0,0 +1,49 @@ + + */ + +namespace ACSWP\Plugin\Core; + +use ACSWP\Plugin\Helpers\Hooker; +use ACSWP\Plugin\Helpers\HelperFunctions; + +defined( 'ABSPATH' ) || exit; + +/** + * Admin Bar class. + */ +class AdminBar +{ + use HelperFunctions, Hooker; + + /** + * Register functions. + */ + public function register() { + $this->action( 'admin_bar_menu', 'admin_bar' ); + } + + /** + * Add admin bar content. + */ + public function admin_bar( $wp_admin_bar ) { + $item = $this->do_filter( 'show_admin_bar_item', true ); + + if ( true === $item ) { + $args = array( + 'id' => 'acswp-link', + 'parent' => 'top-secondary', + 'title' => __( 'Tasks', 'migrate-wp-cron-to-action-scheduler' ), + 'href' => admin_url( 'tools.php?page=action-scheduler' ), + ); + + $wp_admin_bar->add_node( $args ); + } + } +} \ No newline at end of file diff --git a/includes/Loader.php b/includes/Loader.php index 6316adb..7a234d7 100644 --- a/includes/Loader.php +++ b/includes/Loader.php @@ -27,6 +27,7 @@ public static function get_services() { Base\Localization::class, Core\Connection::class, Core\MigrateActions::class, + Core\AdminBar::class, ]; return $services; diff --git a/languages/migrate-wp-cron-to-action-scheduler.pot b/languages/migrate-wp-cron-to-action-scheduler.pot index ae0bf2b..e763e31 100644 --- a/languages/migrate-wp-cron-to-action-scheduler.pot +++ b/languages/migrate-wp-cron-to-action-scheduler.pot @@ -9,7 +9,7 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"POT-Creation-Date: 2022-06-24T14:47:02+00:00\n" +"POT-Creation-Date: 2022-06-24T15:02:02+00:00\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "X-Generator: WP-CLI 2.5.0\n" "X-Domain: migrate-wp-cron-to-action-scheduler\n" @@ -50,6 +50,10 @@ msgstr "" msgid "GitHub" msgstr "" +#: includes/Base/Actions.php:50 +msgid "Donate" +msgstr "" + #. translators: %s: Plugin Name #: includes/Base/AdminNotice.php:46 msgid "Your version of WordPress is below the minimum version of WordPress required by %s plugin. Please upgrade WordPress to 5.2.0 or later." @@ -85,3 +89,7 @@ msgstr "" #: includes/Base/AdminNotice.php:105 msgid "I already donated" msgstr "" + +#: includes/Core/AdminBar.php:42 +msgid "Tasks" +msgstr "" diff --git a/vendor/composer/autoload_classmap.php b/vendor/composer/autoload_classmap.php index 5aae49c..451a716 100644 --- a/vendor/composer/autoload_classmap.php +++ b/vendor/composer/autoload_classmap.php @@ -12,6 +12,7 @@ 'ACSWP\\Plugin\\Base\\BaseController' => $baseDir . '/includes/Base/BaseController.php', 'ACSWP\\Plugin\\Base\\Deactivate' => $baseDir . '/includes/Base/Deactivate.php', 'ACSWP\\Plugin\\Base\\Localization' => $baseDir . '/includes/Base/Localization.php', + 'ACSWP\\Plugin\\Core\\AdminBar' => $baseDir . '/includes/Core/AdminBar.php', 'ACSWP\\Plugin\\Core\\Connection' => $baseDir . '/includes/Core/Connection.php', 'ACSWP\\Plugin\\Core\\MigrateActions' => $baseDir . '/includes/Core/MigrateActions.php', 'ACSWP\\Plugin\\Helpers\\HelperFunctions' => $baseDir . '/includes/Helpers/HelperFunctions.php', diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index 45c2658..7f341ce 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -31,6 +31,7 @@ class ComposerStaticInit89768520ea85c32bebf6f7d5c391bf98 'ACSWP\\Plugin\\Base\\BaseController' => __DIR__ . '/../..' . '/includes/Base/BaseController.php', 'ACSWP\\Plugin\\Base\\Deactivate' => __DIR__ . '/../..' . '/includes/Base/Deactivate.php', 'ACSWP\\Plugin\\Base\\Localization' => __DIR__ . '/../..' . '/includes/Base/Localization.php', + 'ACSWP\\Plugin\\Core\\AdminBar' => __DIR__ . '/../..' . '/includes/Core/AdminBar.php', 'ACSWP\\Plugin\\Core\\Connection' => __DIR__ . '/../..' . '/includes/Core/Connection.php', 'ACSWP\\Plugin\\Core\\MigrateActions' => __DIR__ . '/../..' . '/includes/Core/MigrateActions.php', 'ACSWP\\Plugin\\Helpers\\HelperFunctions' => __DIR__ . '/../..' . '/includes/Helpers/HelperFunctions.php', From 162dde5a53e97e9ba3b7917b862d4eed7cbadf6f Mon Sep 17 00:00:00 2001 From: Sayan Datta Date: Fri, 24 Jun 2022 20:33:33 +0530 Subject: [PATCH 3/3] Add changelog --- CHANGELOG.md | 1 + languages/migrate-wp-cron-to-action-scheduler.pot | 2 +- readme.txt | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 20b777c..e0a3eb1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ All notable changes to this project will be documented in this file. ## 1.0.7 Release Date: 24th June, 2022 +* Added: Admin Bar Link. * Removed: Unused code. * Fixed: Typo. diff --git a/languages/migrate-wp-cron-to-action-scheduler.pot b/languages/migrate-wp-cron-to-action-scheduler.pot index e763e31..5e3e669 100644 --- a/languages/migrate-wp-cron-to-action-scheduler.pot +++ b/languages/migrate-wp-cron-to-action-scheduler.pot @@ -9,7 +9,7 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"POT-Creation-Date: 2022-06-24T15:02:02+00:00\n" +"POT-Creation-Date: 2022-06-24T15:03:21+00:00\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "X-Generator: WP-CLI 2.5.0\n" "X-Domain: migrate-wp-cron-to-action-scheduler\n" diff --git a/readme.txt b/readme.txt index 016b49c..4e6f5b4 100644 --- a/readme.txt +++ b/readme.txt @@ -98,6 +98,7 @@ If you like Advanced Cron Scheduler, please take a moment to [give a 5-star rati = 1.0.7 = Release Date: 24th June, 2022 +* Added: Admin Bar Link. * Removed: Unused code. * Fixed: Typo.