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