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