| 1 |
<?php |
| 2 |
|
| 3 |
namespace WPAdminify\Inc\Admin; |
| 4 |
|
| 5 |
use WPAdminify\Inc\Utils ; |
| 6 |
use WPAdminify\Inc\Admin\AdminSettings ; |
| 7 |
/** |
| 8 |
* Author Name: Liton Arefin |
| 9 |
* Author URL: https://jeweltheme.com |
| 10 |
* Date: 25/07/2021 |
| 11 |
*/ |
| 12 |
if ( !defined( 'ABSPATH' ) ) { |
| 13 |
exit; |
| 14 |
} |
| 15 |
// No, Direct access Sir !!! |
| 16 |
class AdminifyPromo |
| 17 |
{ |
| 18 |
public $timenow ; |
| 19 |
private static $instance = null ; |
| 20 |
public static function get_instance() |
| 21 |
{ |
| 22 |
if ( !self::$instance ) { |
| 23 |
self::$instance = new self(); |
| 24 |
} |
| 25 |
return self::$instance; |
| 26 |
} |
| 27 |
|
| 28 |
public function __construct() |
| 29 |
{ |
| 30 |
if ( !is_admin() ) { |
| 31 |
return; |
| 32 |
} |
| 33 |
$this->options = (array) AdminSettings::get_instance()->get(); |
| 34 |
$this->timenow = strtotime( 'now' ); |
| 35 |
// Admin Notices |
| 36 |
add_action( 'admin_init', [ $this, 'jltwp_adminify_admin_notice_init' ] ); |
| 37 |
// Notices |
| 38 |
add_action( 'admin_notices', [ $this, 'jltwp_adminify_latest_update_details' ], 10 ); |
| 39 |
add_action( 'network_admin_notices', [ $this, 'jltwp_adminify_latest_update_details' ], 10 ); |
| 40 |
add_action( 'admin_notices', [ $this, 'jltwp_adminify_review_notice_generator' ], 10 ); |
| 41 |
add_action( 'admin_notices', [ $this, 'jltwp_adminify_upgrade_pro_notice_generator' ], 10 ); |
| 42 |
add_action( 'admin_notices', [ $this, 'jltwp_adminify_upgrade_pro_notice_popup' ], 10 ); |
| 43 |
// Black Friday & Cyber Monday Offer |
| 44 |
add_action( 'admin_notices', [ $this, 'jltwp_adminify_black_friday_cyber_monday_deals' ] ); |
| 45 |
// Halloween Offer |
| 46 |
add_action( 'admin_notices', [ $this, 'jltwp_adminify_halloween_deals' ] ); |
| 47 |
// Styles |
| 48 |
add_action( 'admin_print_styles', [ $this, 'jltwp_adminify_admin_notice_styles' ] ); |
| 49 |
} |
| 50 |
|
| 51 |
public function jltwp_adminify_admin_notice_init() |
| 52 |
{ |
| 53 |
add_action( 'wp_ajax_adminify_dismiss_admin_notice', [ $this, 'jltwp_adminify_dismiss_admin_notice' ] ); |
| 54 |
} |
| 55 |
|
| 56 |
public function jltwp_adminify_latest_update_details() |
| 57 |
{ |
| 58 |
if ( !self::is_admin_notice_active( 'wp-adminify-update-notice-forever' ) ) { |
| 59 |
return; |
| 60 |
} |
| 61 |
$jltwp_adminify_changelog_message = sprintf( |
| 62 |
__( '%3$s %4$s %5$s %6$s %7$s %8$s <br> <strong>Check Changelogs for </strong> <a href="%1$s" target="__blank">%2$s</a>', 'adminify' ), |
| 63 |
esc_url_raw( 'https://wpadminify.com/updates/v3-0-1' ), |
| 64 |
__( 'More Details', 'adminify' ), |
| 65 |
/** Changelog Items |
| 66 |
* Starts from: %3$s |
| 67 |
*/ |
| 68 |
'<h3 class="adminify-update-head">' . WP_ADMINIFY . ' <span><small><em>v' . esc_html( WP_ADMINIFY_VER ) . '</em></small>' . __( ' has some Major updates..', 'adminify' ) . '</span></h3><br>', |
| 69 |
// %3$s |
| 70 |
__( '<span class="dashicons dashicons-yes"></span> <span class="adminify-changes-list"> Dashboard left menu hover color issue fixed in dark mode </span><br>', 'adminify' ), |
| 71 |
__( '<span class="dashicons dashicons-yes"></span> <span class="adminify-changes-list"> Dashboard dismiss notice icon padding issue fixed </span><br>', 'adminify' ), |
| 72 |
__( '<span class="dashicons dashicons-yes"></span> <span class="adminify-changes-list"> Network site broken html and style issue fixed </span><br>', 'adminify' ), |
| 73 |
__( '<span class="dashicons dashicons-yes"></span> <span class="adminify-changes-list"> Dashboard body font selection not working issue fixed </span><br>', 'adminify' ), |
| 74 |
__( '<span class="dashicons dashicons-yes"></span> <span class="adminify-changes-list"> Rounded vertical menu color & bg color issue fixed </span><br>', 'adminify' ) |
| 75 |
); |
| 76 |
printf( wp_kses_post( '<div data-dismissible="wp-adminify-update-notice-forever" id="wp-adminify-notice-forever" class="wp-adminify-notice updated notice notice-success is-dismissible"><p>%1$s</p></div>' ), wp_kses_post( $jltwp_adminify_changelog_message ) ); |
| 77 |
} |
| 78 |
|
| 79 |
public function jltwp_adminify_admin_notice_ask_for_review( $notice_key ) |
| 80 |
{ |
| 81 |
if ( !self::is_admin_notice_active( $notice_key ) ) { |
| 82 |
return; |
| 83 |
} |
| 84 |
$this->jltwp_adminify_notice_header( $notice_key ); |
| 85 |
echo sprintf( |
| 86 |
wp_kses_post( '<p>Enjoying <strong>%1$s ?</strong></p> <p>Seems like you are enjoying <strong>%1$s</strong>. Would you please show us a little love by rating us on <a href="%2$s" target="_blank" style="background:yellow; padding:2px 5px;">%3$s?</a></p> |
| 87 |
<ul class="wp-adminify-review-ul"> |
| 88 |
<li><a href="%2$s" target="_blank" class="button adminify-sure-do-btn is-warning mt-4 upgrade-btn pt-1 pb-1 pr-4 pl-4" style="background-color: transparent; color: #fff;"><span class="dashicons dashicons-external" style="line-height:inherit"></span>Sure! I\'d love to!</a></li> |
| 89 |
<li><a href="#" target="_blank" class="adminify-notice-dismiss button upgrade-btn mt-4 pt-1 pb-1 pr-4 pl-4"><span class="dashicons dashicons-smiley" style="line-height:inherit"></span>I\'ve already left a review</a></li> |
| 90 |
<li><a href="#" target="_blank" class="adminify-notice-dismiss button is-danger upgrade-btn mt-4 pt-1 pb-1 pr-4 pl-4" style="background-color: #f14668 !important; color:#fff !important; border:1px solid #f14668;"><span class="dashicons dashicons-dismiss" style="line-height:inherit"></span>Never show again</a></li> |
| 91 |
</ul>' ), |
| 92 |
esc_html( WP_ADMINIFY ), |
| 93 |
esc_url_raw( 'https://wordpress.org/support/plugin/adminify/reviews/?filter=5' ), |
| 94 |
esc_html__( 'WordPress.org', 'adminify' ) |
| 95 |
) ; |
| 96 |
$this->jltwp_adminify_notice_footer(); |
| 97 |
} |
| 98 |
|
| 99 |
public function jltwp_adminify_crown_icon() |
| 100 |
{ |
| 101 |
$svg_icon = '<svg width="43" height="38" viewBox="0 0 43 38" fill="none" xmlns="http://www.w3.org/2000/svg"> |
| 102 |
<rect width="42.3448" height="38" rx="12" fill="url(#paint0_linear_3851_7357)"/> |
| 103 |
<path d="M28.4345 25.75H13.9103C13.6031 25.75 13.3517 26.0031 13.3517 26.3125V27.4375C13.3517 27.7469 13.6031 28 13.9103 28H28.4345C28.7417 28 28.9931 27.7469 28.9931 27.4375V26.3125C28.9931 26.0031 28.7417 25.75 28.4345 25.75ZM30.669 14.5C29.7438 14.5 28.9931 15.2559 28.9931 16.1875C28.9931 16.4371 29.049 16.6691 29.1467 16.8836L26.619 18.4094C26.0813 18.7328 25.3865 18.55 25.0758 18.0016L22.2303 12.9883C22.6039 12.6789 22.8483 12.2148 22.8483 11.6875C22.8483 10.7559 22.0976 10 21.1724 10C20.2472 10 19.4966 10.7559 19.4966 11.6875C19.4966 12.2148 19.741 12.6789 20.1145 12.9883L17.2691 18.0016C16.9583 18.55 16.26 18.7328 15.7259 18.4094L13.2016 16.8836C13.2959 16.6727 13.3552 16.4371 13.3552 16.1875C13.3552 15.2559 12.6046 14.5 11.6794 14.5C10.7541 14.5 10 15.2559 10 16.1875C10 17.1191 10.7506 17.875 11.6759 17.875C11.7666 17.875 11.8574 17.8609 11.9447 17.8469L14.469 24.625H27.8759L30.4001 17.8469C30.4874 17.8609 30.5782 17.875 30.669 17.875C31.5942 17.875 32.3448 17.1191 32.3448 16.1875C32.3448 15.2559 31.5942 14.5 30.669 14.5Z" fill="#FB0066"/> |
| 104 |
<defs> |
| 105 |
<linearGradient id="paint0_linear_3851_7357" x1="0" y1="0" x2="42.9298" y2="37.3272" gradientUnits="userSpaceOnUse"> |
| 106 |
<stop stop-color="#FFF3B4"/> |
| 107 |
<stop offset="1" stop-color="#FFFCF0" stop-opacity="0.35"/> |
| 108 |
</linearGradient> |
| 109 |
</defs> |
| 110 |
</svg>'; |
| 111 |
return $svg_icon; |
| 112 |
} |
| 113 |
|
| 114 |
public function jltwp_adminify_admin_upgrade_pro_notice_popup( $notice_key ) |
| 115 |
{ |
| 116 |
if ( !self::is_admin_notice_active( $notice_key ) ) { |
| 117 |
return; |
| 118 |
} |
| 119 |
// Place popup image here as well at the alt value. |
| 120 |
$campaign_image_data = [ |
| 121 |
'url' => esc_url( WP_ADMINIFY_ASSETS_IMAGE ) . 'popup.jpeg', |
| 122 |
'alt' => esc_html__( 'WP Adminify Pro', 'adminify' ), |
| 123 |
]; |
| 124 |
$this->jltwp_adminify_popup_header( $notice_key, $campaign_image_data ); |
| 125 |
?> |
| 126 |
|
| 127 |
<h4> <?php |
| 128 |
echo Utils::wp_kses_custom( $this->jltwp_adminify_crown_icon() ) ; |
| 129 |
?> <?php |
| 130 |
echo esc_html__( 'Upgrade to', 'adminify' ) ; |
| 131 |
?> </h4> |
| 132 |
<h3> |
| 133 |
<?php |
| 134 |
echo sprintf( esc_html__( '%1$1s <span>%2$2s</span>', 'adminify' ), esc_html__( 'WP Adminify', 'adminify' ), esc_html__( 'Pro', 'adminify' ) ) ; |
| 135 |
?> |
| 136 |
</h3> |
| 137 |
|
| 138 |
<p> |
| 139 |
<?php |
| 140 |
echo esc_html__( 'Get Access to exclusive Modules & Unlock all features to Customize the Dashboard.', 'adminify' ) ; |
| 141 |
?> |
| 142 |
</p> |
| 143 |
<ul class="list-items"> |
| 144 |
<?php |
| 145 |
echo sprintf( wp_kses_post( '<li><span>System Dark Mode</span> will change Website\'s Color mode based on System Preferences.</li> |
| 146 |
<li>Change the <span>Login Page URL</span> & Redirect unwanted wp-admin visitors to specific pages.</li> |
| 147 |
<li><li>Add <span>Custom Admin Menu</span>, Submenu, & <span>Separator</span> by using our Menu Editor Module.</li> |
| 148 |
<li>More <span>Typography & Color Options</span> to create a better Custom WordPress Dashboard.</li>' ), '' ) ; |
| 149 |
?> |
| 150 |
</ul> |
| 151 |
|
| 152 |
<?php |
| 153 |
$this->jltwp_adminify_popup_footer(); |
| 154 |
} |
| 155 |
|
| 156 |
public function jltwp_adminify_popup_header( $notice_key, $campaign_image_data ) |
| 157 |
{ |
| 158 |
?> |
| 159 |
<div data-dismissible="<?php |
| 160 |
echo esc_attr( $notice_key ) ; |
| 161 |
?>" id="<?php |
| 162 |
echo esc_attr( $notice_key ) ; |
| 163 |
?>" class="notice is-dismissible upgrade-pro-popup"> |
| 164 |
<div class="upst-body"> |
| 165 |
<div class="col"> |
| 166 |
<img src="<?php |
| 167 |
echo esc_url( $campaign_image_data['url'] ) ; |
| 168 |
?>" alt="<?php |
| 169 |
echo esc_attr( $campaign_image_data['alt'] ) ; |
| 170 |
?>"> |
| 171 |
</div> |
| 172 |
<div class="col"> |
| 173 |
<div class="content-body"> |
| 174 |
<?php |
| 175 |
} |
| 176 |
|
| 177 |
public function jltwp_adminify_popup_footer() |
| 178 |
{ |
| 179 |
?> |
| 180 |
<a href="https://wpadminify.com/pricing?utm_source=WPDashboard&utm_medium=users&utm_campaign=promo" class="button adminify-sure-do-btn is-warning mt-4 upgrade-btn pt-1 pb-1 pr-4 pl-4 upgrade-button"><?php |
| 181 |
echo esc_html__( 'Upgrade to Pro', 'adminify' ) ; |
| 182 |
?> |
| 183 |
<?php |
| 184 |
echo Utils::wp_kses_custom( $this->jltwp_adminify_crown_icon() ) ; |
| 185 |
?> |
| 186 |
</a> |
| 187 |
</div> |
| 188 |
</div> |
| 189 |
</div> |
| 190 |
<div class="upst-footer"> |
| 191 |
<ul> |
| 192 |
<li><a href="https://wpadminify.com/support-forum/"><?php |
| 193 |
echo esc_html__( 'Support', 'adminify' ) ; |
| 194 |
?></a></li> |
| 195 |
<li><a href="https://wpadminify.com/docs/"><?php |
| 196 |
echo esc_html__( 'Documentation', 'adminify' ) ; |
| 197 |
?></a></li> |
| 198 |
<li><a href="https://wpadminify.com/contact/"><?php |
| 199 |
echo esc_html__( 'Request Features', 'adminify' ) ; |
| 200 |
?></a></li> |
| 201 |
</ul> |
| 202 |
</div> |
| 203 |
</div> |
| 204 |
<?php |
| 205 |
} |
| 206 |
|
| 207 |
public function jltwp_adminify_admin_upgrade_pro_notice( $notice_key ) |
| 208 |
{ |
| 209 |
if ( !self::is_admin_notice_active( $notice_key ) ) { |
| 210 |
return; |
| 211 |
} |
| 212 |
$this->jltwp_adminify_notice_header( $notice_key ); |
| 213 |
echo sprintf( |
| 214 |
wp_kses_post( ' <p> %1$s <strong>%2$s</strong> %3$s </p> <p><a class="button upgrade-btn mt-4" href="https://wpadminify.com/pricing" target="_blank">Upgrade Now</a></p>' ), |
| 215 |
wp_kses_post( 'Unlock all possiblities - Schedule Dark Mode, hide all admin Notices, Pagespeed Insights, unlock Folders etc.. <br>' ), |
| 216 |
wp_kses_post( '20% Discount on all pricing, enjoy the freedom.<br>' ), |
| 217 |
wp_kses_post( "Coupon Code: <strong style='background:yellow; padding:1px 5px; color: #0347FF;'>ENJOY25</strong>" ) |
| 218 |
) ; |
| 219 |
$this->jltwp_adminify_notice_footer(); |
| 220 |
} |
| 221 |
|
| 222 |
// Black Friday & Cyber Monday Offer |
| 223 |
public function jltwp_adminify_admin_black_friday_cyber_monday_notice( $notice_key ) |
| 224 |
{ |
| 225 |
if ( !self::is_admin_notice_active( $notice_key ) ) { |
| 226 |
return; |
| 227 |
} |
| 228 |
$this->jltwp_adminify_notice_header( $notice_key ); |
| 229 |
echo sprintf( |
| 230 |
wp_kses_post( ' <p> %1$s <strong>%2$s</strong> %3$s </p> <p><a class="button upgrade-btn mt-4" href="https://wpadminify.com/pricing?utm_source=WPDashboard&utm_medium=users&utm_campaign=promo" target="_blank">Upgrade Now</a></p>' ), |
| 231 |
wp_kses_post( 'Get Access to exclusive Modules & Unlock all features to Customize Your WordPress Dashboard. <br>' ), |
| 232 |
wp_kses_post( 'Lifetime Deals & <strong style="background:yellow; padding:2px 10px; color: #0347FF;">50%</strong> Discounts for <span style="background:#111; padding:2px 10px; color: #fff;">Black Friday and Cyber Monday Deals</span><br>' ), |
| 233 |
wp_kses_post( "Coupon Code: <strong style='background:yellow; padding:2px 10px; color: #0347FF;'>BFCM50</strong>" ) |
| 234 |
) ; |
| 235 |
$this->jltwp_adminify_notice_footer(); |
| 236 |
} |
| 237 |
|
| 238 |
// Halloween Offer |
| 239 |
public function jltwp_adminify_admin_halloween_notice( $notice_key ) |
| 240 |
{ |
| 241 |
if ( !self::is_admin_notice_active( $notice_key ) ) { |
| 242 |
return; |
| 243 |
} |
| 244 |
$this->jltwp_adminify_notice_header( $notice_key ); |
| 245 |
echo sprintf( |
| 246 |
wp_kses_post( ' <p> %1$s <strong>%2$s</strong> %3$s </p> <p><a class="button upgrade-btn mt-4" href="https://wpadminify.com/pricing?utm_source=WPDashboard&utm_medium=users&utm_campaign=promo" target="_blank">Upgrade Now</a></p>' ), |
| 247 |
wp_kses_post( 'Get Access to exclusive Modules & Unlock all features to Customize Your WordPress Dashboard.<br>' ), |
| 248 |
wp_kses_post( 'Limited Time LTD & 25% Discounts for <span style="background:#111; padding:2px 10px; color: #fff;">Halloween Deals</span><br>' ), |
| 249 |
wp_kses_post( "Coupon Code: <strong style='background:yellow; padding:2px 10px; color: #0347FF;'>SPOOKY25</strong>" ) |
| 250 |
) ; |
| 251 |
$this->jltwp_adminify_notice_footer(); |
| 252 |
} |
| 253 |
|
| 254 |
public function jltwp_adminify_notice_header( $notice_key ) |
| 255 |
{ |
| 256 |
?> |
| 257 |
<div data-dismissible="<?php |
| 258 |
echo esc_attr( $notice_key ) ; |
| 259 |
?>" id="<?php |
| 260 |
echo esc_attr( $notice_key ) ; |
| 261 |
?>" class="wp-adminify-notice adminify-review-notice-banner updated notice notice-success is-dismissible"> |
| 262 |
<div id="wp-adminify-bfcm-upgrade-notice" class="wp-adminify-review-notice"> |
| 263 |
<div class="wp-adminify-notice-banner"> |
| 264 |
<div class="wp-adminify-notice-contents columns is-tablet is-align-items-center"> |
| 265 |
<ul class="adminify-notice-left-nav column is-2-tablet"> |
| 266 |
<li> |
| 267 |
<a class="is-flex is-align-items-center" target="_blank" href="https://wpadminify.com/kb"> |
| 268 |
<i class="is-rounded is-pulled-left mr-2 dashicons dashicons-book"></i> |
| 269 |
<?php |
| 270 |
echo esc_html__( 'Docs', 'adminify' ) ; |
| 271 |
?> |
| 272 |
</a> |
| 273 |
</li> |
| 274 |
<li> |
| 275 |
<a class="is-flex is-align-items-center" target="_blank" href="https://demo.wpadminify.com/"> |
| 276 |
<i class="is-rounded is-pulled-left mr-2 dashicons dashicons-fullscreen-alt"></i> |
| 277 |
<?php |
| 278 |
echo esc_html__( 'Live Demo', 'adminify' ) ; |
| 279 |
?> |
| 280 |
</a> |
| 281 |
</li> |
| 282 |
<li> |
| 283 |
<a class="is-flex is-align-items-center" target="_blank" href="https://wpadminify.com/faqs/"> |
| 284 |
<i class="is-rounded is-pulled-left mr-2 dashicons dashicons-editor-help"></i> |
| 285 |
<?php |
| 286 |
echo esc_html__( 'F.A.Q.', 'adminify' ) ; |
| 287 |
?> |
| 288 |
</a> |
| 289 |
</li> |
| 290 |
<li> |
| 291 |
<a class="is-flex is-align-items-center" target="_blank" href="https://wpadminify.com/contact/"> |
| 292 |
<i class="is-rounded is-pulled-left mr-2 dashicons dashicons-phone"></i> |
| 293 |
<?php |
| 294 |
echo esc_html__( 'Contact Us', 'adminify' ) ; |
| 295 |
?> |
| 296 |
</a> |
| 297 |
</li> |
| 298 |
</ul> |
| 299 |
<div class="adminify-notice-middle column is-8-tablet has-text-centered"> |
| 300 |
|
| 301 |
<?php |
| 302 |
} |
| 303 |
|
| 304 |
public function jltwp_adminify_notice_footer() |
| 305 |
{ |
| 306 |
?> |
| 307 |
</div> |
| 308 |
|
| 309 |
<div class="adminify-notice-right column is-2-tablet has-text-centered"> |
| 310 |
<ul class="adminify-notice-right-nav"> |
| 311 |
<li> |
| 312 |
<a class="adminify-logo" href="https://wpadminify.com/" target="_blank"> |
| 313 |
<img src="<?php |
| 314 |
echo esc_url( WP_ADMINIFY_ASSETS_IMAGE ) ; |
| 315 |
?>/logos/logo-text-dark.svg" alt="WP Adminify"> |
| 316 |
</a> |
| 317 |
</li> |
| 318 |
<li class="adminify-notice-social"> |
| 319 |
<a class="adminify-notice-social-icon" target="_blank" href="https://www.facebook.com/groups/jeweltheme"> |
| 320 |
<i class="is-rounded dashicons dashicons-facebook-alt"></i> |
| 321 |
</a> |
| 322 |
<a class="adminify-notice-social-icon" target="_blank" href="https://www.youtube.com/playlist?list=PLqpMw0NsHXV-EKj9Xm1DMGa6FGniHHly8"> |
| 323 |
<i class="is-rounded dashicons dashicons-youtube"></i> |
| 324 |
</a> |
| 325 |
<a class="adminify-notice-social-icon" target="_blank" href="https://twitter.com/jwthemeltd"> |
| 326 |
<i class="is-rounded dashicons dashicons-twitter"></i> |
| 327 |
</a> |
| 328 |
</li> |
| 329 |
<li class="adminify-rate-us mt-3"> |
| 330 |
<div class="adminify-rate-contents"> |
| 331 |
<label class="adminify-rating-label">Rate us:</label> |
| 332 |
<a class="adminify-rating is-inline-block" href="https://wordpress.org/support/plugin/adminify/reviews/?filter=5" target="_blank"> |
| 333 |
<span class="star"> |
| 334 |
<i class="dashicons dashicons-star-half"></i> |
| 335 |
</span> |
| 336 |
<span class="star"> |
| 337 |
<i class="dashicons dashicons-star-filled"></i> |
| 338 |
</span> |
| 339 |
<span class="star"> |
| 340 |
<i class="dashicons dashicons-star-filled"></i> |
| 341 |
</span> |
| 342 |
<span class="star"> |
| 343 |
<i class="dashicons dashicons-star-filled"></i> |
| 344 |
</span> |
| 345 |
<span class="star"> |
| 346 |
<i class="dashicons dashicons-star-filled"></i> |
| 347 |
</span> |
| 348 |
</a> |
| 349 |
</div> |
| 350 |
</li> |
| 351 |
</ul> |
| 352 |
</div> |
| 353 |
</div> |
| 354 |
</div> |
| 355 |
</div> |
| 356 |
</div> |
| 357 |
<?php |
| 358 |
} |
| 359 |
|
| 360 |
public function jltwp_adminify_dismiss_admin_notice() |
| 361 |
{ |
| 362 |
$option_name = ( !empty($_POST['option_name']) ? sanitize_text_field( wp_unslash( $_POST['option_name'] ) ) : '' ); |
| 363 |
$dismissible_length = ( !empty($_POST['dismissible_length']) ? sanitize_text_field( wp_unslash( $_POST['dismissible_length'] ) ) : '' ); |
| 364 |
|
| 365 |
if ( 'forever' != $dismissible_length ) { |
| 366 |
// If $dismissible_length is not an integer default to 1 |
| 367 |
$dismissible_length = ( 0 == absint( $dismissible_length ) ? 1 : $dismissible_length ); |
| 368 |
$dismissible_length = strtotime( absint( $dismissible_length ) . ' days' ); |
| 369 |
} |
| 370 |
|
| 371 |
check_ajax_referer( 'adminify-notice-nonce', 'notice_nonce' ); |
| 372 |
self::set_admin_notice_cache( $option_name, $dismissible_length ); |
| 373 |
wp_die(); |
| 374 |
} |
| 375 |
|
| 376 |
public static function set_admin_notice_cache( $id, $timeout ) |
| 377 |
{ |
| 378 |
$cache_key = 'wp-adminify-notice-' . md5( $id ); |
| 379 |
update_site_option( $cache_key, $timeout ); |
| 380 |
return true; |
| 381 |
} |
| 382 |
|
| 383 |
public static function is_admin_notice_active( $arg ) |
| 384 |
{ |
| 385 |
$array = explode( '-', $arg ); |
| 386 |
$length = array_pop( $array ); |
| 387 |
// do not delete it |
| 388 |
$option_name = implode( '-', $array ); |
| 389 |
$db_record = self::get_admin_notice_cache( $option_name ); |
| 390 |
|
| 391 |
if ( 'forever' === $db_record ) { |
| 392 |
return false; |
| 393 |
} elseif ( absint( $db_record ) >= time() ) { |
| 394 |
return false; |
| 395 |
} else { |
| 396 |
return true; |
| 397 |
} |
| 398 |
|
| 399 |
} |
| 400 |
|
| 401 |
public static function get_admin_notice_cache( $id = false ) |
| 402 |
{ |
| 403 |
if ( !$id ) { |
| 404 |
return false; |
| 405 |
} |
| 406 |
$cache_key = 'wp-adminify-notice-' . md5( $id ); |
| 407 |
$timeout = get_site_option( $cache_key ); |
| 408 |
$timeout = ( 'forever' === $timeout ? time() + 45 : $timeout ); |
| 409 |
if ( empty($timeout) || time() > $timeout ) { |
| 410 |
return false; |
| 411 |
} |
| 412 |
return $timeout; |
| 413 |
} |
| 414 |
|
| 415 |
public function jltwp_adminify_admin_notice_styles() |
| 416 |
{ |
| 417 |
$jltwp_adminify_promo_css = ''; |
| 418 |
$jltwp_adminify_promo_css .= '.wp-adminify-review-notice .notice-dismiss{padding:0 0 0 26px}.wp-adminify-notice .adminify-update-head{margin:0}.wp-adminify-notice .adminify-update-head span{font-size:.9em}.wp-adminify-notice .adminify-changes-list{padding-left:.5em}.wp-adminify-review-notice .notice-dismiss:before{display:none}.wp-adminify-review-notice.wp-adminify-review-notice{background-color:#fff;border-radius:3px;border-left:4px solid transparent;display:flex;align-items:center;padding:10px 10px 10px 0}.wp-adminify-review-notice .wp-adminify-review-thumbnail{width:160px;float:left;margin-right:20px;padding-top:20px;text-align:center;border-right:4px solid transparent}.wp-adminify-review-notice .wp-adminify-review-thumbnail img{vertical-align:middle}.wp-adminify-review-notice .wp-adminify-review-text{flex:0 0 1;overflow:hidden}.wp-adminify-review-notice .wp-adminify-review-text h3{font-size:24px;margin:0 0 5px;font-weight:400;line-height:1.3}.wp-adminify-review-notice .wp-adminify-review-text p{margin:0 0 5px}.wp-adminify-review-notice .wp-adminify-review-ul{margin:5px 0 0;padding:0}.wp-adminify-review-notice .wp-adminify-review-ul li{display:inline-block;margin:5px 15px 0 0}.wp-adminify-review-notice .wp-adminify-review-ul li a{display:inline-block;color:#4b00e7;text-decoration:none;padding-top:10px;position:relative}.wp-adminify-review-notice .wp-adminify-review-ul li a:not(.notice-dismiss) span.dashicons{font-size:17px;float:left;height:auto;width:auto;margin-right:3px}.wp-adminify #wpbody-content .wp-adminify-notice.adminify-review-notice-banner{background-color:#0347ff;border-left:0;padding-right:.5rem}.wp-adminify #wpbody-content .adminify-review-notice-banner .wp-adminify-notice-banner{-webkit-box-flex:0;-webkit-flex:0 0 100%;-ms-flex:0 0 100%;flex:0 0 100%}.wp-adminify-notice-banner .columns{margin-top:-2em!important;margin-bottom:-2em!important}.wp-adminify #wpbody-content .adminify-review-notice-banner .wp-adminify-review-notice{background-color:transparent;font-size:15px}.wp-adminify #wpbody-content .adminify-review-notice-banner #wp-adminify-bfcm-upgrade-notice p{color:#fff;font-size:15px}.wp-adminify #wpbody-content .adminify-review-notice-banner .adminify-notice-left-nav{margin:0}.wp-adminify #wpbody-content .adminify-review-notice-banner .adminify-notice-left-nav li{margin-bottom:5px}.wp-adminify #wpbody-content .adminify-review-notice-banner #wp-adminify-bfcm-upgrade-notice .adminify-notice-left-nav a{color:#fff}.wp-adminify #wpbody-content .adminify-review-notice-banner .adminify-notice-left-nav a i{background-color:#fff;color:#0347ff;font-size:20px;height:26px;width:26px;line-height:26px}.wp-adminify #wpbody-content .adminify-review-notice-banner .adminify-notice-middle .upgrade-btn{background-color:#fff;border:1px solid #fff;color:#0347ff;font-size:16px;font-weight:800;border-radius:8px}.wp-adminify #wpbody-content .adminify-review-notice-banner .adminify-notice-middle .upgrade-btn:hover{border:1px solid #fff!important;background:#0347ff!important;color:#fff!important}.wp-adminify #wpbody-content .adminify-review-notice-banner .adminify-notice-middle .upgrade-btn:focus{background-color:#fff}.adminify-review-notice-banner .adminify-logo{display:flex;margin:0 auto 1rem;max-width:135px}.wp-adminify #wpbody-content .adminify-review-notice-banner .adminify-notice-social-icon i{background-color:#fff;height:40px;width:40px;line-height:40px;margin:3px}.adminify-review-notice-banner .adminify-logo{max-width:135px}.wp-adminify #wpbody-content .adminify-review-notice-banner #wp-adminify-bfcm-upgrade-notice .adminify-rate-contents,.wp-adminify #wpbody-content .adminify-review-notice-banner #wp-adminify-bfcm-upgrade-notice .adminify-rate-contents a{color:#fff}.wp-adminify .adminify-review-notice-banner .adminify-rating{direction:rtl}.wp-adminify .adminify-review-notice-banner .adminify-rating label{font-size:0;line-height:0}.wp-adminify .adminify-review-notice-banner .adminify-rate-contents i{font-size:14px;height:auto;width:auto;line-height:0;vertical-align:middle}.adminify-rating input{display:none!important}.adminify-rating:hover span i:before{content:"\\f154"}.adminify-rating span:hover i:before,.adminify-rating span:hover~span i:before{content:"\\f155"}.wp-adminify #wpbody-content .adminify-review-notice-banner .notice-dismiss{border-color:#fff}.wp-adminify #wpbody-content .adminify-review-notice-banner .notice-dismiss:before{color:#fff}.wp-adminify #wpbody-content .adminify-review-notice-banner .adminify-notice-middle .adminify-sure-do-btn:hover{background-color:#00d1b2!important;border-color:transparent!important} .upgrade-pro-popup {max-width: 850px;width: 100%;gap: 15px;background: #fff;border-radius: 5px !important;margin: 80px 20px !important;padding: 40px !important;position: absolute !important;z-index: 9999;left: 30%;top: 1%;transform: translate(-30%, -2%);-webkit-box-shadow: 0px 0px 54px 0px rgb(20 20 42 / 7%) !important;box-shadow: 0px 0px 54px 0px rgb(20 20 42 / 7%) !important;}.upgrade-pro-popup .upst-body{display:flex;}.upgrade-pro-popup .col{flex-basis:50%;}.upgrade-pro-popup .col:nth-child(1){padding-right: 20px;padding-top: 90px;}.upgrade-pro-popup .col:nth-child(1) img{max-width:100%;}.upgrade-pro-popup .col:nth-child(2){padding-left: 20px;}.upgrade-pro-popup .upst-body .content-body{color: rgba(78, 75, 102, 0.72);}.upgrade-pro-popup .upst-body .content-body h4{display:flex;color: #FB0066;margin-bottom: 10px;letter-spacing: 1px;gap: 10px;font-size: 22px;line-height: 32px;}.upgrade-pro-popup .upst-body .content-body h4 i {background: #ffff004a;padding: 5px 9px;border-radius: 5px;font-size: 16px;text-align: center;line-height: 24px;width:39px;}.upgrade-pro-popup .upst-body .content-body h3{color: #14142B;letter-spacing: 1px;font-size:28px;}.upgrade-pro-popup .upst-body .content-body h3 span{color: #0347ff;}.upgrade-pro-popup .upst-body .content-body p{font-weight: normal !important;line-height: 22px !important;font-size: 16px !important;}.upgrade-pro-popup .upst-body .content-body ul li {margin: 10px 0;line-height: 22px;padding-left: 30px;}.upgrade-pro-popup .upst-body .content-body ul li:before {color: #fff;top: 2px;left: 1px;font-size: 17px;}.upgrade-pro-popup .upst-body .content-body ul li:after {position: absolute;content: "";background: #00BA88;border-radius: 50px;width: 18px;height: 18px;top: 3px !important;left: 1px;}.upgrade-pro-popup .upst-body .content-body ul li span{color: #14142B !important;}.upgrade-pro-popup .upst-body .content-body .upgrade-btn {background: #0347ff;color: #fff;font-size: 16px;border:0 !important;border-radius: 6px;}.upgrade-pro-popup .upst-body .content-body .upgrade-btn:hover {color: #fff !important;}.upgrade-pro-popup .upst-footer ul{display: flex;padding-top:60px;width: 60%;margin: 0 auto;justify-content: space-between;}.upgrade-pro-popup ul li{position: relative;list-style: none;padding-left: 25px;}.upgrade-pro-popup ul li:before{position: absolute;content:"\\f15e";font-family: dashicons;font-size: 19px;left: 0;top: 0;z-index: 1;}.upgrade-pro-popup .upst-footer ul li a{color: rgba(78, 75, 102, 0.72) !important;}.upgrade-pro-popup .upst-footer ul li a:hover{color: #0347FF !important;}.upgrade-pro-popup .upst-footer ul li:before{font-size: 22px;color: #00BA88;}.upgrade-pro-popup .notice-dismiss {border: 0 !important;outline: none !important;background: transparent !important;}.upgrade-pro-popup .notice-dismiss:before{content: "\\00d7" !important;font-size: 30px !important;height: 22px !important;width: 22px !important;color: rgba(78, 75, 102, 0.72) !important;}@media only screen and (max-width: 1110px) {.upgrade-pro-popup {max-width: 90%;}}@media only screen and (max-width: 960px) {.upgrade-pro-popup {max-width: 80%;}.upgrade-pro-popup .upst-body {display: block;}.upgrade-pro-popup .col:nth-child(1) {padding: 0;margin-bottom: 40px;}.upgrade-pro-popup .col:nth-child(2){padding:0}.upgrade-pro-popup .upst-footer ul {width: 80%;padding-top: 40px;}}@media only screen and (max-width: 768px) {.upgrade-pro-popup .upst-footer ul {width: 100%;display:block;}}@media only screen and (max-width: 600px) {.upgrade-pro-popup {padding: 40px 20px 30px !important;}}'; |
| 419 |
$jltwp_adminify_promo_css = preg_replace( '#/\\*.*?\\*/#s', '', $jltwp_adminify_promo_css ); |
| 420 |
$jltwp_adminify_promo_css = preg_replace( '/\\s*([{}|:;,])\\s+/', '$1', $jltwp_adminify_promo_css ); |
| 421 |
$jltwp_adminify_promo_css = preg_replace( '/\\s\\s+(.*)/', '$1', $jltwp_adminify_promo_css ); |
| 422 |
|
| 423 |
if ( !empty($this->options['admin_ui']) ) { |
| 424 |
wp_add_inline_style( 'wp-adminify-admin', wp_strip_all_tags( $jltwp_adminify_promo_css ) ); |
| 425 |
} else { |
| 426 |
wp_add_inline_style( 'wp-adminify-default-ui', wp_strip_all_tags( $jltwp_adminify_promo_css ) ); |
| 427 |
} |
| 428 |
|
| 429 |
} |
| 430 |
|
| 431 |
public function get_diff_days( $datetime ) |
| 432 |
{ |
| 433 |
$date_first = date_create( gmdate( 'd-m-Y', $datetime ) ); |
| 434 |
$date_second = date_create( gmdate( 'd-m-Y' ) ); |
| 435 |
$different = date_diff( $date_first, $date_second ); |
| 436 |
return $different->format( '%R%a' ); |
| 437 |
} |
| 438 |
|
| 439 |
public function jltwp_adminify_review_notice_generator() |
| 440 |
{ |
| 441 |
$jltwp_adminify_activation_time = get_option( 'jltwp_adminify_activation_time' ); |
| 442 |
$diff_days = $this->get_diff_days( $jltwp_adminify_activation_time ); |
| 443 |
if ( $diff_days >= 15 ) { |
| 444 |
$this->jltwp_adminify_admin_notice_ask_for_review( 'wp-adminify-review-15' ); |
| 445 |
} |
| 446 |
} |
| 447 |
|
| 448 |
public function jltwp_adminify_upgrade_pro_notice_popup() |
| 449 |
{ |
| 450 |
$jltwp_adminify_activation_time = get_option( 'jltwp_adminify_activation_time' ); |
| 451 |
$diff_days = $this->get_diff_days( $jltwp_adminify_activation_time ); |
| 452 |
if ( $diff_days >= 12 ) { |
| 453 |
$this->jltwp_adminify_admin_upgrade_pro_notice_popup( 'wp-adminify-review-12' ); |
| 454 |
} |
| 455 |
} |
| 456 |
|
| 457 |
public function jltwp_adminify_upgrade_pro_notice_generator() |
| 458 |
{ |
| 459 |
$this->jltwp_adminify_admin_upgrade_pro_notice( 'wp-adminify-review-20' ); |
| 460 |
} |
| 461 |
|
| 462 |
public function jltwp_adminify_black_friday_cyber_monday_deals() |
| 463 |
{ |
| 464 |
$today = gmdate( 'Y-m-d' ); |
| 465 |
$start_date = '2022-11-22'; |
| 466 |
$expire_date = '2022-12-5'; |
| 467 |
$today_time = strtotime( $today ); |
| 468 |
$start_time = strtotime( $start_date ); |
| 469 |
$expire_time = strtotime( $expire_date ); |
| 470 |
if ( $today_time >= $start_time && $today_time <= $expire_time ) { |
| 471 |
$this->jltwp_adminify_admin_black_friday_cyber_monday_notice( 'wp-adminify-bfcm-2022-22-5' ); |
| 472 |
} |
| 473 |
} |
| 474 |
|
| 475 |
public function jltwp_adminify_halloween_deals() |
| 476 |
{ |
| 477 |
$today = gmdate( 'Y-m-d' ); |
| 478 |
$start_date = '2023-10-27'; |
| 479 |
$expire_date = '2023-11-07'; |
| 480 |
$today_time = strtotime( $today ); |
| 481 |
$start_time = strtotime( $start_date ); |
| 482 |
$expire_time = strtotime( $expire_date ); |
| 483 |
if ( $today_time >= $start_time && $today_time <= $expire_time ) { |
| 484 |
$this->jltwp_adminify_admin_halloween_notice( 'wp-adminify-hlwn-2022' ); |
| 485 |
} |
| 486 |
} |
| 487 |
|
| 488 |
} |