PluginProbe ʕ •ᴥ•ʔ
Presto Player / 4.5.0
Presto Player v4.5.0
4.5.0 4.4.1 4.4.0 4.3.3 4.3.2 4.3.1 4.3.0 4.2.4 4.2.3 4.2.2 4.2.0 4.2.1 trunk 1.10.0 1.10.1 1.10.2 1.11.0 1.12.0 1.13.0 1.14.0 1.14.1 1.5.10 1.5.11 1.5.12 1.5.13 1.5.14 1.5.15 1.5.5 1.5.6 1.5.7 1.5.8 1.5.9 1.6.0 1.6.1 1.6.10 1.6.11 1.6.12 1.6.13 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 1.6.7 1.6.8 1.6.9 1.7.0 1.7.1 1.7.2 1.8.0 1.8.1 1.8.2 1.8.3 1.8.4 1.8.5 1.8.6 1.9.0 1.9.1 1.9.10 1.9.11 1.9.12 1.9.13 1.9.14 1.9.2 1.9.3 1.9.4 1.9.5 1.9.6 1.9.7 1.9.8 1.9.9 2.0.0 2.0.1 2.0.10 2.0.11 2.0.12 2.0.13 2.0.14 2.0.15 2.0.16 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 2.0.8 2.0.9 2.1.0 2.2.0 2.2.1 2.2.2 2.2.3 2.2.3-beta1 2.3.0 2.3.1 2.3.2 2.3.3 3.0.0 3.0.0-beta1 3.0.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.1.0 3.1.1 3.1.2 3.1.3 4.0.0 4.0.1 4.0.2 4.0.3 4.0.4 4.0.5 4.0.6 4.0.7 4.0.8 4.1.0 4.1.1 4.1.2 4.1.3 4.1.4
presto-player / inc / Services / AdminNotice.php
presto-player / inc / Services Last commit date
API 2 weeks ago Abilities 2 weeks ago Blocks 1 month ago License 1 month ago OAuth 2 weeks ago AdminNotice.php 2 months ago AdminNotices.php 2 months ago AjaxActions.php 2 months ago Blocks.php 2 years ago Compatibility.php 11 months ago FeatureAnnounce.php 1 day ago Learn.php 2 weeks ago Menu.php 2 weeks ago Migrations.php 2 years ago NpsSurvey.php 7 months ago Onboarding.php 2 months ago Player.php 1 month ago PluginInstaller.php 2 weeks ago PreloadService.php 2 years ago ProCompatibility.php 1 month ago ReusableVideos.php 2 months ago RewriteRulesManager.php 2 years ago Scripts.php 2 months ago Settings.php 3 months ago Shortcodes.php 2 weeks ago Streamer.php 2 months ago Translation.php 1 month ago Usage.php 1 day ago VideoPostType.php 1 month ago
AdminNotice.php
94 lines
1 <?php
2 /**
3 * Temporary admin notice service.
4 *
5 * @package PrestoPlayer
6 */
7
8 namespace PrestoPlayer\Services;
9
10 /**
11 * Stores and displays a one-time admin notice.
12 */
13 class AdminNotice {
14
15 const NOTICE_FIELD = 'presto_player_temp_admin_notice';
16
17 /**
18 * Display the stored admin notice, then remove it.
19 *
20 * @return void
21 */
22 public static function displayAdminNotice() {
23 $option = get_option( self::NOTICE_FIELD );
24 $message = isset( $option['message'] ) ? $option['message'] : false;
25 $notice_level = ! empty( $option['notice-level'] ) ? $option['notice-level'] : 'notice-error';
26
27 if ( $message ) {
28 printf(
29 '<div class="notice %s is-dismissible"><p>%s</p></div>',
30 esc_attr( $notice_level ),
31 wp_kses_post( $message )
32 );
33 delete_option( self::NOTICE_FIELD );
34 }
35 }
36
37 /**
38 * Queue an error notice.
39 *
40 * @param string $message Notice message.
41 * @return void
42 */
43 public static function displayError( $message ) {
44 self::updateOption( $message, 'notice-error' );
45 }
46
47 /**
48 * Queue a warning notice.
49 *
50 * @param string $message Notice message.
51 * @return void
52 */
53 public static function displayWarning( $message ) {
54 self::updateOption( $message, 'notice-warning' );
55 }
56
57 /**
58 * Queue an info notice.
59 *
60 * @param string $message Notice message.
61 * @return void
62 */
63 public static function displayInfo( $message ) {
64 self::updateOption( $message, 'notice-info' );
65 }
66
67 /**
68 * Queue a success notice.
69 *
70 * @param string $message Notice message.
71 * @return void
72 */
73 public static function displaySuccess( $message ) {
74 self::updateOption( $message, 'notice-success' );
75 }
76
77 /**
78 * Store the notice message and level for later display.
79 *
80 * @param string $message Notice message.
81 * @param string $notice_level Notice CSS level class.
82 * @return void
83 */
84 protected static function updateOption( $message, $notice_level ) {
85 update_option(
86 self::NOTICE_FIELD,
87 array(
88 'message' => $message,
89 'notice-level' => $notice_level,
90 )
91 );
92 }
93 }
94