| @@ -1,33 +1,90 @@ | ||
| 1 | 1 | <?php |
| 2 | +/** | |
| 3 | + * Notice Action. | |
| 4 | + * | |
| 5 | + * @package ULTP\Notice | |
| 6 | + * @since v.1.0.0 | |
| 7 | + */ | |
| 2 | 8 | namespace ULTP; |
| 9 | + | |
| 3 | 10 | defined('ABSPATH') || exit; |
| 11 | + | |
| 12 | +/** | |
| 13 | + * Notice class. | |
| 14 | + */ | |
| 4 | 15 | class Notice { |
| 16 | + /** | |
| 17 | + * Setup class. | |
| 18 | + * | |
| 19 | + * @since v.1.0.0 | |
| 20 | + */ | |
| 5 | 21 | 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')); | |
| 22 | + // add_action('admin_notices', array($this, 'ultp_installation_notice_callback')); | |
| 23 | + add_action('admin_init', array($this, 'set_dismiss_notice_callback')); | |
| 8 | 24 | } |
| 9 | - // Dismiss Notice Callback | |
| 25 | + | |
| 26 | + /** | |
| 27 | + * Promotional Dismiss Notice Option Data | |
| 28 | + * | |
| 29 | + * @since v.2.0.1 | |
| 30 | + * @param NULL | |
| 31 | + * @return NULL | |
| 32 | + */ | |
| 10 | 33 | public function set_dismiss_notice_callback() { |
| 11 | - if (!wp_verify_nonce($_REQUEST['wpnonce'], 'ultp-free-nonce')) { | |
| 34 | + if (!isset($_GET['disable_postx_notice_v1'])) { | |
| 12 | 35 | return ; |
| 13 | 36 | } |
| 14 | - set_transient( 'ultp_get_pro_notice_v7', 'off', 2592000 ); // 30 days notice | |
| 37 | + if (sanitize_key($_GET['disable_postx_notice_v1']) == 'yes') { | |
| 38 | + // set_transient( 'ultp_get_pro_notice_v6', 'off', 2592000 ); // 30 days notice | |
| 39 | + } | |
| 15 | 40 | } |
| 41 | + | |
| 42 | + /** | |
| 43 | + * Dismiss Notice HTML Data | |
| 44 | + * | |
| 45 | + * @since v.1.0.0 | |
| 46 | + * @param NULL | |
| 47 | + * @return STRING | |
| 48 | + */ | |
| 16 | 49 | public function ultp_installation_notice_callback() { |
| 17 | - if (get_transient('ultp_get_pro_notice_v7') != '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 | - </div> | |
| 26 | - </div> | |
| 27 | - <?php | |
| 50 | + if (get_transient('ultp_get_pro_notice_v6') != 'off') { | |
| 51 | + if (!ultimate_post()->is_lc_active()) { | |
| 52 | + if (!isset($_GET['disable_postx_notice_v1'])) { | |
| 53 | + $this->ultp_notice_css(); | |
| 54 | + ?> | |
| 55 | + <div class="wc-install ultp-pro-notice"> | |
| 56 | + <!-- <div class="wc-install-body ultp-image-banner"> | |
| 57 | + <a class="wc-dismiss-notice" href="<?php //echo esc_url( add_query_arg( 'disable_postx_notice_v1', 'yes' ) ); ?>"><span class="dashicons dashicons-dismiss"></span></a> | |
| 58 | + <a class="ultp-btn-image" target="_blank" href="<?php //echo esc_url(ultimate_post()->get_premium_link()); ?>"> | |
| 59 | + <img loading="lazy" src="<?php //echo esc_url(ULTP_URL.'assets/img/banner.jpg'); ?>" alt="up to 40% Off" /> | |
| 60 | + </a> | |
| 61 | + </div> --> | |
| 62 | + <!-- <div class="wc-install-body"> | |
| 63 | + <div><?php //wp_kses(__('<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'), 'post'); ?></div> | |
| 64 | + <a class="button button-primary button-hero ultp-btn-notice-pro" target="_blank" href="<?php //echo esc_url(ultimate_post()->get_premium_link()); ?>"><span class="dashicons dashicons-image-rotate"></span><?php //_e('Get Now', 'ultimate-post'); ?></a> | |
| 65 | + <a class="button-secondary button-large" href="<?php //echo esc_url( add_query_arg( 'disable_postx_notice_v1', 'yes' ) ); ?>"><?php //_e('No Thanks!', 'ultimate-post'); ?></a> | |
| 66 | + </div> --> | |
| 67 | + <div class="wc-install-body"> | |
| 68 | + <div><?php wp_kses(__("Be a part of <strong>PostX's</strong> 🍉 <strong style='color:#1cb53e;'>Summer Sale</strong> Celebration by Getting Up to 🔥 <strong>30% DISCOUNT</strong> on PostX! ", 'ultimate-post'), 'post'); ?></div> | |
| 69 | + <!-- <div><?php //wp_kses(__('Thanks for using the free version of <strong>PostX Gutenberg Blocks</strong>. We have a special <strong>20% discount</strong> for a limited time. Use this coupon:', 'ultimate-post'), 'post'); ?><strong><code>POSTXAD20</code></strong></div> --> | |
| 70 | + <a class="button button-primary button-hero ultp-btn-notice-pro" target="_blank" href="<?php echo esc_url(ultimate_post()->get_premium_link()); ?>"><span class="dashicons dashicons-image-rotate"></span><?php esc_html_e('Upgrading to Pro', 'ultimate-post'); ?></a> | |
| 71 | + <a class="button-secondary button-large" href="<?php echo esc_url( add_query_arg( 'disable_postx_notice_v1', 'yes' ) ); ?>"><?php esc_html_e('No Thanks / Close.', 'ultimate-post'); ?></a> | |
| 72 | + </div> | |
| 73 | + </div> | |
| 74 | + <?php | |
| 75 | + } | |
| 76 | + } | |
| 28 | 77 | } |
| 29 | 78 | } |
| 79 | + | |
| 80 | + /** | |
| 81 | + * Admin Notice CSS File | |
| 82 | + * | |
| 83 | + * @since v.1.0.0 | |
| 84 | + * @param NULL | |
| 85 | + * @return STRING | |
| 86 | + */ | |
| 30 | 87 | public function ultp_notice_css() { |
| 31 | 88 | ?> |
| 32 | 89 | <style type="text/css"> |
| 33 | 90 | .wc-install { |
| @@ -34,13 +91,13 @@ | ||
| 34 | 91 | display: flex; |
| 35 | 92 | align-items: center; |
| 36 | 93 | background: #fff; |
| 37 | 94 | margin-top: 40px; |
| 38 | - width: calc(100% - 40px); | |
| 95 | + width: calc(100% - 50px); | |
| 39 | 96 | border: 1px solid #ccd0d4; |
| 40 | - padding: 8px 8px 4px 8px; | |
| 97 | + padding: 12px 15px; | |
| 41 | 98 | border-radius: 4px; |
| 42 | - /* border-left: 4px solid #e5561e; */ | |
| 99 | + border-left: 3px solid #2271b1; | |
| 43 | 100 | } |
| 44 | 101 | .wc-install img { |
| 45 | 102 | margin-right: 0; |
| 46 | 103 | max-width: 100%; |
| @@ -49,12 +106,8 @@ | ||
| 49 | 106 | -ms-flex: 1; |
| 50 | 107 | flex: 1; |
| 51 | 108 | position: relative; |
| 52 | 109 | } |
| 53 | - .wc-install-body > div { | |
| 54 | - max-width: 450px; | |
| 55 | - margin-bottom: 20px; | |
| 56 | - } | |
| 57 | 110 | .wc-install-body h3 { |
| 58 | 111 | margin-top: 0; |
| 59 | 112 | font-size: 24px; |
| 60 | 113 | margin-bottom: 15px; |
| @@ -77,9 +130,9 @@ | ||
| 77 | 130 | font-size: 20px; |
| 78 | 131 | margin-bottom: 5px; |
| 79 | 132 | } |
| 80 | 133 | .ultp-pro-notice .wc-install-body > div { |
| 81 | - max-width: 800px; | |
| 134 | + max-width: 100%; | |
| 82 | 135 | margin-bottom: 10px; |
| 83 | 136 | } |
| 84 | 137 | .ultp-pro-notice .button-hero { |
| 85 | 138 | padding: 8px 14px !important; |
| @@ -84,24 +137,22 @@ | ||
| 84 | 137 | .ultp-pro-notice .button-hero { |
| 85 | 138 | padding: 8px 14px !important; |
| 86 | 139 | min-height: inherit !important; |
| 87 | 140 | line-height: 1 !important; |
| 88 | - /* background: #46b450; */ | |
| 89 | 141 | box-shadow: none; |
| 90 | 142 | border: none; |
| 91 | 143 | transition: 400ms; |
| 92 | 144 | } |
| 93 | 145 | .ultp-pro-notice .ultp-btn-notice-pro { |
| 94 | - background: #e5561e; | |
| 146 | + background: #2271b1; | |
| 95 | 147 | color: #fff; |
| 96 | 148 | } |
| 97 | 149 | .ultp-pro-notice .ultp-btn-notice-pro:hover, |
| 98 | 150 | .ultp-pro-notice .ultp-btn-notice-pro:focus { |
| 99 | - background: #ce4b18; | |
| 151 | + background: #185a8f; | |
| 100 | 152 | } |
| 101 | 153 | .ultp-pro-notice .button-hero:hover, |
| 102 | 154 | .ultp-pro-notice .button-hero:focus { |
| 103 | - /* background: #349a3d; */ | |
| 104 | 155 | border: none; |
| 105 | 156 | box-shadow: none; |
| 106 | 157 | } |
| 107 | 158 | @keyframes dashicons-spin { |
| @@ -115,57 +166,23 @@ | ||
| 115 | 166 | .wc-dismiss-notice { |
| 116 | 167 | position: absolute; |
| 117 | 168 | text-decoration: none; |
| 118 | 169 | float: right; |
| 119 | - right: 10px; | |
| 120 | - color: #ffffff; | |
| 170 | + right: 0px; | |
| 171 | + color: #787c82; | |
| 121 | 172 | transition: 400ms; |
| 122 | - top: 10px | |
| 173 | + top: 0px | |
| 123 | 174 | } |
| 175 | + .wc-dismiss-notice:hover { | |
| 176 | + color:red; | |
| 177 | + } | |
| 124 | 178 | .wc-dismiss-notice .dashicons{ |
| 125 | 179 | display: inline-block; |
| 126 | 180 | text-decoration: none; |
| 127 | 181 | animation: none; |
| 128 | 182 | font-size: 16px; |
| 129 | - width: 25px; | |
| 130 | - height: 25px; | |
| 131 | - line-height: 25px; | |
| 132 | - border-radius: 100px; | |
| 133 | - background: #f81430; | |
| 134 | 183 | } |
| 135 | - .wc-dismiss-notice:hover { | |
| 136 | - color: #fff; | |
| 137 | - } | |
| 138 | - .wc-dismiss-notice:hover .dashicons{ | |
| 139 | - background: #cc142a; | |
| 140 | - } | |
| 141 | 184 | </style> |
| 142 | 185 | <?php |
| 143 | 186 | } |
| 144 | - public function ultp_notice_js() { ?> | |
| 145 | - <script type="text/javascript"> | |
| 146 | - jQuery(document).ready(function($){ | |
| 147 | - 'use strict'; | |
| 148 | - // Dismiss notice | |
| 149 | - $(document).on('click', '.wc-dismiss-notice', function(e){ | |
| 150 | - e.preventDefault(); | |
| 151 | - const that = $(this); | |
| 152 | - $.ajax({ | |
| 153 | - url: that.data('ajax'), | |
| 154 | - type: 'POST', | |
| 155 | - data: { | |
| 156 | - action: 'ultp_get_pro_notice', | |
| 157 | - wpnonce: that.data('security') | |
| 158 | - }, | |
| 159 | - success: function (data) { | |
| 160 | - that.parents('.wc-install').hide("slow", function() { that.parents('.wc-install').remove(); }); | |
| 161 | - }, | |
| 162 | - error: function(xhr) { | |
| 163 | - console.log('Error occured. Please try again' + xhr.statusText + xhr.responseText ); | |
| 164 | - }, | |
| 165 | - }); | |
| 166 | - }); | |
| 167 | - }); | |
| 168 | - </script> | |
| 169 | - <?php | |
| 170 | - } | |
| 187 | + | |
| 171 | 188 | } |