PluginProbe ʕ •ᴥ•ʔ
Folders – Unlimited Folders to Organize Media Library Folder, Pages, Posts, File Manager / 2.8.9
Folders – Unlimited Folders to Organize Media Library Folder, Pages, Posts, File Manager v2.8.9
3.1.9 3.1.8 3.1.7 2.9.3 2.9.4 2.9.5 2.9.6 2.9.7 2.9.8 3.0 3.0.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.1 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 trunk 1.3.7 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 2.2 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 2.2.7 2.2.8 2.2.9 2.3 2.3.1 2.3.2 2.3.3 2.3.4 2.3.5 2.3.6 2.3.7 2.3.8 2.3.9 2.4 2.4.1 2.4.2 2.4.3 2.4.4 2.4.5 2.4.6 2.4.7 2.4.8 2.4.9 2.5 2.5.1 2.5.2 2.5.3 2.5.4 2.5.5 2.5.6 2.5.7 2.5.8 2.5.9 2.6 2.6.1 2.6.2 2.6.3 2.6.4 2.6.5 2.6.6 2.6.7 2.6.8 2.6.9 2.7 2.7.1 2.7.2 2.7.3 2.7.4 2.7.5 2.8 2.8.1 2.8.2 2.8.3 2.8.4 2.8.5 2.8.6 2.8.7 2.8.8 2.8.9 2.9 2.9.1 2.9.2
folders / includes / class-affiliate.php
folders / includes Last commit date
class-affiliate.php 3 years ago class-polylang.php 3 years ago class-review-box.php 3 years ago class-upgrade-box.php 3 years ago class-wpml.php 3 years ago folders.class.php 3 years ago form.class.php 3 years ago media.replace.php 3 years ago plugins.class.php 3 years ago tree.class.php 3 years ago
class-affiliate.php
240 lines
1 <?php
2 /**
3 * Class Folders affiliate program
4 *
5 * @author : Premio <contact@premio.io>
6 * @license : GPL2
7 * */
8
9 if (! defined('ABSPATH')) {
10 exit;
11 }
12
13 class Folder_affiliate_program
14 {
15
16 /**
17 * The Name of this plugin.
18 *
19 * @var string $pluginName The Name of this plugin.
20 * @since 1.0.0
21 * @access public
22 */
23 public $pluginName = "Folders";
24
25 /**
26 * The Slug of this plugin.
27 *
28 * @var string $pluginSlug The Slug of this plugin.
29 * @since 1.0.0
30 * @access public
31 */
32 public $pluginSlug = "folders";
33
34
35 /**
36 * Define the core functionality of the plugin.
37 *
38 * Set the plugin name and the plugin version that can be used throughout the plugin.
39 * Load the dependencies, define the locale, and set the hooks for the admin area and
40 * the public-facing side of the site.
41 *
42 * @since 1.0.0
43 */
44 public function __construct()
45 {
46 add_action("wp_ajax_".$this->pluginSlug."_affiliate_program", [$this, "affiliate_program"]);
47
48 add_action('admin_notices', [$this, 'admin_notices']);
49
50 }//end __construct()
51
52
53 /**
54 * Updates settings for Affiliate Box
55 *
56 * @since 1.0.0
57 * @access public
58 * @return status
59 */
60 public function affiliate_program()
61 {
62 if (current_user_can('manage_options')) {
63 $nonce = filter_input(INPUT_POST, 'nonce');
64 $days = filter_input(INPUT_POST, 'days');
65 if (!empty($nonce) && wp_verify_nonce($nonce, $this->pluginSlug."_affiliate_program")) {
66 if ($days == -1) {
67 add_option($this->pluginSlug."_hide_affiliate_box", "1");
68 } else {
69 $date = date("Y-m-d", strtotime("+".$days." days"));
70 update_option($this->pluginSlug."_show_affiliate_box_after", $date);
71 }
72 }
73
74 die;
75 }
76
77 }//end affiliate_program()
78
79
80 /**
81 * Display Affiliate box
82 *
83 * @since 1.0.0
84 * @access public
85 * @return html
86 */
87 public function admin_notices()
88 {
89 if (current_user_can('manage_options')) {
90 $is_hidden = get_option($this->pluginSlug."_hide_affiliate_box");
91 if ($is_hidden !== false) {
92 return;
93 }
94
95 $date_to_show = get_option($this->pluginSlug."_show_affiliate_box_after");
96 if ($date_to_show === false || empty($date_to_show)) {
97 $date = date("Y-m-d", strtotime("+5 days"));
98 update_option($this->pluginSlug."_show_affiliate_box_after", $date);
99 return;
100 }
101
102 $current_date = date("Y-m-d");
103 if ($current_date < $date_to_show) {
104 return;
105 }
106 ?>
107 <style>
108 .<?php echo esc_attr($this->pluginSlug) ?>-premio-affiliate p a {
109 display: inline-block;
110 float: right;
111 text-decoration: none;
112 color: #999999;
113 position: absolute;
114 right: 12px;
115 top: 12px;
116 }
117 .<?php echo esc_attr($this->pluginSlug) ?>-premio-affiliate p a:hover, .<?php echo esc_attr($this->pluginSlug) ?>-premio-affiliate p a:focus {
118 color: #333333;
119 }
120 .<?php echo esc_attr($this->pluginSlug) ?>-premio-affiliate .button span {
121 display: inline-block;
122 line-height: 27px;
123 font-size: 16px;
124 }
125 .<?php echo esc_attr($this->pluginSlug) ?>-premio-affiliate {
126 padding: 1px 100px 12px 12px;
127 margin: 15px 15px 2px;
128 position: relative;
129 }
130 .<?php echo esc_attr($this->pluginSlug) ?>-affiliate-popup {
131 position: fixed;
132 width: 100%;
133 height: 100%;
134 z-index: 10001;
135 background: rgba(0,0,0,0.65);
136 top: 0;
137 left: 0;
138 display: none;
139 }
140 .<?php echo esc_attr($this->pluginSlug) ?>-affiliate-popup-content {
141 background: #ffffff;
142 padding: 20px;
143 position: absolute;
144 max-width: 450px;
145 width: 100%;
146 margin: 0 auto;
147 top: 45%;
148 left: 0;
149 right: 0;
150 -webkit-border-radius: 5px;
151 -moz-border-radius: 5px;
152 border-radius: 5px;
153 }
154 .<?php echo esc_attr($this->pluginSlug) ?>-affiliate-title {
155 padding: 0 0 10px 0;
156 font-weight: bold;
157 }
158 .<?php echo esc_attr($this->pluginSlug) ?>-affiliate-options a {
159 display: block;
160 margin: 5px 0 5px 0;
161 color: #333;
162 text-decoration: none;
163 }
164 .<?php echo esc_attr($this->pluginSlug) ?>-affiliate-options a.dismiss {
165 color: #999;
166 }
167 .<?php echo esc_attr($this->pluginSlug) ?>-affiliate-options a:hover, .affiliate-options a:focus {
168 color: #0073aa;
169 }
170 button.<?php echo esc_attr($this->pluginSlug) ?>-close-affiliate-popup {
171 position: absolute;
172 top: 5px;
173 right: 0;
174 border: none;
175 background: transparent;
176 cursor: pointer;
177 }
178 a.button.button-primary.<?php echo esc_attr($this->pluginSlug) ?>-affiliate-btn {
179 font-size: 14px;
180 background: #F51366;
181 color: #fff;
182 border: solid 1px #F51366;
183 border-radius: 3px;
184 line-height: 24px;
185 -webkit-box-shadow: 0 3px 5px -3px #333333;
186 -moz-box-shadow: 0 3px 5px -3px #333333;
187 box-shadow: 0 3px 5px -3px #333333;
188 text-shadow: none;
189 }
190 </style>
191 <div class="notice notice-info chaty-notice <?php echo esc_attr($this->pluginSlug) ?>-premio-affiliate <?php echo esc_attr($this->pluginSlug) ?>-premio-affiliate">
192 <p><?php printf(esc_html__("Hi there, you've been using %s for a while now. Do you know that %s has an affiliate program? Join now and get %s ", "folders"), $this->pluginName, "<b>".$this->pluginName."</b>", "<b>".esc_html__("25% lifetime commission", "folders")."</b>") ?> <a href="javascript:;" class="dismiss-btn"><span class="dashicons dashicons-no-alt"></span> <?php esc_html_e("Dismiss", "folders") ?></a></p>
193 <div class="clear clearfix"></div>
194 <a class="button button-primary <?php echo esc_attr($this->pluginSlug) ?>-affiliate-btn" target="_blank" href="https://premio.io/affiliates/?utm_source=inapp&plugin=folders&domain=<?php echo esc_url($_SERVER['HTTP_HOST']) ?>"><?php esc_html_e("Tell me more", "folders") ?> <span class="dashicons dashicons-arrow-right-alt"></span></a>
195 </div>
196 <div class="<?php echo esc_attr($this->pluginSlug) ?>-affiliate-popup">
197 <div class="<?php echo esc_attr($this->pluginSlug) ?>-affiliate-popup-content">
198 <button class="<?php echo esc_attr($this->pluginSlug) ?>-close-affiliate-popup"><span class="dashicons dashicons-no-alt"></span></button>
199 <div class="<?php echo esc_attr($this->pluginSlug) ?>-affiliate-title"><?php esc_html_e("Would you like us to remind you about this later?", "folders") ?></div>
200 <div class="<?php echo esc_attr($this->pluginSlug) ?>-affiliate-options">
201 <a href="javascript:;" data-days="3"><?php esc_html_e("Remind me in 3 days", "folders") ?></a>
202 <a href="javascript:;" data-days="10"><?php esc_html_e("Remind me in 10 days", "folders") ?></a>
203 <a href="javascript:;" data-days="-1" class="dismiss"><?php esc_html_e("Don't remind me about this", "folders") ?></a>
204 </div>
205 </div>
206 </div>
207 <script>
208 jQuery(document).ready(function(){
209 jQuery(document).on("click", ".<?php echo esc_attr($this->pluginSlug) ?>-premio-affiliate p a.dismiss-btn", function(){
210 jQuery(".<?php echo esc_attr($this->pluginSlug) ?>-affiliate-popup").show();
211 });
212 jQuery(document).on("click", ".<?php echo esc_attr($this->pluginSlug) ?>-close-affiliate-popup", function(){
213 jQuery(".<?php echo esc_attr($this->pluginSlug) ?>-affiliate-popup").hide();
214 });
215 jQuery(document).on("click", ".<?php echo esc_attr($this->pluginSlug) ?>-affiliate-options a", function(){
216 var dataDays = jQuery(this).attr("data-days");
217 jQuery(".<?php echo esc_attr($this->pluginSlug) ?>-affiliate-popup").hide();
218 jQuery(".<?php echo esc_attr($this->pluginSlug) ?>-premio-affiliate").hide();
219 jQuery.ajax({
220 url: "<?php echo admin_url("admin-ajax.php") ?>",
221 data: "action=<?php echo esc_attr($this->pluginSlug) ?>_affiliate_program&days="+dataDays+"&nonce=<?php echo esc_attr(wp_create_nonce($this->pluginSlug."_affiliate_program")) ?>",
222 type: "post",
223 success: function() {
224 jQuery(".<?php echo esc_attr($this->pluginSlug) ?>-affiliate-popup").remove();
225 jQuery(".<?php echo esc_attr($this->pluginSlug) ?>-premio-affiliate").remove();
226 }
227 });
228 });
229 });
230 </script>
231 <?php
232 }//end if
233
234 }//end admin_notices()
235
236
237 }//end class
238
239 $Folder_affiliate_program = new Folder_affiliate_program();
240