PluginProbe
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) / 1.8.13
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) v1.8.13
1.8.13 1.8.12.3 1.8.12.2 1.8.12.1 1.8.12 1.8.11.3 1.8.11.2 1.8.11.1 1.8.11 1.6.6 1.6.60 1.6.7 1.6.8 1.6.9 1.7.0 1.7.0.1 1.7.0.11 1.7.0.12 1.7.0.14 1.7.0.2 1.7.0.3 1.7.0.5 1.7.0.6 1.7.0.7 1.7.0.9 All 211 releases
← All changes | includes/public/class-charitable-notices.php +39 -3 1.6.8 → 1.8.13 View file →
@@ -2,13 +2,13 @@
2 2 /**
3 3 * Contains the class that is used to register and retrieve notices like errors, warnings, success messages, etc.
4 4 *
5 5 * @package Charitable/Classes/Charitable_Notices
6 - * @author Eric Daams
7 - * @copyright Copyright (c) 2019, Studio 164a
6 + * @author David Bisset
7 + * @copyright Copyright (c) 2023, WP Charitable LLC
8 8 * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
9 9 * @since 1.0.0
10 - * @version 1.5.4
10 + * @version 1.6.37
11 11 */
12 12
13 13 // Exit if accessed directly.
14 14 if ( ! defined( 'ABSPATH' ) ) {
@@ -214,8 +214,44 @@
214 214 * @return array
215 215 */
216 216 public function get_notices() {
217 217 return $this->notices;
218 + }
219 +
220 + /**
221 + * Remove a notice, based on the text of the notice.
222 + *
223 + * @since 1.6.37
224 + *
225 + * @param string $text The text to search for. Regex supported.
226 + * @return void
227 + */
228 + public function clear_notice( $text ) {
229 + foreach ( $this->notices as $type => $notices ) {
230 + foreach ( $notices as $i => $notice_text ) {
231 + if ( $notice_text === $text || preg_match( $text, $notice_text ) ) {
232 + unset( $this->notices[ $type ][ $i ] );
233 + }
234 + }
235 + }
236 +
237 + charitable_get_session()->set( 'notices', $this->notices );
238 + }
239 +
240 + /**
241 + * Clear notices by type.
242 + *
243 + * @since 1.6.37
244 + *
245 + * @param string $type The type of notice.
246 + * @return void
247 + */
248 + public function clear_notices_by_type( $type ) {
249 + if ( array_key_exists( $type, $this->notices ) ) {
250 + $this->notices[ $type ] = array();
251 + }
252 +
253 + charitable_get_session()->set( 'notices', $this->notices );
218 254 }
219 255
220 256 /**
221 257 * Clear out all existing notices.