PluginProbe
Post Grid Gutenberg Blocks – PostX / 2.4.13
Post Grid Gutenberg Blocks – PostX v2.4.13
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.4.13, at classes/Notice.php

237 lines 6.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Notice Action.
4 *
5 * @package ULTP\Notice
6 * @since v.1.0.0
7 */
8 namespace ULTP;
9
10 defined('ABSPATH') || exit;
11
12 /**
13 * Notice class.
14 */
15 class Notice {
16
17 /**
18 * Setup class.
19 *
20 * @since v.1.0.0
21 */
22 public function __construct(){
23 //add_action('admin_notices', array($this, 'ultp_installation_notice_callback'));
24 add_action('wp_ajax_ultp_get_pro_notice', array($this, 'set_dismiss_notice_callback'));
25 }
26
27
28 /**
29 * Promotional Dismiss Notice Option Data
30 *
31 * @since v.2.0.1
32 * @param NULL
33 * @return NULL
34 */
35 public function set_dismiss_notice_callback() {
36 if (!wp_verify_nonce($_REQUEST['wpnonce'], 'ultp-free-nonce')) {
37 return ;
38 }
39 set_transient( 'ultp_get_pro_notice_v2', 'off', 2592000 ); // 30 days notice
40 }
41
42
43 /**
44 * Dismiss Notice HTML Data
45 *
46 * @since v.1.0.0
47 * @param NULL
48 * @return STRING
49 */
50 public function ultp_installation_notice_callback() {
51 if (get_transient('ultp_get_pro_notice_v2') != 'off' && (!defined('ULTP_PRO_VER'))) {
52 $this->ultp_notice_css();
53 $this->ultp_notice_js();
54 ?>
55 <div class="wc-install ultp-pro-notice">
56 <div class="wc-install-body ultp-image-banner">
57 <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-dismiss"></span></a>
58 <a class="ultp-btn-image" target="_blank" href="<?php echo ultimate_post()->get_premium_link(); ?>">
59 <img loading="lazy" src="<?php echo ULTP_URL.'assets/img/banner.jpg'; ?>" alt="up to 30% Off" />
60 </a>
61 </div>
62 </div>
63 <?php
64 }
65 }
66
67
68 /**
69 * Admin Notice CSS File
70 *
71 * @since v.1.0.0
72 * @param NULL
73 * @return STRING
74 */
75 public function ultp_notice_css() {
76 ?>
77 <style type="text/css">
78 .wc-install {
79 display: flex;
80 align-items: center;
81 background: #fff;
82 margin-top: 40px;
83 width: calc(100% - 50px);
84 /* width: calc(100% - 40px); */
85 /* padding: 8px 8px 4px 8px; */
86 padding: 10px;
87 border-radius: 4px;
88 border-left: none;
89 border: 1px solid #ccd0d4;
90 }
91 .wc-install img {
92 margin-right: 0;
93 max-width: 100%;
94 }
95 .wc-install-body {
96 -ms-flex: 1;
97 flex: 1;
98 position: relative;
99 }
100 .wc-install-body > div {
101 max-width: 450px;
102 margin-bottom: 20px;
103 }
104 .ultp-btn-image,
105 .ultp-image-banner {
106 line-height: 0;
107 }
108 .wc-install-body h3 {
109 margin-top: 0;
110 font-size: 24px;
111 margin-bottom: 15px;
112 }
113 .ultp-install-btn {
114 margin-top: 15px;
115 display: inline-block;
116 }
117 .wc-install .dashicons{
118 display: none;
119 animation: dashicons-spin 1s infinite;
120 animation-timing-function: linear;
121 }
122 .wc-install.loading .dashicons {
123 display: inline-block;
124 margin-top: 12px;
125 margin-right: 5px;
126 }
127 .ultp-pro-notice .wc-install-body h3 {
128 font-size: 20px;
129 margin-bottom: 5px;
130 }
131 .ultp-pro-notice .wc-install-body > div {
132 max-width: 800px;
133 margin-bottom: 10px;
134 }
135 .ultp-pro-notice .button-hero {
136 padding: 8px 14px !important;
137 min-height: inherit !important;
138 line-height: 1 !important;
139 /* background: #46b450; */
140 box-shadow: none;
141 border: none;
142 transition: 400ms;
143 }
144 .ultp-pro-notice .ultp-btn-notice-pro {
145 background: #e5561e;
146 color: #fff;
147 }
148 .ultp-pro-notice .ultp-btn-notice-pro:hover,
149 .ultp-pro-notice .ultp-btn-notice-pro:focus {
150 background: #ce4b18;
151 }
152 .ultp-pro-notice .button-hero:hover,
153 .ultp-pro-notice .button-hero:focus {
154 /* background: #349a3d; */
155 border: none;
156 box-shadow: none;
157 }
158 @keyframes dashicons-spin {
159 0% {
160 transform: rotate( 0deg );
161 }
162 100% {
163 transform: rotate( 360deg );
164 }
165 }
166 .ultp-pro-notice .wc-dismiss-notice {
167 position: absolute;
168 text-decoration: none;
169 float: right;
170 right: -8px;
171 color: #ffffff;
172 transition: 400ms;
173 top: -8px;
174 background: #ef0f0f;
175 border-radius: 100px;
176 }
177 .ultp-pro-notice .wc-dismiss-notice:hover {
178 color: #fff;
179 background: #d20d0d;
180 }
181 .wc-dismiss-notice .dashicons{
182 display: inline-block;
183 text-decoration: none;
184 animation: none;
185 font-size: 20px;
186 /* width: 25px;
187 height: 25px;
188 line-height: 25px;
189 border-radius: 100px;
190 background: #f81430; */
191 }
192 /* .wc-dismiss-notice:hover {
193 color: #fff;
194 } */
195 /* .wc-dismiss-notice:hover .dashicons{
196 background: #cc142a;
197 } */
198 </style>
199 <?php
200 }
201
202
203 /**
204 * Admin Notice JS File
205 *
206 * @since v.1.0.0
207 * @param NULL
208 * @return STRING
209 */
210 public function ultp_notice_js() { ?>
211 <script type="text/javascript">
212 jQuery(document).ready(function($){
213 'use strict';
214 // Dismiss notice
215 $(document).on('click', '.wc-dismiss-notice', function(e){
216 e.preventDefault();
217 const that = $(this);
218 $.ajax({
219 url: that.data('ajax'),
220 type: 'POST',
221 data: {
222 action: 'ultp_get_pro_notice',
223 wpnonce: that.data('security')
224 },
225 success: function (data) {
226 that.parents('.wc-install').hide("slow", function() { that.parents('.wc-install').remove(); });
227 },
228 error: function(xhr) {
229 console.log('Error occured. Please try again' + xhr.statusText + xhr.responseText );
230 },
231 });
232 });
233 });
234 </script>
235 <?php
236 }
237 }