/** * Display notices. * * @return void * @access public * @since 1.4.6 */ public function add_notices() { $messages = get_transient('charitable_settings_updated'); if (!$messages) { return; } $helper = charitable_get_admin_notices(); foreach ($messages as $notice) { $helper->render_notice($notice['message'], $notice['type'], $notice['dismissible']); } delete_transient('charitable_settings_updated'); }
/** * Sets the default gateway. * * @param string $gateway * @return void * @access protected * @since 1.0.0 */ protected function set_default_gateway($gateway) { $settings = get_option('charitable_settings'); $settings['default_gateway'] = $gateway; update_option('charitable_settings', $settings); charitable_get_admin_notices()->add_success(__('Default Gateway Updated', 'charitable')); do_action('charitable_set_gateway_gateway', $gateway); }
/** * Render notices. * * @return void * @access public * @since 1.4.6 */ public function render() { foreach (charitable_get_admin_notices()->get_notices() as $type => $notices) { foreach ($notices as $key => $notice) { $this->render_notice($notice['message'], $type, $notice['dismissible'], $key); } } }
/** * Add version update notices to the dashboard. * * @return void * @access public * @since 1.4.6 */ public function add_version_update_notices() { if (!current_user_can('manage_options')) { return; } $notices = array(); $notices['release-140'] = sprintf(__("Thanks for upgrading to Charitable 1.4. <a href='%s'>Find out what's new in this release</a>.", 'charitable'), 'https://www.wpcharitable.com/charitable-1-4-features-responsive-campaign-grids-a-new-shortcode?utm_source=notice&utm_medium=wordpress-dashboard&utm_campaign=release-notes&utm_content=release-140'); $notices['release-142'] = sprintf(__("In Charitable 1.4.2, we have improved the login and registration forms. <a href='%s'>Find out how</a>.", 'charitable'), 'https://www.wpcharitable.com/how-we-improved-logins-and-registrations-in-charitable/?utm_source=notice&utm_medium=wordpress-dashboard&utm_campaign=release-notes&utm_content=release-142'); if (Charitable_Gateways::get_instance()->is_active_gateway('paypal')) { $notices['release-143-paypal'] = sprintf(__("PayPal is upgrading its SSL certificates. <a href='%s'>Test your integration now to avoid disruption.</a>", 'charitable'), esc_url(add_query_arg(array('page' => 'charitable-settings', 'tab' => 'gateways', 'group' => 'gateways_paypal'), admin_url('admin.php#paypal-sandbox-test')))); } else { delete_transient('charitable_release-143-paypal_notice'); } $helper = charitable_get_admin_notices(); foreach ($notices as $notice => $message) { if (!get_transient('charitable_' . $notice . '_notice')) { continue; } $helper->add_version_update($message, $notice); } }