class-affiliate.php
6 years ago
class-review-box.php
6 years ago
folders.class.php
6 years ago
form.class.php
6 years ago
plugin.updates.php
6 years ago
tree.class.php
6 years ago
class-review-box.php
280 lines
| 1 | <?php |
| 2 | /* Free/Pro Class name change */ |
| 3 | class folders_review_box { |
| 4 | |
| 5 | public $plugin_name = "Folders"; |
| 6 | |
| 7 | public $plugin_slug = "folders"; |
| 8 | |
| 9 | public function __construct() { |
| 10 | |
| 11 | add_action("wp_ajax_".$this->plugin_slug."_review_box", array($this, "affiliate_program")); |
| 12 | |
| 13 | add_action('admin_notices', array($this, 'admin_notices')); |
| 14 | } |
| 15 | |
| 16 | public function affiliate_program() { |
| 17 | $nonce = filter_input(INPUT_POST, 'nonce', FILTER_SANITIZE_STRING); |
| 18 | $days = filter_input(INPUT_POST, 'days', FILTER_SANITIZE_STRING); |
| 19 | if(!empty($nonce) && wp_verify_nonce($nonce, $this->plugin_slug."_review_box")) { |
| 20 | if($days == -1) { |
| 21 | add_option($this->plugin_slug."_hide_review_box", "1"); |
| 22 | } else { |
| 23 | $date = date("Y-m-d", strtotime("+".$days." days")); |
| 24 | update_option($this->plugin_slug."_show_review_box_after", $date); |
| 25 | } |
| 26 | } |
| 27 | die; |
| 28 | } |
| 29 | |
| 30 | public function admin_notices() { |
| 31 | $is_hidden = get_option($this->plugin_slug."_hide_review_box"); |
| 32 | if($is_hidden !== false) { |
| 33 | return; |
| 34 | } |
| 35 | $current_count = get_option($this->plugin_slug."_show_review_box_after"); |
| 36 | if($current_count === false) { |
| 37 | $date = date("Y-m-d", strtotime("+7 days")); |
| 38 | add_option($this->plugin_slug."_show_review_box_after", $date); |
| 39 | return; |
| 40 | } else if($current_count < 35) { |
| 41 | return; |
| 42 | } |
| 43 | $date_to_show = get_option($this->plugin_slug."_show_review_box_after"); |
| 44 | if($date_to_show !== false) { |
| 45 | $current_date = date("Y-m-d"); |
| 46 | if($current_date < $date_to_show) { |
| 47 | return; |
| 48 | } |
| 49 | } |
| 50 | ?> |
| 51 | <style> |
| 52 | .<?php echo $this->plugin_slug ?>-premio-review-box p a { |
| 53 | display: inline-block; |
| 54 | float: right; |
| 55 | text-decoration: none; |
| 56 | color: #999999; |
| 57 | position: absolute; |
| 58 | right: 12px; |
| 59 | top: 12px; |
| 60 | } |
| 61 | .<?php echo $this->plugin_slug ?>-premio-review-box p a:hover, .<?php echo $this->plugin_slug ?>-premio-review-box p a:focus { |
| 62 | color: #333333; |
| 63 | } |
| 64 | .<?php echo $this->plugin_slug ?>-premio-review-box .button span { |
| 65 | display: inline-block; |
| 66 | line-height: 27px; |
| 67 | font-size: 16px; |
| 68 | } |
| 69 | .<?php echo $this->plugin_slug ?>-review-box-popup { |
| 70 | position: fixed; |
| 71 | width: 100%; |
| 72 | height: 100%; |
| 73 | z-index: 10001; |
| 74 | background: rgba(0,0,0,0.65); |
| 75 | top: 0; |
| 76 | left: 0; |
| 77 | display: none; |
| 78 | } |
| 79 | .<?php echo $this->plugin_slug ?>-review-box-popup-content { |
| 80 | background: #ffffff; |
| 81 | padding: 20px; |
| 82 | position: absolute; |
| 83 | max-width: 450px; |
| 84 | width: 100%; |
| 85 | margin: 0 auto; |
| 86 | top: 45%; |
| 87 | left: 0; |
| 88 | right: 0; |
| 89 | -webkit-border-radius: 5px; |
| 90 | -moz-border-radius: 5px; |
| 91 | border-radius: 5px;: ; |
| 92 | } |
| 93 | .<?php echo $this->plugin_slug ?>-review-box-title { |
| 94 | padding: 0 0 10px 0; |
| 95 | font-weight: bold; |
| 96 | } |
| 97 | .<?php echo $this->plugin_slug ?>-review-box-options a { |
| 98 | display: block; |
| 99 | margin: 5px 0 5px 0; |
| 100 | color: #333; |
| 101 | text-decoration: none; |
| 102 | } |
| 103 | .<?php echo $this->plugin_slug ?>-review-box-options a.dismiss { |
| 104 | color: #999; |
| 105 | } |
| 106 | .<?php echo $this->plugin_slug ?>-review-box-options a:hover, .affiliate-options a:focus { |
| 107 | color: #0073aa; |
| 108 | } |
| 109 | button.<?php echo $this->plugin_slug ?>-close-review-box-popup { |
| 110 | position: absolute; |
| 111 | top: 5px; |
| 112 | right: 0; |
| 113 | border: none; |
| 114 | background: transparent; |
| 115 | cursor: pointer; |
| 116 | } |
| 117 | a.button.button-primary.<?php echo $this->plugin_slug ?>-review-box-btn { |
| 118 | font-size: 14px; |
| 119 | background: #F51366; |
| 120 | color: #fff; |
| 121 | border: solid 1px #F51366; |
| 122 | border-radius: 3px; |
| 123 | line-height: 24px; |
| 124 | -webkit-box-shadow: 0 3px 5px -3px #333333; |
| 125 | -moz-box-shadow: 0 3px 5px -3px #333333; |
| 126 | box-shadow: 0 3px 5px -3px #333333; |
| 127 | text-shadow: none; |
| 128 | } |
| 129 | .notice.notice-info.premio-notice { |
| 130 | position: relative; |
| 131 | padding: 1px 30px 1px 12px; |
| 132 | } |
| 133 | .notice.notice-info.premio-notice ul li { |
| 134 | margin: 0; |
| 135 | } |
| 136 | .notice.notice-info.premio-notice ul li a { |
| 137 | color: #0073aa; |
| 138 | font-size: 14px; |
| 139 | text-decoration: underline; |
| 140 | } |
| 141 | .<?php echo $this->plugin_slug ?>-premio-review-box p { |
| 142 | display: inline-block; |
| 143 | line-height: 30px; |
| 144 | vertical-align: middle; |
| 145 | padding: 0 10px 0 0; |
| 146 | } |
| 147 | .<?php echo $this->plugin_slug ?>-premio-review-box p img { |
| 148 | width: 30px; |
| 149 | height: 30px; |
| 150 | display: inline-block; |
| 151 | margin: 0 10px; |
| 152 | vertical-align: middle; |
| 153 | border-radius: 15px; |
| 154 | } |
| 155 | .review-thanks-img img { |
| 156 | width: 100%; |
| 157 | height: auto; |
| 158 | max-width: 200px; |
| 159 | } |
| 160 | .review-thanks-msg { |
| 161 | padding: 5px 0 0 10px; |
| 162 | display: inline-block; |
| 163 | text-align: left; |
| 164 | } |
| 165 | .review-thanks-box { |
| 166 | padding: 10px 0 10px 0; |
| 167 | position: relative; |
| 168 | text-align: center; |
| 169 | display: none; |
| 170 | } |
| 171 | .review-box-default { |
| 172 | } |
| 173 | .review-thanks-btn { |
| 174 | border: 0; |
| 175 | background: transparent; |
| 176 | position: absolute; |
| 177 | right: -30px; |
| 178 | top: 5px; |
| 179 | } |
| 180 | .review-thanks-img { |
| 181 | display: inline-block; |
| 182 | vertical-align: top; |
| 183 | width: 200px; |
| 184 | } |
| 185 | .thanks-msg-title { |
| 186 | font-weight: bold; |
| 187 | font-size: 18px; |
| 188 | } |
| 189 | .thanks-msg-desc { |
| 190 | padding: 24px 0; |
| 191 | } |
| 192 | .thanks-msg-footer { |
| 193 | font-weight: bold; |
| 194 | } |
| 195 | </style> |
| 196 | <div class="notice notice-info premio-notice <?php echo $this->plugin_slug ?>-premio-review-box <?php echo $this->plugin_slug ?>-premio-review-box"> |
| 197 | <div class="review-box-default" id="default-review-box-<?php echo $this->plugin_slug ?>"> |
| 198 | <p> |
| 199 | Hi there, it seems like <b><?php echo $this->plugin_name ?></b> is bringing you some value, and that's pretty awesome! Can you please show us some love and rate <?php echo $this->plugin_name ?> on WordPress? It'll only take 2 minutes of your time, and will really help us spread the word |
| 200 | - <b>Gal Dubinski</b>, Co-founder <img width="30px" src="<?php echo esc_url(plugin_dir_url(__FILE__)."../assets/images/premio-owner.png") ?>" /> |
| 201 | <a href="javascript:;" class="dismiss-btn <?php echo $this->plugin_slug ?>-premio-review-dismiss-btn"><span class="dashicons dashicons-no-alt"></span></a> |
| 202 | </p> |
| 203 | <div class="clear clearfix"></div> |
| 204 | <ul> |
| 205 | <li><a class="<?php echo $this->plugin_slug ?>-premio-review-box-hide-btn" href="https://wordpress.org/support/plugin/folders/reviews/?filter=5" target="_blank">I'd love to help :)</a></li> |
| 206 | <li><a class="<?php echo $this->plugin_slug ?>-premio-review-box-future-btn" href="javascript:;">Not this time</a></li> |
| 207 | <li><a class="<?php echo $this->plugin_slug ?>-premio-review-box-hide-btn" href="javascript:;">I've already rated you</a></li> |
| 208 | </ul> |
| 209 | </div> |
| 210 | <div class="review-thanks-box" id="review-thanks-<?php echo $this->plugin_slug ?>"> |
| 211 | <button class="<?php echo $this->plugin_slug ?>-close-thanks-btn review-thanks-btn"><span class="dashicons dashicons-no-alt"></span></button> |
| 212 | |
| 213 | <div class="review-thanks-img"> |
| 214 | <img width="30px" src="<?php echo esc_url(plugin_dir_url(__FILE__)."../assets/images/thanks.gif") ?>" /> |
| 215 | </div> |
| 216 | <div class="review-thanks-msg"> |
| 217 | <div class="thanks-msg-title">You are awesome 🙏</div> |
| 218 | <div class="thanks-msg-desc">Thanks for your support, We really appreciate it!</div> |
| 219 | <div class="thanks-msg-footer">Premio team</div> |
| 220 | </div> |
| 221 | <div class="clear clearfix"></div> |
| 222 | </div> |
| 223 | </div> |
| 224 | <div class="<?php echo $this->plugin_slug ?>-review-box-popup"> |
| 225 | <div class="<?php echo $this->plugin_slug ?>-review-box-popup-content"> |
| 226 | <button class="<?php echo $this->plugin_slug ?>-close-review-box-popup"><span class="dashicons dashicons-no-alt"></span></button> |
| 227 | <div class="<?php echo $this->plugin_slug ?>-review-box-title">Would you like us to remind you about this later?</div> |
| 228 | <div class="<?php echo $this->plugin_slug ?>-review-box-options"> |
| 229 | <a href="javascript:;" data-days="3">Remind me in 3 days</a> |
| 230 | <a href="javascript:;" data-days="10">Remind me in 10 days</a> |
| 231 | <a href="javascript:;" data-days="-1" class="dismiss">Don't remind me about this</a> |
| 232 | </div> |
| 233 | </div> |
| 234 | </div> |
| 235 | <script> |
| 236 | jQuery(document).ready(function(){ |
| 237 | jQuery("body").addClass("has-premio-box"); |
| 238 | jQuery(document).on("click", ".<?php echo $this->plugin_slug ?>-premio-review-dismiss-btn, .<?php echo $this->plugin_slug ?>-premio-review-box-future-btn", function(){ |
| 239 | jQuery(".<?php echo $this->plugin_slug ?>-review-box-popup").show(); |
| 240 | }); |
| 241 | jQuery(document).on("click", ".<?php echo $this->plugin_slug ?>-close-review-box-popup", function(){ |
| 242 | jQuery(".<?php echo $this->plugin_slug ?>-review-box-popup").hide(); |
| 243 | }); |
| 244 | jQuery(document).on("click", ".<?php echo $this->plugin_slug ?>-close-thanks-btn", function(){ |
| 245 | jQuery(".<?php echo $this->plugin_slug ?>-review-box-popup").remove(); |
| 246 | jQuery(".<?php echo $this->plugin_slug ?>-premio-review-box").remove(); |
| 247 | }); |
| 248 | jQuery(document).on("click",".<?php echo $this->plugin_slug ?>-premio-review-box-hide-btn",function(){ |
| 249 | jQuery("#default-review-box-<?php echo $this->plugin_slug ?>").hide(); |
| 250 | jQuery("#review-thanks-<?php echo $this->plugin_slug ?>").show(); |
| 251 | jQuery.ajax({ |
| 252 | url: "<?php echo admin_url("admin-ajax.php") ?>", |
| 253 | data: "action=<?php echo esc_attr($this->plugin_slug) ?>_review_box&days=-1&nonce=<?php echo esc_attr(wp_create_nonce($this->plugin_slug."_review_box")) ?>", |
| 254 | type: "post", |
| 255 | success: function() { |
| 256 | |
| 257 | } |
| 258 | }); |
| 259 | }); |
| 260 | jQuery(document).on("click", ".<?php echo $this->plugin_slug ?>-review-box-options a", function(){ |
| 261 | var dataDays = jQuery(this).attr("data-days"); |
| 262 | jQuery(".<?php echo $this->plugin_slug ?>-review-box-popup").remove(); |
| 263 | jQuery(".<?php echo $this->plugin_slug ?>-premio-review-box").remove(); |
| 264 | jQuery("body").removeClass("has-premio-box"); |
| 265 | jQuery.ajax({ |
| 266 | url: "<?php echo admin_url("admin-ajax.php") ?>", |
| 267 | data: "action=<?php echo esc_attr($this->plugin_slug) ?>_review_box&days="+dataDays+"&nonce=<?php echo esc_attr(wp_create_nonce($this->plugin_slug."_review_box")) ?>", |
| 268 | type: "post", |
| 269 | success: function() { |
| 270 | jQuery(".<?php echo $this->plugin_slug ?>-review-box-popup").remove(); |
| 271 | jQuery(".<?php echo $this->plugin_slug ?>-premio-review-box").remove(); |
| 272 | } |
| 273 | }); |
| 274 | }); |
| 275 | }); |
| 276 | </script> |
| 277 | <?php |
| 278 | } |
| 279 | } |
| 280 | $folders_review_box = new folders_review_box(); |