diff --git a/inc/class-refresh.php b/inc/class-refresh.php new file mode 100644 index 0000000..37d1649 --- /dev/null +++ b/inc/class-refresh.php @@ -0,0 +1,69 @@ +%s', + esc_url(add_query_arg([ + '_wpnonce' => wp_create_nonce(self::ACTION), + ], self::get_url())), + esc_html(Plugin::__('Refresh')) + )); + } + return $links; + } + + public function handle_action():void { + if (!current_user_can(self::CAPABILITY)) wp_die(Plugin::__('Invalid request.')); + check_admin_referer(self::ACTION); + + Sort::instance()->refresh_all(); + + wp_redirect(add_query_arg([ + self::ACTION => '1', + ], Settings::get_url())); + exit; + } + + public function handle_notices():void { + if (!current_user_can(self::CAPABILITY) || $_GET['page'] != Plugin::get_id() || !isset($_GET[self::ACTION])) return; + printf( + '
%s