/** * Add custom action and nonce to URL. * * The function adds a custom action trigger using the wpas-do * URL parameter and adds a security nonce for plugin custom actions. * * @param string $url URL to customize * @param string $action Custom action to add * * @return string Customized URL * @since 3.0.0 */ function wpas_url_add_custom_action($url, $action) { return wpas_nonce_url(add_query_arg(array('wpas-do' => sanitize_text_field($action)), $url)); }
/** * Display all the custom notices * * @since 3.1.5 * @return void */ public function display_notices() { $notices = $this->get_notices(); if (empty($notices)) { return; } foreach ($this->get_notices() as $notice_id => $notice) { if (wpas_is_notice_dismissed($notice_id)) { continue; } $args = $_GET; $args['wpas-dismiss'] = $notice_id; $url = wpas_nonce_url(add_query_arg($args, '')); printf('<div class="%s"><p>%s <a href="%s"><small>(%s)</small></a></p></div>', $notice[0], $notice[1], esc_url($url), _x('Dismiss', 'Dismiss link for admin notices', 'awesome-support')); } }