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

178 lines 6.2 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_v9', 'off', 2592000 ); // 30 days notice
15 }
16 public function ultp_installation_notice_callback() {
17 if (get_transient('ultp_get_pro_notice_v9') != '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 -->
26 <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>
27 <div><?php _e('Want to help make <b>Gutenberg Post Blocks</b> even more awesome? You can get up to <b style="color:#e5561e;">40% Discount coupon</b> for all premium features.', 'ultimate-post'); ?></div>
28 <a class="button button-primary button-hero ultp-btn-notice-pro" target="_blank" href="https://www.wpxpo.com/gutenberg-post-blocks/?utm_campaign=go_premium"><span class="dashicons dashicons-image-rotate"></span><?php _e('Get Now', 'ultimate-post'); ?></a>
29
30 </div>
31 </div>
32 <?php
33 }
34 }
35 public function ultp_notice_css() {
36 ?>
37 <style type="text/css">
38 .wc-install {
39 display: flex;
40 align-items: center;
41 background: #fff;
42 margin-top: 40px;
43 width: calc(100% - 50px);
44 /* width: calc(100% - 40px); */
45 border: 1px solid #ccd0d4;
46 /* padding: 8px 8px 4px 8px; */
47 padding: 12px 15px;
48 border-radius: 4px;
49 border-left: 4px solid #e5561e;
50 }
51 .wc-install img {
52 margin-right: 0;
53 max-width: 100%;
54 }
55 .wc-install-body {
56 -ms-flex: 1;
57 flex: 1;
58 position: relative;
59 }
60 .wc-install-body > div {
61 max-width: 450px;
62 margin-bottom: 20px;
63 }
64 .wc-install-body h3 {
65 margin-top: 0;
66 font-size: 24px;
67 margin-bottom: 15px;
68 }
69 .ultp-install-btn {
70 margin-top: 15px;
71 display: inline-block;
72 }
73 .wc-install .dashicons{
74 display: none;
75 animation: dashicons-spin 1s infinite;
76 animation-timing-function: linear;
77 }
78 .wc-install.loading .dashicons {
79 display: inline-block;
80 margin-top: 12px;
81 margin-right: 5px;
82 }
83 .ultp-pro-notice .wc-install-body h3 {
84 font-size: 20px;
85 margin-bottom: 5px;
86 }
87 .ultp-pro-notice .wc-install-body > div {
88 max-width: 800px;
89 margin-bottom: 10px;
90 }
91 .ultp-pro-notice .button-hero {
92 padding: 8px 14px !important;
93 min-height: inherit !important;
94 line-height: 1 !important;
95 /* background: #46b450; */
96 box-shadow: none;
97 border: none;
98 transition: 400ms;
99 }
100 .ultp-pro-notice .ultp-btn-notice-pro {
101 background: #e5561e;
102 color: #fff;
103 }
104 .ultp-pro-notice .ultp-btn-notice-pro:hover,
105 .ultp-pro-notice .ultp-btn-notice-pro:focus {
106 background: #ce4b18;
107 }
108 .ultp-pro-notice .button-hero:hover,
109 .ultp-pro-notice .button-hero:focus {
110 /* background: #349a3d; */
111 border: none;
112 box-shadow: none;
113 }
114 @keyframes dashicons-spin {
115 0% {
116 transform: rotate( 0deg );
117 }
118 100% {
119 transform: rotate( 360deg );
120 }
121 }
122 .wc-dismiss-notice {
123 position: absolute;
124 text-decoration: none;
125 float: right;
126 right: 0px;
127 /* color: #ffffff; */
128 transition: 400ms;
129 top: 0px
130 }
131 .wc-dismiss-notice .dashicons{
132 display: inline-block;
133 text-decoration: none;
134 animation: none;
135 font-size: 20px;
136 /* width: 25px;
137 height: 25px;
138 line-height: 25px;
139 border-radius: 100px;
140 background: #f81430; */
141 }
142 /* .wc-dismiss-notice:hover {
143 color: #fff;
144 } */
145 /* .wc-dismiss-notice:hover .dashicons{
146 background: #cc142a;
147 } */
148 </style>
149 <?php
150 }
151 public function ultp_notice_js() { ?>
152 <script type="text/javascript">
153 jQuery(document).ready(function($){
154 'use strict';
155 // Dismiss notice
156 $(document).on('click', '.wc-dismiss-notice', function(e){
157 e.preventDefault();
158 const that = $(this);
159 $.ajax({
160 url: that.data('ajax'),
161 type: 'POST',
162 data: {
163 action: 'ultp_get_pro_notice',
164 wpnonce: that.data('security')
165 },
166 success: function (data) {
167 that.parents('.wc-install').hide("slow", function() { that.parents('.wc-install').remove(); });
168 },
169 error: function(xhr) {
170 console.log('Error occured. Please try again' + xhr.statusText + xhr.responseText );
171 },
172 });
173 });
174 });
175 </script>
176 <?php
177 }
178 }