';
}
return $html;
}
/**
* Renders the html for the notice.
*/
public function render() {
echo $this->get_rendered(); // phpcs:ignore
}
/**
* Gets the value of notice_key.
*
* @return string Returns the notice_key.
*/
public function get_notice_key() {
return $this->notice_key;
}
/**
* Gets the nonce for the Notice. This is used for testing.
*
* @return string Returns the nonce.
*/
public function get_nonce() {
return $this->nonce;
}
/**
* Gets the value of message.
*
* @return string Returns the Notice message.
*/
public function get_message() {
return $this->message;
}
/**
* Gets the value of type.
*
* @return string Returns the Notice type.
*/
public function get_type() {
return $this->type;
}
/**
* Gets the value of dismissible.
*
* @return string Returns whether or not the Notice is dismissible.
*/
public function is_dismissible() {
return $this->dismissible;
}
/**
* Converts the class into an array for inserting into a WordPress option.
*
* @returns array Returns an array representation of the object.
*/
public function to_array() {
$data_array = array(
'notice_key' => $this->notice_key,
'message' => $this->message,
'type' => $this->type,
'dismissible' => $this->dismissible,
'remind_when' => $this->remind_when,
'cta_text' => $this->cta_text,
'cta_url' => $this->cta_url,
);
return $data_array;
}
/**
* Returns whether or not the notice is dismissed.
*
* @return boolean Whether or not the notice is dismissed.
*/
public function is_dismissed() {
$ret = false;
$dismissals = get_option( ADPLUGG_NOTICES_DISMISSED_NAME, array() );
if ( array_key_exists( $this->notice_key, $dismissals ) ) {
$remind_on = $dismissals[ $this->notice_key ];
if ( null !== $remind_on ) {
if ( $remind_on > time() ) {
$ret = true;
}
} else {
$ret = true;
}
}
return $ret;
}
}