class-affiliate.php
4 years ago
class-polylang.php
6 years ago
class-review-box.php
4 years ago
class-upgrade-box.php
4 years ago
class-wpml.php
6 years ago
folders.class.php
4 years ago
form.class.php
4 years ago
media.replace.php
4 years ago
plugin.updates.php
6 years ago
plugins.class.php
5 years ago
tree.class.php
5 years ago
class-upgrade-box.php
297 lines
| 1 | <?php |
| 2 | if (!defined('ABSPATH')) {exit;} |
| 3 | class Folders_upgrade_box { |
| 4 | public $plugin_name = "Folders"; |
| 5 | public $plugin_slug = "folders"; |
| 6 | |
| 7 | public function __construct() { |
| 8 | add_action("wp_ajax_".$this->plugin_slug."_upgrade_hide_box", array($this, "upgrade_to_pro")); |
| 9 | add_action('admin_notices', array($this, 'admin_notices')); |
| 10 | } |
| 11 | |
| 12 | public function upgrade_to_pro() { |
| 13 | $nonce = filter_input(INPUT_POST, 'nonce'); |
| 14 | $days = filter_input(INPUT_POST, 'days'); |
| 15 | if(!empty($nonce) && wp_verify_nonce($nonce, $this->plugin_slug."_upgrade_box")) { |
| 16 | if($days == -1) { |
| 17 | add_option($this->plugin_slug."_hide_upgrade_box", "1"); |
| 18 | } else { |
| 19 | $date = date("Y-m-d", strtotime("+".$days." days")); |
| 20 | update_option($this->plugin_slug."_show_upgrade_box_after", $date); |
| 21 | } |
| 22 | } |
| 23 | die; |
| 24 | } |
| 25 | |
| 26 | public function admin_notices() { |
| 27 | $is_hidden = get_option($this->plugin_slug."_hide_upgrade_box"); |
| 28 | if($is_hidden !== false) { |
| 29 | return; |
| 30 | } |
| 31 | $current_count = get_option($this->plugin_slug."_show_upgrade_box_after"); |
| 32 | if($current_count === false) { |
| 33 | $date = date("Y-m-d", strtotime("+15 days")); |
| 34 | add_option($this->plugin_slug."_show_upgrade_box_after", $date); |
| 35 | return; |
| 36 | } else if($current_count < 35) { |
| 37 | return; |
| 38 | } |
| 39 | $date_to_show = get_option($this->plugin_slug."_show_upgrade_box_after"); |
| 40 | if($date_to_show !== false) { |
| 41 | $current_date = date("Y-m-d"); |
| 42 | if($current_date < $date_to_show) { |
| 43 | return; |
| 44 | } |
| 45 | } |
| 46 | ?> |
| 47 | <style> |
| 48 | .<?php echo esc_attr($this->plugin_slug) ?>-tab-integration-action{ |
| 49 | padding: 0 10px; |
| 50 | float: right; |
| 51 | } |
| 52 | .<?php echo esc_attr($this->plugin_slug) ?>-premio-upgrade-box .<?php echo esc_attr($this->plugin_slug) ?>-tab-integration-action a { |
| 53 | display: inline-block; |
| 54 | float: right; |
| 55 | text-decoration: none; |
| 56 | position: unset; |
| 57 | padding: 0px; |
| 58 | font-size: 13px; |
| 59 | right: 50px; |
| 60 | top: 7px; |
| 61 | color: #3C85F7; |
| 62 | background-color: #fff; |
| 63 | border-radius: 5px; |
| 64 | border: 2px solid #3C85F7; |
| 65 | min-width: 110px; |
| 66 | text-align: center; |
| 67 | line-height: 25px; |
| 68 | } |
| 69 | .<?php echo esc_attr($this->plugin_slug) ?>-premio-upgrade-box .<?php echo esc_attr($this->plugin_slug) ?>-tab-integration-action a:hover{ |
| 70 | background-color:#fff |
| 71 | } |
| 72 | .<?php echo esc_attr($this->plugin_slug) ?>-premio-upgrade-box p a { |
| 73 | display: inline-block; |
| 74 | float: right; |
| 75 | text-decoration: none; |
| 76 | color: #999999; |
| 77 | position: absolute; |
| 78 | right: 12px; |
| 79 | top: 12px; |
| 80 | } |
| 81 | .<?php echo esc_attr($this->plugin_slug) ?>-premio-upgrade-box p a:hover, .<?php echo esc_attr($this->plugin_slug) ?>-premio-upgrade-box p a:focus { |
| 82 | color: #333333; |
| 83 | } |
| 84 | .<?php echo esc_attr($this->plugin_slug) ?>-premio-upgrade-box .button span { |
| 85 | display: inline-block; |
| 86 | line-height: 27px; |
| 87 | font-size: 16px; |
| 88 | } |
| 89 | .<?php echo esc_attr($this->plugin_slug) ?>-upgrade-box-popup { |
| 90 | position: fixed; |
| 91 | width: 100%; |
| 92 | height: 100%; |
| 93 | z-index: 10001; |
| 94 | background: rgba(0,0,0,0.65); |
| 95 | top: 0; |
| 96 | left: 0; |
| 97 | display: none; |
| 98 | } |
| 99 | .<?php echo esc_attr($this->plugin_slug) ?>-upgrade-box-popup-content { |
| 100 | background: #ffffff; |
| 101 | padding: 20px; |
| 102 | position: absolute; |
| 103 | max-width: 450px; |
| 104 | width: 100%; |
| 105 | margin: 0 auto; |
| 106 | top: 45%; |
| 107 | left: 0; |
| 108 | right: 0; |
| 109 | -webkit-border-radius: 5px; |
| 110 | -moz-border-radius: 5px; |
| 111 | border-radius: 5px;: ; |
| 112 | } |
| 113 | .<?php echo esc_attr($this->plugin_slug) ?>-upgrade-box-title { |
| 114 | padding: 0 0 10px 0; |
| 115 | font-weight: bold; |
| 116 | } |
| 117 | .<?php echo esc_attr($this->plugin_slug) ?>-upgrade-box-options a { |
| 118 | display: block; |
| 119 | margin: 5px 0 5px 0; |
| 120 | color: #333; |
| 121 | text-decoration: none; |
| 122 | } |
| 123 | .<?php echo esc_attr($this->plugin_slug) ?>-upgrade-box-options a.dismiss { |
| 124 | color: #999; |
| 125 | } |
| 126 | .<?php echo esc_attr($this->plugin_slug) ?>-upgrade-box-options a:hover, .affiliate-options a:focus { |
| 127 | color: #0073aa; |
| 128 | } |
| 129 | button.<?php echo esc_attr($this->plugin_slug) ?>-close-upgrade-box-popup { |
| 130 | position: absolute; |
| 131 | top: 5px; |
| 132 | right: 0; |
| 133 | border: none; |
| 134 | background: transparent; |
| 135 | cursor: pointer; |
| 136 | } |
| 137 | a.button.button-primary.<?php echo esc_attr($this->plugin_slug) ?>-upgrade-box-btn { |
| 138 | font-size: 14px; |
| 139 | background: #F51366; |
| 140 | color: #fff; |
| 141 | border: solid 1px #F51366; |
| 142 | border-radius: 3px; |
| 143 | line-height: 24px; |
| 144 | -webkit-box-shadow: 0 3px 5px -3px #333333; |
| 145 | -moz-box-shadow: 0 3px 5px -3px #333333; |
| 146 | box-shadow: 0 3px 5px -3px #333333; |
| 147 | text-shadow: none; |
| 148 | } |
| 149 | .notice.notice-info.premio-notice { |
| 150 | position: relative; |
| 151 | padding: 1px 30px 1px 12px; |
| 152 | } |
| 153 | .notice.notice-info.premio-notice ul li { |
| 154 | margin: 0; |
| 155 | } |
| 156 | .notice.notice-info.premio-notice ul li a { |
| 157 | color: #0073aa; |
| 158 | font-size: 14px; |
| 159 | text-decoration: underline; |
| 160 | } |
| 161 | .<?php echo esc_attr($this->plugin_slug) ?>-premio-upgrade-box p { |
| 162 | line-height: 30px; |
| 163 | vertical-align: middle; |
| 164 | padding: 0 10px 0 0; |
| 165 | font-size: 14px; |
| 166 | } |
| 167 | .<?php echo esc_attr($this->plugin_slug) ?>-premio-upgrade-box p img { |
| 168 | width: 30px; |
| 169 | height: 30px; |
| 170 | display: inline-block; |
| 171 | margin: 0 10px; |
| 172 | vertical-align: middle; |
| 173 | border-radius: 15px; |
| 174 | } |
| 175 | .review-thanks-img img { |
| 176 | width: 100%; |
| 177 | height: auto; |
| 178 | max-width: 200px; |
| 179 | } |
| 180 | .review-thanks-msg { |
| 181 | padding: 5px 0 0 10px; |
| 182 | display: inline-block; |
| 183 | text-align: left; |
| 184 | } |
| 185 | .review-thanks-box { |
| 186 | padding: 10px 0 10px 0; |
| 187 | position: relative; |
| 188 | text-align: center; |
| 189 | display: none; |
| 190 | } |
| 191 | .upgrade-box-default { |
| 192 | } |
| 193 | .review-thanks-btn { |
| 194 | border: 0; |
| 195 | background: transparent; |
| 196 | position: absolute; |
| 197 | right: -30px; |
| 198 | top: 5px; |
| 199 | } |
| 200 | .review-thanks-img { |
| 201 | display: inline-block; |
| 202 | vertical-align: top; |
| 203 | width: 200px; |
| 204 | } |
| 205 | .thanks-msg-title { |
| 206 | font-weight: bold; |
| 207 | font-size: 18px; |
| 208 | } |
| 209 | .thanks-msg-desc { |
| 210 | padding: 24px 0; |
| 211 | } |
| 212 | .thanks-msg-footer { |
| 213 | font-weight: bold; |
| 214 | } |
| 215 | </style> |
| 216 | <?php |
| 217 | $customize_folders = get_option("customize_folders"); |
| 218 | if(isset($customize_folders['show_folder_in_settings']) && $customize_folders['show_folder_in_settings'] == "yes") { |
| 219 | $upgradeURL = admin_url("options-general.php?page=wcp_folders_settings&setting_page=upgrade-to-pro"); |
| 220 | } else { |
| 221 | $upgradeURL = admin_url("admin.php?page=folders-upgrade-to-pro"); |
| 222 | } |
| 223 | ?> |
| 224 | <div class="notice notice-info premio-notice <?php echo esc_attr($this->plugin_slug) ?>-premio-upgrade-box <?php echo esc_attr($this->plugin_slug) ?>-premio-upgrade-box"> |
| 225 | <div class="upgrade-box-default" id="default-upgrade-box-<?php echo esc_attr($this->plugin_slug) ?>"> |
| 226 | <p> |
| 227 | <?php printf(esc_html__("%s to experience more exclusive features like dynamic folders, subfolders, access restriction & more", 'folders'), "<b>".esc_html__("Upgrade to ",'folders')." ".$this->plugin_name." Pro</b>") ?> |
| 228 | <span class="<?php echo esc_attr($this->plugin_slug) ?>-tab-integration-action"> |
| 229 | <a class="upgradenow-box-btn" data-days="-1" href="<?php echo esc_url($upgradeURL); ?>" target="_blank" ><?php esc_html_e("Upgrade now", 'folders'); ?></a> |
| 230 | </span> |
| 231 | <a href="javascript:;" class="dismiss-btn <?php echo esc_attr($this->plugin_slug) ?>-premio-upgrade-dismiss-btn"><span class="dashicons dashicons-no-alt"></span></a> |
| 232 | </p> |
| 233 | <div class="clear clearfix"></div> |
| 234 | </div> |
| 235 | </div> |
| 236 | <div class="<?php echo esc_attr($this->plugin_slug) ?>-upgrade-box-popup"> |
| 237 | <div class="<?php echo esc_attr($this->plugin_slug) ?>-upgrade-box-popup-content"> |
| 238 | <button class="<?php echo esc_attr($this->plugin_slug) ?>-close-upgrade-box-popup"><span class="dashicons dashicons-no-alt"></span></button> |
| 239 | <div class="<?php echo esc_attr($this->plugin_slug) ?>-upgrade-box-title"> <?php esc_html_e("Would you like us to remind you about this later? ",'folders')?></div> |
| 240 | <div class="<?php echo esc_attr($this->plugin_slug) ?>-upgrade-box-options"> |
| 241 | <a href="javascript:;" data-days="7"> <?php esc_html_e("Remind me in 7 days ",'folders')?></a> |
| 242 | <a href="javascript:;" data-days="30"> <?php esc_html_e("Remind me in 30 days",'folders')?></a> |
| 243 | <a href="javascript:;" data-days="-1" class="dismiss"> <?php esc_html_e("Don't remind me about this ",'folders')?></a> |
| 244 | </div> |
| 245 | </div> |
| 246 | </div> |
| 247 | <script> |
| 248 | jQuery(document).ready(function(){ |
| 249 | jQuery("body").addClass("has-premio-box"); |
| 250 | |
| 251 | jQuery(document).on("click",".upgradenow-box-btn",function(){ |
| 252 | jQuery(".notice.notice-info.premio-notice").hide(); |
| 253 | |
| 254 | var dataDays = jQuery(this).attr("data-days"); |
| 255 | |
| 256 | jQuery(".<?php echo esc_attr($this->plugin_slug) ?>-upgrade-box-popup").remove(); |
| 257 | jQuery(".<?php echo esc_attr($this->plugin_slug) ?>-premio-upgrade-box").remove(); |
| 258 | jQuery("body").removeClass("has-premio-box"); |
| 259 | |
| 260 | jQuery.ajax({ |
| 261 | url: "<?php echo admin_url("admin-ajax.php") ?>", |
| 262 | data: "action=<?php echo esc_attr($this->plugin_slug) ?>_upgrade_box&days="+dataDays+"&nonce=<?php echo esc_attr(wp_create_nonce($this->plugin_slug."_upgrade_box")) ?>", |
| 263 | type: "post", |
| 264 | success: function() { |
| 265 | jQuery(".<?php echo esc_attr($this->plugin_slug) ?>-upgrade-box-popup").remove(); |
| 266 | jQuery(".<?php echo esc_attr($this->plugin_slug) ?>-premio-upgrade-box").remove(); |
| 267 | } |
| 268 | }); |
| 269 | }); |
| 270 | jQuery(document).on("click", ".<?php echo esc_attr($this->plugin_slug) ?>-premio-upgrade-dismiss-btn, .<?php echo esc_attr($this->plugin_slug) ?>-premio-upgrade-box-future-btn", function(){ |
| 271 | jQuery(".<?php echo esc_attr($this->plugin_slug) ?>-upgrade-box-popup").show(); |
| 272 | }); |
| 273 | jQuery(document).on("click", ".<?php echo esc_attr($this->plugin_slug) ?>-close-upgrade-box-popup", function(){ |
| 274 | jQuery(".<?php echo esc_attr($this->plugin_slug) ?>-upgrade-box-popup").hide(); |
| 275 | }); |
| 276 | |
| 277 | jQuery(document).on("click", ".<?php echo esc_attr($this->plugin_slug)?>-upgrade-box-options a", function(){ |
| 278 | var dataDays = jQuery(this).attr("data-days"); |
| 279 | jQuery(".<?php echo esc_attr($this->plugin_slug) ?>-upgrade-box-popup").remove(); |
| 280 | jQuery(".<?php echo esc_attr($this->plugin_slug) ?>-premio-upgrade-box").remove(); |
| 281 | jQuery("body").removeClass("has-premio-box"); |
| 282 | jQuery.ajax({ |
| 283 | url: "<?php echo admin_url("admin-ajax.php") ?>", |
| 284 | data: "action=<?php echo esc_attr($this->plugin_slug) ?>_upgrade_hide_box&days="+dataDays+"&nonce=<?php echo esc_attr(wp_create_nonce($this->plugin_slug."_upgrade_box")) ?>", |
| 285 | type: "post", |
| 286 | success: function() { |
| 287 | jQuery(".<?php echo esc_attr($this->plugin_slug) ?>-upgrade-box-popup").remove(); |
| 288 | jQuery(".<?php echo esc_attr($this->plugin_slug) ?>-premio-upgrade-box").remove(); |
| 289 | } |
| 290 | }); |
| 291 | }); |
| 292 | }); |
| 293 | </script> |
| 294 | <?php |
| 295 | } |
| 296 | } |
| 297 | $Folders_upgrade_box = new Folders_upgrade_box(); |