Esempio n. 1
0
 /**
  * Extend the key.
  *
  * @since 1.0
  *
  * @param Key    $key
  * @param string $nonce
  *
  * @return Key
  */
 public function do_extend(Key $key, $nonce)
 {
     if (!wp_verify_nonce($nonce, "itelic-extend-key-{$key->get_key()}")) {
         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));
     }
     $key->extend();
     return $key;
 }