PluginProbe
Post Grid Gutenberg Blocks – PostX / 2.1.2
Post Grid Gutenberg Blocks – PostX v2.1.2
5.0.39 5.0.38 5.0.37 5.0.36 5.0.35 5.0.34 5.0.33 5.0.32 5.0.31 5.0.30 5.0.29 5.0.28 5.0.27 5.0.26 5.0.25 5.0.23 5.0.24 5.0.22 5.0.21 5.0.20 5.0.19 5.0.18 5.0.17 2.1.1 2.1.2 All 237 releases
ultimate-post / classes / Notice.php

Notice.php in Post Grid Gutenberg Blocks – PostX 2.1.2, at classes/Notice.php

171 lines 5.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace ULTP;
3 defined('ABSPATH') || exit;
4 class Notice {
5 public function __construct(){
6 add_action('admin_notices', array($this, 'ultp_installation_notice_callback'));
7 add_action('wp_ajax_ultp_get_pro_notice', array($this, 'set_dismiss_notice_callback'));
8 }
9 // Dismiss Notice Callback
10 public function set_dismiss_notice_callback() {
11 if (!wp_verify_nonce($_REQUEST['wpnonce'], 'ultp-free-nonce')) {
12 return ;
13 }
14 set_transient( 'ultp_get_pro_notice_v7', 'off', 2592000 ); // 30 days notice
15 }
16 public function ultp_installation_notice_callback() {
17 if (get_transient('ultp_get_pro_notice_v7') != 'off' && (!defined('ULTP_PRO_VER'))) {
18 $this->ultp_notice_css();
19 $this->ultp_notice_js();
20 ?>
21 <div class="wc-install ultp-pro-notice">
22 <div class="wc-install-body">
23 <a class="wc-dismiss-notice" data-security=<?php echo wp_create_nonce('ultp-free-nonce'); ?> data-ajax=<?php echo admin_url('admin-ajax.php'); ?> href="#"><span class="dashicons dashicons-no-alt"></span></a>
24 <a style="line-height: 0;" target="_blank" href="https://www.wpxpo.com/gutenberg-post-blocks/?utm_campaign=go_premium"><img src="<?php echo ULTP_URL.'assets/img/banner.jpg'; ?>" alt="Offer" /></a>
25 </div>
26 </div>
27 <?php
28 }
29 }
30 public function ultp_notice_css() {
31 ?>
32 <style type="text/css">
33 .wc-install {
34 display: flex;
35 align-items: center;
36 background: #fff;
37 margin-top: 40px;
38 width: calc(100% - 40px);
39 border: 1px solid #ccd0d4;
40 padding: 8px 8px 4px 8px;
41 border-radius: 4px;
42 /* border-left: 4px solid #e5561e; */
43 }
44 .wc-install img {
45 margin-right: 0;
46 max-width: 100%;
47 }
48 .wc-install-body {
49 -ms-flex: 1;
50 flex: 1;
51 position: relative;
52 }
53 .wc-install-body > div {
54 max-width: 450px;
55 margin-bottom: 20px;
56 }
57 .wc-install-body h3 {
58 margin-top: 0;
59 font-size: 24px;
60 margin-bottom: 15px;
61 }
62 .ultp-install-btn {
63 margin-top: 15px;
64 display: inline-block;
65 }
66 .wc-install .dashicons{
67 display: none;
68 animation: dashicons-spin 1s infinite;
69 animation-timing-function: linear;
70 }
71 .wc-install.loading .dashicons {
72 display: inline-block;
73 margin-top: 12px;
74 margin-right: 5px;
75 }
76 .ultp-pro-notice .wc-install-body h3 {
77 font-size: 20px;
78 margin-bottom: 5px;
79 }
80 .ultp-pro-notice .wc-install-body > div {
81 max-width: 800px;
82 margin-bottom: 10px;
83 }
84 .ultp-pro-notice .button-hero {
85 padding: 8px 14px !important;
86 min-height: inherit !important;
87 line-height: 1 !important;
88 /* background: #46b450; */
89 box-shadow: none;
90 border: none;
91 transition: 400ms;
92 }
93 .ultp-pro-notice .ultp-btn-notice-pro {
94 background: #e5561e;
95 color: #fff;
96 }
97 .ultp-pro-notice .ultp-btn-notice-pro:hover,
98 .ultp-pro-notice .ultp-btn-notice-pro:focus {
99 background: #ce4b18;
100 }
101 .ultp-pro-notice .button-hero:hover,
102 .ultp-pro-notice .button-hero:focus {
103 /* background: #349a3d; */
104 border: none;
105 box-shadow: none;
106 }
107 @keyframes dashicons-spin {
108 0% {
109 transform: rotate( 0deg );
110 }
111 100% {
112 transform: rotate( 360deg );
113 }
114 }
115 .wc-dismiss-notice {
116 position: absolute;
117 text-decoration: none;
118 float: right;
119 right: 10px;
120 color: #ffffff;
121 transition: 400ms;
122 top: 10px
123 }
124 .wc-dismiss-notice .dashicons{
125 display: inline-block;
126 text-decoration: none;
127 animation: none;
128 font-size: 16px;
129 width: 25px;
130 height: 25px;
131 line-height: 25px;
132 border-radius: 100px;
133 background: #f81430;
134 }
135 .wc-dismiss-notice:hover {
136 color: #fff;
137 }
138 .wc-dismiss-notice:hover .dashicons{
139 background: #cc142a;
140 }
141 </style>
142 <?php
143 }
144 public function ultp_notice_js() { ?>
145 <script type="text/javascript">
146 jQuery(document).ready(function($){
147 'use strict';
148 // Dismiss notice
149 $(document).on('click', '.wc-dismiss-notice', function(e){
150 e.preventDefault();
151 const that = $(this);
152 $.ajax({
153 url: that.data('ajax'),
154 type: 'POST',
155 data: {
156 action: 'ultp_get_pro_notice',
157 wpnonce: that.data('security')
158 },
159 success: function (data) {
160 that.parents('.wc-install').hide("slow", function() { that.parents('.wc-install').remove(); });
161 },
162 error: function(xhr) {
163 console.log('Error occured. Please try again' + xhr.statusText + xhr.responseText );
164 },
165 });
166 });
167 });
168 </script>
169 <?php
170 }
171 }