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

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