$type, 'text' => $text, ]; set_transient('e2pdf_notifications', $notifications); } // get notifications public function get_notifications() { $notifications = get_transient('e2pdf_notifications'); if (!is_array($notifications)) { $notifications = []; } if (!get_option('e2pdf_hide_warnings', '0')) { if ($this->helper->get('license')->get('status') == 'pre_expired') { /* translators: %s: License Key Expire Date */ $message = sprintf(__('Your E2Pdf License Key will expire at %s', 'e2pdf'), $this->helper->get('license')->get('expire')); if (current_user_can('manage_options') || current_user_can('e2pdf_license')) { $message .= ' | ' . sprintf('%s »', 'https://e2pdf.com/checkout/license/renew/' . get_option('e2pdf_license'), __('Renew License Key', 'e2pdf')); } array_unshift( $notifications, [ 'type' => 'notice', 'text' => $message, ] ); } if ($this->helper->get('license')->get('status') == 'expired') { $message = __('Your E2Pdf License Key has expired', 'e2pdf'); if (current_user_can('manage_options') || current_user_can('e2pdf_license')) { $message .= ' | ' . sprintf('%s »', 'https://e2pdf.com/checkout/license/renew/' . get_option('e2pdf_license'), __('Renew License Key', 'e2pdf')); } array_unshift( $notifications, [ 'type' => 'error', 'text' => $message, ] ); } if ($this->helper->get('license')->get('type') == 'FREE' && $this->helper->get('page') == 'e2pdf-templates') { array_unshift( $notifications, [ 'type' => 'notice', 'text' => sprintf(__('You are using E2Pdf FREE License Type', 'e2pdf') . ' | ' . __('Up to 1 Page and up to 1 Template allowed', 'e2pdf') . ' | %s »', 'https://e2pdf.com/price', __('Upgrade License Key', 'e2pdf')), ] ); } } if ($this->helper->get('license')->get('error')) { foreach ($notifications as $key => $notify) { if ($notify['type'] === 'error' && $notify['text'] === $this->helper->get('license')->get('error')) { unset($notifications[$key]); } } if ($this->helper->get('license')->get('error') === 'License Key does not match this site. Please correct License Key to continue usage.') { $message = __('E2Pdf License Key does not match this site', 'e2pdf'); if (current_user_can('manage_options') || current_user_can('e2pdf_license')) { $message .= ' | ' . sprintf('%s »', wp_create_nonce('e2pdf_license'), __('Restore License Key', 'e2pdf')); } } else { $message = $this->helper->get('license')->get('error'); } array_unshift( $notifications, [ 'type' => 'error', 'text' => $message, ] ); } set_transient('e2pdf_notifications', []); return $notifications; } }