コード例 #1
0
 /**
  * Delete the activation.
  *
  * @param Activation $activation
  * @param string     $nonce
  *
  * @return bool
  *
  * @throws \InvalidArgumentException
  */
 public function do_delete(Activation $activation, $nonce)
 {
     if (!wp_verify_nonce($nonce, "itelic-remote-delete-{$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->delete();
     return true;
 }