PluginProbe ʕ •ᴥ•ʔ
WPForms – Easy Form Builder for WordPress – Contact Forms, Payment Forms, Surveys, & More / 1.10.0.5
WPForms – Easy Form Builder for WordPress – Contact Forms, Payment Forms, Surveys, & More v1.10.0.5
1.10.1.1 1.10.1 1.10.0.5 trunk 1.1.4 1.1.4.2 1.1.5 1.1.5.1 1.1.6 1.1.6.1 1.1.7 1.1.7.1 1.1.7.2 1.1.8 1.1.8.1 1.1.8.2 1.1.8.3 1.1.8.4 1.10.0.1 1.10.0.2 1.10.0.3 1.10.0.4 1.2.0 1.2.0.1 1.2.1 1.2.2 1.2.2.1 1.2.2.2 1.2.3 1.2.3.1 1.2.3.2 1.2.4 1.2.4.1 1.2.5 1.2.5.1 1.2.6 1.2.7 1.2.8 1.2.8.1 1.2.9 1.3.0 1.3.1 1.3.1.1 1.3.1.2 1.3.2 1.3.3 1.3.5 1.3.6 1.3.6.1 1.3.6.2 1.3.7.2 1.3.7.3 1.3.7.4 1.3.8 1.3.9.1 1.4.0.1 1.4.1.1 1.4.2 1.4.2.1 1.4.2.2 1.4.3 1.4.4 1.4.4.1 1.4.5 1.4.5.1 1.4.5.2 1.4.5.3 1.4.6 1.4.7.1 1.4.7.2 1.4.8.1 1.4.9 1.5.0.1 1.5.0.3 1.5.0.4 1.5.1 1.5.1.1 1.5.1.3 1.5.2.1 1.5.2.2 1.5.2.3 1.5.3 1.5.3.1 1.5.4.1 1.5.4.2 1.5.5 1.5.5.1 1.5.6 1.5.6.2 1.5.7 1.5.8.2 1.5.9.1 1.5.9.4 1.5.9.5 1.6.0.1 1.6.0.2 1.6.1 1.6.2.2 1.6.2.3 1.6.3.1 1.6.4 1.6.4.1 1.6.5 1.6.6 1.6.7 1.6.7.1 1.6.7.2 1.6.7.3 1.6.8 1.6.8.1 1.6.9 1.7.0 1.7.1.1 1.7.1.2 1.7.2 1.7.2.1 1.7.3 1.7.4 1.7.4.1 1.7.4.2 1.7.5.1 1.7.5.2 1.7.5.3 1.7.5.5 1.7.6 1.7.7 1.7.7.1 1.7.7.2 1.7.8 1.7.9 1.7.9.1 1.8.0.1 1.8.0.2 1.8.1.1 1.8.1.2 1.8.1.3 1.8.2.1 1.8.2.2 1.8.2.3 1.8.3 1.8.3.1 1.8.4 1.8.4.1 1.8.5.2 1.8.5.3 1.8.5.4 1.8.6.2 1.8.6.3 1.8.6.4 1.8.7.2 1.8.8.2 1.8.8.3 1.8.9.1 1.8.9.2 1.8.9.4 1.8.9.5 1.8.9.6 1.9.0.1 1.9.0.2 1.9.0.3 1.9.0.4 1.9.1.1 1.9.1.2 1.9.1.3 1.9.1.4 1.9.1.5 1.9.1.6 1.9.2.1 1.9.2.2 1.9.2.3 1.9.3.1 1.9.3.2 1.9.4.1 1.9.4.2 1.9.5 1.9.5.1 1.9.5.2 1.9.6 1.9.6.1 1.9.6.2 1.9.7.1 1.9.7.2 1.9.7.3 1.9.8.1 1.9.8.2 1.9.8.4 1.9.8.7 1.9.9.2 1.9.9.3 1.9.9.4
wpforms-lite / includes / admin / class-notices.php
wpforms-lite / includes / admin Last commit date
builder 2 weeks ago admin.php 2 weeks ago ajax-actions.php 8 months ago class-about.php 2 weeks ago class-editor.php 1 year ago class-menu.php 5 months ago class-notices.php 1 year ago class-review.php 5 months ago class-settings.php 9 months ago class-welcome.php 6 months ago settings-api.php 2 months ago
class-notices.php
140 lines
1 <?php
2
3 /**
4 * Admin notices, on the fly.
5 *
6 * @example
7 * WPForms_Admin_Notice::success( 'All is good!' );
8 *
9 * @example
10 * WPForms_Admin_Notice::warning( 'Do something please.' );
11 *
12 * @since 1.3.9
13 * @deprecated 1.7.2
14 */
15 class WPForms_Admin_Notice {
16
17 /**
18 * Single instance holder.
19 *
20 * @since 1.3.9
21 * @var mixed
22 */
23 private static $_instance = null;
24
25 /**
26 * Added notices.
27 *
28 * @since 1.3.9
29 * @var array
30 */
31 public $notices = [];
32
33 /**
34 * Get the instance.
35 *
36 * @since 1.3.9
37 * @return WPForms_Admin_Notice
38 */
39 public static function getInstance() {
40
41 if ( self::$_instance === null ) {
42 self::$_instance = new WPForms_Admin_Notice();
43 }
44
45 return self::$_instance;
46 }
47
48 /**
49 * Hook when called.
50 *
51 * @since 1.3.9
52 */
53 public function __construct() {
54
55 _deprecated_function( __METHOD__, '1.7.2 of the WPForms plugin' );
56
57 add_action( 'admin_notices', [ &$this, 'display' ] );
58 }
59
60 /**
61 * Display the notices.
62 *
63 * @since 1.3.9
64 */
65 public function display() {
66
67 // At least one WPForms capability is necessary to see admin notices.
68 if ( ! wpforms_current_user_can( 'any' ) ) {
69 return;
70 }
71
72 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
73 echo implode( ' ', $this->notices );
74 }
75
76 /**
77 * Add notice to instance property.
78 *
79 * @since 1.3.9
80 *
81 * @param string $message Message to display.
82 * @param string $type Type of the notice (default: '').
83 */
84 public static function add( $message, $type = '' ) {
85
86 _deprecated_function( __METHOD__, '1.7.2 of the WPForms plugin' );
87
88 $instance = self::getInstance();
89 $id = 'wpforms-notice-' . ( count( $instance->notices ) + 1 );
90 $type = ! empty( $type ) ? 'notice-' . $type : '';
91 $notice = sprintf( '<div class="notice wpforms-notice %s" id="%s">%s</div>', $type, $id, wpautop( $message ) );
92
93 $instance->notices[] = $notice;
94 }
95
96 /**
97 * Add Info notice.
98 *
99 * @since 1.3.9
100 *
101 * @param string $message Message to display.
102 */
103 public static function info( $message ) {
104 self::add( $message, 'info' );
105 }
106
107 /**
108 * Add Error notice.
109 *
110 * @since 1.3.9
111 *
112 * @param string $message Message to display.
113 */
114 public static function error( $message ) {
115 self::add( $message, 'error' );
116 }
117
118 /**
119 * Add Success notice.
120 *
121 * @since 1.3.9
122 *
123 * @param string $message Message to display.
124 */
125 public static function success( $message ) {
126 self::add( $message, 'success' );
127 }
128
129 /**
130 * Add Warning notice.
131 *
132 * @since 1.3.9
133 *
134 * @param string $message Message to display.
135 */
136 public static function warning( $message ) {
137 self::add( $message, 'warning' );
138 }
139 }
140