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

235 lines 7.0 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 40% Off" />
60 </a>
61 </div> -->
62 <div class="wc-install-body">
63 <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>
64 <div><?php _e('<strong>PostX - ⚡Flash Sale⚡</strong> is LIVE! Spend <strong style="color:#1cb53e;">25% LESS</strong> on Premium Features for a <strong>⏳LIMITED Time!</strong>', 'ultimate-post'); ?></div>
65 <a class="button button-primary button-hero ultp-btn-notice-pro" target="_blank" href="<?php echo ultimate_post()->get_premium_link(); ?>"><span class="dashicons dashicons-image-rotate"></span><?php _e('Get Now', 'ultimate-post'); ?></a>
66 </div>
67 </div>
68 <?php
69 }
70 }
71
72
73 /**
74 * Admin Notice CSS File
75 *
76 * @since v.1.0.0
77 * @param NULL
78 * @return STRING
79 */
80 public function ultp_notice_css() {
81 ?>
82 <style type="text/css">
83 .wc-install {
84 display: flex;
85 align-items: center;
86 background: #fff;
87 margin-top: 40px;
88 width: calc(100% - 50px);
89 /* width: calc(100% - 40px); */
90 border: 1px solid #ccd0d4;
91 /* padding: 8px 8px 4px 8px; */
92 padding: 12px 15px;
93 border-radius: 4px;
94 border-left: 3px solid #2271b1;
95 }
96 .wc-install img {
97 margin-right: 0;
98 max-width: 100%;
99 }
100 .wc-install-body {
101 -ms-flex: 1;
102 flex: 1;
103 position: relative;
104 }
105 .wc-install-body > div {
106 max-width: 450px;
107 margin-bottom: 20px;
108 }
109 .wc-install-body h3 {
110 margin-top: 0;
111 font-size: 24px;
112 margin-bottom: 15px;
113 }
114 .ultp-install-btn {
115 margin-top: 15px;
116 display: inline-block;
117 }
118 .wc-install .dashicons{
119 display: none;
120 animation: dashicons-spin 1s infinite;
121 animation-timing-function: linear;
122 }
123 .wc-install.loading .dashicons {
124 display: inline-block;
125 margin-top: 12px;
126 margin-right: 5px;
127 }
128 .ultp-pro-notice .wc-install-body h3 {
129 font-size: 20px;
130 margin-bottom: 5px;
131 }
132 .ultp-pro-notice .wc-install-body > div {
133 max-width: 800px;
134 margin-bottom: 10px;
135 }
136 .ultp-pro-notice .button-hero {
137 padding: 8px 14px !important;
138 min-height: inherit !important;
139 line-height: 1 !important;
140 /* background: #46b450; */
141 box-shadow: none;
142 border: none;
143 transition: 400ms;
144 }
145 .ultp-pro-notice .ultp-btn-notice-pro {
146 background: #2271b1;
147 color: #fff;
148 }
149 .ultp-pro-notice .ultp-btn-notice-pro:hover,
150 .ultp-pro-notice .ultp-btn-notice-pro:focus {
151 background: #185a8f;
152 }
153 .ultp-pro-notice .button-hero:hover,
154 .ultp-pro-notice .button-hero:focus {
155 /* background: #349a3d; */
156 border: none;
157 box-shadow: none;
158 }
159 @keyframes dashicons-spin {
160 0% {
161 transform: rotate( 0deg );
162 }
163 100% {
164 transform: rotate( 360deg );
165 }
166 }
167 .wc-dismiss-notice {
168 position: absolute;
169 text-decoration: none;
170 float: right;
171 right: 0px;
172 color: #787c82;
173 transition: 400ms;
174 top: 0px
175 }
176 .wc-dismiss-notice:hover {
177 color:red;
178 }
179 .wc-dismiss-notice .dashicons{
180 display: inline-block;
181 text-decoration: none;
182 animation: none;
183 font-size: 16px;
184 /* width: 25px;
185 height: 25px;
186 line-height: 25px;
187 border-radius: 100px;
188 background: #f81430; */
189 }
190 /* .wc-dismiss-notice:hover {
191 color: #fff;
192 } */
193 /* .wc-dismiss-notice:hover .dashicons{
194 background: #cc142a;
195 } */
196 </style>
197 <?php
198 }
199
200
201 /**
202 * Admin Notice JS File
203 *
204 * @since v.1.0.0
205 * @param NULL
206 * @return STRING
207 */
208 public function ultp_notice_js() { ?>
209 <script type="text/javascript">
210 jQuery(document).ready(function($){
211 'use strict';
212 // Dismiss notice
213 $(document).on('click', '.wc-dismiss-notice', function(e){
214 e.preventDefault();
215 const that = $(this);
216 $.ajax({
217 url: that.data('ajax'),
218 type: 'POST',
219 data: {
220 action: 'ultp_get_pro_notice',
221 wpnonce: that.data('security')
222 },
223 success: function (data) {
224 that.parents('.wc-install').hide("slow", function() { that.parents('.wc-install').remove(); });
225 },
226 error: function(xhr) {
227 console.log('Error occured. Please try again' + xhr.statusText + xhr.responseText );
228 },
229 });
230 });
231 });
232 </script>
233 <?php
234 }
235 }