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

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