/** * Do the deactivation. * * @param Activation $activation * @param string $nonce * * @return Activation * * @throws \InvalidArgumentException on error. */ public function do_deactivation(Activation $activation, $nonce) { if (!wp_verify_nonce($nonce, "itelic-remote-deactivate-{$activation->get_pk()}")) { throw new \InvalidArgumentException(__("Sorry, this page has expired. Please refresh and try again.", Plugin::SLUG)); } if (!current_user_can('manage_options')) { throw new \InvalidArgumentException(__("Sorry, you don't have permission to do this.", Plugin::SLUG)); } $activation->deactivate(); return $activation; }