mystickymenu
Last commit date
css
6 years ago
fonts
7 years ago
images
6 years ago
js
6 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-fonts.php
6 years ago
mystickymenu.php
6 years ago
readme.txt
6 years ago
uninstall.php
7 years ago
welcome-bar.php
6 years ago
class-review-box.php
211 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 | </style> |
| 155 | <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"> |
| 156 | <p> |
| 157 | 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 |
| 158 | - <b>Gal Dubinski</b>, Co-founder <img width="30px" src="<?php echo esc_url(plugin_dir_url(__FILE__)."images/premio-owner.png") ?>" /> |
| 159 | <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> |
| 160 | </p> |
| 161 | <div class="clear clearfix"></div> |
| 162 | <ul> |
| 163 | <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> |
| 164 | <li><a class="<?php echo esc_attr($this->plugin_slug) ?>-premio-review-box-future-btn" href="javascript:;">Not this time</a></li> |
| 165 | <li><a class="<?php echo esc_attr($this->plugin_slug) ?>-premio-review-box-hide-btn" href="javascript:;">I've already rated you</a></li> |
| 166 | </ul> |
| 167 | </div> |
| 168 | <div class="<?php echo esc_attr($this->plugin_slug) ?>-review-box-popup"> |
| 169 | <div class="<?php echo esc_attr($this->plugin_slug) ?>-review-box-popup-content"> |
| 170 | <button class="<?php echo esc_attr($this->plugin_slug) ?>-close-review-box-popup"><span class="dashicons dashicons-no-alt"></span></button> |
| 171 | <div class="<?php echo esc_attr($this->plugin_slug) ?>-review-box-title">Would you like us to remind you about this later?</div> |
| 172 | <div class="<?php echo esc_attr($this->plugin_slug) ?>-review-box-options"> |
| 173 | <a href="javascript:;" data-days="3">Remind me in 3 days</a> |
| 174 | <a href="javascript:;" data-days="10">Remind me in 10 days</a> |
| 175 | <a href="javascript:;" data-days="-1" class="dismiss">Don't remind me about this</a> |
| 176 | </div> |
| 177 | </div> |
| 178 | </div> |
| 179 | <script> |
| 180 | jQuery(document).ready(function(){ |
| 181 | jQuery("body").addClass("has-premio-box"); |
| 182 | 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(){ |
| 183 | jQuery(".<?php echo esc_attr($this->plugin_slug) ?>-review-box-popup").show(); |
| 184 | }); |
| 185 | jQuery(document).on("click", ".<?php echo esc_attr($this->plugin_slug) ?>-close-review-box-popup", function(){ |
| 186 | jQuery(".<?php echo esc_attr($this->plugin_slug) ?>-review-box-popup").hide(); |
| 187 | }); |
| 188 | jQuery(document).on("click",".<?php echo esc_attr($this->plugin_slug) ?>-premio-review-box-hide-btn",function(){ |
| 189 | jQuery(".<?php echo esc_attr($this->plugin_slug) ?>-review-box-options a:last").trigger("click"); |
| 190 | }); |
| 191 | jQuery(document).on("click", ".<?php echo esc_attr($this->plugin_slug) ?>-review-box-options a", function(){ |
| 192 | var dataDays = jQuery(this).attr("data-days"); |
| 193 | jQuery(".<?php echo esc_attr($this->plugin_slug) ?>-review-box-popup").remove(); |
| 194 | jQuery(".<?php echo esc_attr($this->plugin_slug) ?>-premio-review-box").remove(); |
| 195 | jQuery("body").removeClass("has-premio-box"); |
| 196 | jQuery.ajax({ |
| 197 | url: "<?php echo admin_url("admin-ajax.php") ?>", |
| 198 | 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")) ?>", |
| 199 | type: "post", |
| 200 | success: function() { |
| 201 | jQuery(".<?php echo esc_attr($this->plugin_slug) ?>-review-box-popup").remove(); |
| 202 | jQuery(".<?php echo esc_attr($this->plugin_slug) ?>-premio-review-box").remove(); |
| 203 | } |
| 204 | }); |
| 205 | }); |
| 206 | }); |
| 207 | </script> |
| 208 | <?php |
| 209 | } |
| 210 | } |
| 211 | $myStickymenu_review_box = new myStickymenu_review_box(); |