PluginProbe
GutSlider – All in One Slider and Carousel Blocks for Gutenberg / 2.2.2
GutSlider – All in One Slider and Carousel Blocks for Gutenberg v2.2.2
3.1.0 3.0.0 2.13.2 2.13.1 2.13.0 trunk 1.0.0 2.1.0 2.10.0 2.10.1 2.11.0 2.11.1 2.11.2 2.11.3 2.11.4 2.12.0 2.2.1 2.2.2 2.3.0 2.4.0 2.5.1 2.5.3 2.5.4 2.5.5 2.6.1 All 56 releases
slider-blocks / admin / notice / notice.php

notice.php in GutSlider – All in One Slider and Carousel Blocks for Gutenberg 2.2.2, at admin/notice/notice.php

79 lines 2.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Admin notice
4 *
5 */
6 if ( ! defined( 'ABSPATH' ) ) exit; //exit if access directly
7
8 if( ! class_exists( 'GutSlider_Admin_Notice' ) ) {
9
10 class GutSlider_Admin_Notice {
11
12 /**
13 * Constructor
14 * return void
15 */
16 public function __construct() {
17 add_action( 'admin_notices', [ $this, 'admin_notice' ] );
18 add_action( 'admin_enqueue_scripts', [ $this, 'admin_scripts' ] );
19 add_action( 'wp_ajax_dismiss_gutslider_admin_notice', [ $this, 'dismiss_notice' ] );
20 }
21
22 /**
23 * Admin notice
24 * return void
25 */
26 public function admin_notice() {
27 $screen = get_current_screen();
28 if( $screen->id == 'plugins' ) {
29 $this->plugin_notice();
30 }
31 }
32
33 /**
34 * Plugin notice
35 * return void
36 */
37 public function plugin_notice() {
38 $notice = get_option( 'gutslider_notice' );
39 if( $notice ) return;
40 ?>
41 <div class="notice notice-success gutslider-notice">
42 <div class="gutslider-notice-content" style="padding: 10px;">
43 <p><b><?php _e('NOTE: ', 'slider-blocks') ?></b><?php _e( 'If you face any "Attempt to Block Recover" exception. Simply click on the "Attempt Block Recovery" button to recover. You will never need to do this in the future updates.', 'slider-blocks' ); ?></p>
44 <a href="https://youtu.be/uEuiQdj6M38" target="_blank" class="button button-primary"><?php _e( 'Watch Video', 'slider-blocks' ); ?></a>
45 <button id="gutslider_notice" class="button button-primary" style="background: #b32e2e; border-color: #b32e2e">
46 <?php _e('Close Notice', 'slider-blocks'); ?>
47 </button>
48 </div>
49 </div>
50 <?php
51 }
52
53 /**
54 * Admin scripts
55 * return void
56 */
57 public function admin_scripts( $screen ) {
58 if( $screen != 'plugins.php' ) return;
59 wp_enqueue_script( 'gutslider-admin-notice', trailingslashit( GUTSLIDER_URL ) . '/admin/notice/notice.js', [ 'jquery' ], GUTSLIDER_VERSION, true );
60 wp_localize_script( 'gutslider-admin-notice', 'gutslider_admin_notice', [
61 'ajaxurl' => admin_url( 'admin-ajax.php' ),
62 'nonce' => wp_create_nonce( 'gutslider_admin_notice_nonce' )
63 ] );
64 }
65
66 /**
67 * Dismiss notice
68 * return void
69 */
70 public function dismiss_notice() {
71 update_option( 'gutslider_notice', true );
72 wp_die();
73 }
74
75 }
76
77 }
78
79 new GutSlider_Admin_Notice(); // Initialize the class