Edit File by line
/home/zeestwma/richards.../wp-conte.../plugins/chaty/includes
File: class-affiliate.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* Premio Affilate Class
[2] Fix | Delete
*
[3] Fix | Delete
* @author : Premio <contact@premio.io>
[4] Fix | Delete
* @license : GPL2
[5] Fix | Delete
* */
[6] Fix | Delete
[7] Fix | Delete
if (defined('ABSPATH') === false) {
[8] Fix | Delete
exit;
[9] Fix | Delete
}
[10] Fix | Delete
[11] Fix | Delete
class Chaty_Affiliate_Program
[12] Fix | Delete
{
[13] Fix | Delete
[14] Fix | Delete
/**
[15] Fix | Delete
* The Name of this plugin.
[16] Fix | Delete
*
[17] Fix | Delete
* @var string $pluginName The Name of this plugin.
[18] Fix | Delete
* @since 1.0.0
[19] Fix | Delete
* @access public
[20] Fix | Delete
*/
[21] Fix | Delete
public $pluginName = "Chaty";
[22] Fix | Delete
[23] Fix | Delete
/**
[24] Fix | Delete
* The Slug of this plugin.
[25] Fix | Delete
*
[26] Fix | Delete
* @var string $pluginSlug The Slug of this plugin.
[27] Fix | Delete
* @since 1.0.0
[28] Fix | Delete
* @access public
[29] Fix | Delete
*/
[30] Fix | Delete
public $pluginSlug = "chaty";
[31] Fix | Delete
[32] Fix | Delete
/**
[33] Fix | Delete
* __construct method initializes the object and adds action hooks.
[34] Fix | Delete
*
[35] Fix | Delete
* @return void
[36] Fix | Delete
*/
[37] Fix | Delete
public function __construct()
[38] Fix | Delete
{
[39] Fix | Delete
add_action("wp_ajax_".$this->pluginSlug."_affiliate_program", [$this, "affiliate_program"]);
[40] Fix | Delete
[41] Fix | Delete
add_action('admin_notices', [$this, 'admin_notices']);
[42] Fix | Delete
[43] Fix | Delete
}//end __construct()
[44] Fix | Delete
[45] Fix | Delete
[46] Fix | Delete
/**
[47] Fix | Delete
* affiliate_program method handles the affiliate program action.
[48] Fix | Delete
*
[49] Fix | Delete
* This method checks if the current user has the capability to manage options.
[50] Fix | Delete
* If the user has the capability, it retrieves the nonce and days values from the POST data.
[51] Fix | Delete
* Then, it verifies the nonce and performs the necessary actions based on the values.
[52] Fix | Delete
* If the days value is -1, it adds an option to hide the affiliate box.
[53] Fix | Delete
* Otherwise, it adds an option to set the date after which the affiliate box should be shown.
[54] Fix | Delete
*
[55] Fix | Delete
* @return void
[56] Fix | Delete
*/
[57] Fix | Delete
public function affiliate_program()
[58] Fix | Delete
{
[59] Fix | Delete
if (current_user_can('manage_options')) {
[60] Fix | Delete
$nonce = filter_input(INPUT_POST, 'nonce');
[61] Fix | Delete
$days = filter_input(INPUT_POST, 'days');
[62] Fix | Delete
if (!empty($nonce) && wp_verify_nonce($nonce, $this->pluginSlug."_affiliate_program")) {
[63] Fix | Delete
if ($days == -1) {
[64] Fix | Delete
add_option($this->pluginSlug."_hide_affiliate_box", "1");
[65] Fix | Delete
} else {
[66] Fix | Delete
$date = gmdate("Y-m-d", strtotime("+".$days." days"));
[67] Fix | Delete
update_option($this->pluginSlug."_show_affiliate_box_after", $date);
[68] Fix | Delete
}
[69] Fix | Delete
}
[70] Fix | Delete
[71] Fix | Delete
die;
[72] Fix | Delete
}
[73] Fix | Delete
[74] Fix | Delete
}//end affiliate_program()
[75] Fix | Delete
[76] Fix | Delete
[77] Fix | Delete
/**
[78] Fix | Delete
* admin_notices method displays notices in the admin area for users with the 'manage_options' capability.
[79] Fix | Delete
*
[80] Fix | Delete
* @return void
[81] Fix | Delete
*/
[82] Fix | Delete
public function admin_notices()
[83] Fix | Delete
{
[84] Fix | Delete
if (current_user_can('manage_options')) {
[85] Fix | Delete
$isHidden = get_option($this->pluginSlug."_hide_affiliate_box");
[86] Fix | Delete
if ($isHidden !== false) {
[87] Fix | Delete
return;
[88] Fix | Delete
}
[89] Fix | Delete
[90] Fix | Delete
$dateToShow = get_option($this->pluginSlug."_show_affiliate_box_after");
[91] Fix | Delete
if ($dateToShow === false || empty($dateToShow)) {
[92] Fix | Delete
$date = gmdate("Y-m-d", strtotime("+5 days"));
[93] Fix | Delete
update_option($this->pluginSlug."_show_affiliate_box_after", $date);
[94] Fix | Delete
return;
[95] Fix | Delete
}
[96] Fix | Delete
[97] Fix | Delete
$currentDate = gmdate("Y-m-d");
[98] Fix | Delete
if ($currentDate < $dateToShow) {
[99] Fix | Delete
return;
[100] Fix | Delete
}
[101] Fix | Delete
?>
[102] Fix | Delete
<style>
[103] Fix | Delete
.<?php echo esc_attr($this->pluginSlug) ?>-premio-affiliate p a {
[104] Fix | Delete
display: inline-block;
[105] Fix | Delete
float: right;
[106] Fix | Delete
text-decoration: none;
[107] Fix | Delete
color: #999999;
[108] Fix | Delete
position: absolute;
[109] Fix | Delete
right: 12px;
[110] Fix | Delete
top: 12px;
[111] Fix | Delete
}
[112] Fix | Delete
[113] Fix | Delete
.notice.chaty-premio-affiliate {
[114] Fix | Delete
display: block !important;
[115] Fix | Delete
}
[116] Fix | Delete
[117] Fix | Delete
.<?php echo esc_attr($this->pluginSlug) ?>-premio-affiliate p a:hover, .<?php echo esc_attr($this->pluginSlug) ?>-premio-affiliate p a:focus {
[118] Fix | Delete
color: #333333;
[119] Fix | Delete
}
[120] Fix | Delete
[121] Fix | Delete
.<?php echo esc_attr($this->pluginSlug) ?>-premio-affiliate .button span {
[122] Fix | Delete
display: inline-block;
[123] Fix | Delete
line-height: 27px;
[124] Fix | Delete
font-size: 16px;
[125] Fix | Delete
}
[126] Fix | Delete
[127] Fix | Delete
.<?php echo esc_attr($this->pluginSlug) ?>-premio-affiliate {
[128] Fix | Delete
padding: 1px 100px 12px 12px;
[129] Fix | Delete
margin: 15px 15px 2px;
[130] Fix | Delete
position: relative;
[131] Fix | Delete
}
[132] Fix | Delete
[133] Fix | Delete
.<?php echo esc_attr($this->pluginSlug) ?>-affiliate-popup {
[134] Fix | Delete
position: fixed;
[135] Fix | Delete
width: 100%;
[136] Fix | Delete
height: 100%;
[137] Fix | Delete
z-index: 10001;
[138] Fix | Delete
background: rgba(0, 0, 0, 0.65);
[139] Fix | Delete
top: 0;
[140] Fix | Delete
left: 0;
[141] Fix | Delete
display: none;
[142] Fix | Delete
}
[143] Fix | Delete
[144] Fix | Delete
.<?php echo esc_attr($this->pluginSlug) ?>-affiliate-popup-content {
[145] Fix | Delete
background: #ffffff;
[146] Fix | Delete
padding: 20px;
[147] Fix | Delete
position: absolute;
[148] Fix | Delete
max-width: 450px;
[149] Fix | Delete
width: 100%;
[150] Fix | Delete
margin: 0 auto;
[151] Fix | Delete
top: 45%;
[152] Fix | Delete
left: 0;
[153] Fix | Delete
right: 0;
[154] Fix | Delete
-webkit-border-radius: 5px;
[155] Fix | Delete
-moz-border-radius: 5px;
[156] Fix | Delete
border-radius: 5px;
[157] Fix | Delete
:;
[158] Fix | Delete
}
[159] Fix | Delete
[160] Fix | Delete
.<?php echo esc_attr($this->pluginSlug) ?>-affiliate-title {
[161] Fix | Delete
padding: 0 0 10px 0;
[162] Fix | Delete
font-weight: bold;
[163] Fix | Delete
}
[164] Fix | Delete
[165] Fix | Delete
.<?php echo esc_attr($this->pluginSlug) ?>-affiliate-options a {
[166] Fix | Delete
display: block;
[167] Fix | Delete
margin: 5px 0 5px 0;
[168] Fix | Delete
color: #333;
[169] Fix | Delete
text-decoration: none;
[170] Fix | Delete
}
[171] Fix | Delete
[172] Fix | Delete
.<?php echo esc_attr($this->pluginSlug) ?>-affiliate-options a.dismiss {
[173] Fix | Delete
color: #999;
[174] Fix | Delete
}
[175] Fix | Delete
[176] Fix | Delete
.<?php echo esc_attr($this->pluginSlug) ?>-affiliate-options a:hover, .affiliate-options a:focus {
[177] Fix | Delete
color: #0073aa;
[178] Fix | Delete
}
[179] Fix | Delete
[180] Fix | Delete
button.<?php echo esc_attr($this->pluginSlug) ?>-close-affiliate-popup {
[181] Fix | Delete
position: absolute;
[182] Fix | Delete
top: 5px;
[183] Fix | Delete
right: 0;
[184] Fix | Delete
border: none;
[185] Fix | Delete
background: transparent;
[186] Fix | Delete
cursor: pointer;
[187] Fix | Delete
}
[188] Fix | Delete
[189] Fix | Delete
a.button.button-primary.<?php echo esc_attr($this->pluginSlug) ?>-affiliate-btn {
[190] Fix | Delete
font-size: 14px;
[191] Fix | Delete
background: #F51366;
[192] Fix | Delete
color: #fff;
[193] Fix | Delete
border: solid 1px #F51366;
[194] Fix | Delete
border-radius: 3px;
[195] Fix | Delete
line-height: 24px;
[196] Fix | Delete
-webkit-box-shadow: 0 3px 5px -3px #333333;
[197] Fix | Delete
-moz-box-shadow: 0 3px 5px -3px #333333;
[198] Fix | Delete
box-shadow: 0 3px 5px -3px #333333;
[199] Fix | Delete
text-shadow: none;
[200] Fix | Delete
}
[201] Fix | Delete
</style>
[202] Fix | Delete
<div class="notice notice-info <?php echo esc_attr($this->pluginSlug) ?>-premio-affiliate <?php echo esc_attr($this->pluginSlug) ?>-premio-affiliate">
[203] Fix | Delete
<p>
[204] Fix | Delete
<?php printf(esc_html__("Hi there, you've been using %1\$s for a while now. Do you know that %2\$s has an affiliate program? Join now and get %3\$s", 'chaty'), "<b>".esc_attr($this->pluginName)."</b>", "<b>".esc_attr($this->pluginName)."</b>", "<b>25% lifetime commission</b>") ?>
[205] Fix | Delete
<a href="#" class="dismiss-btn"><span class="dashicons dashicons-no-alt"></span><?php esc_html_e("Dismiss", 'chaty')?></a>
[206] Fix | Delete
</p>
[207] Fix | Delete
<div class="clear clearfix"></div>
[208] Fix | Delete
<a class="button button-primary <?php echo esc_attr($this->pluginSlug) ?>-affiliate-btn" target="_blank" href="https://premio.io/affiliates/?utm_source=inapp&plugin=stars-testimonials&domain=<?php echo esc_attr($_SERVER['HTTP_HOST']) ?>"><?php esc_html_e("Tell me more", 'chaty') ?> <span class="dashicons dashicons-arrow-right-alt"></span></a>
[209] Fix | Delete
</div>
[210] Fix | Delete
<div class="<?php echo esc_attr($this->pluginSlug) ?>-affiliate-popup">
[211] Fix | Delete
<div class="<?php echo esc_attr($this->pluginSlug) ?>-affiliate-popup-content">
[212] Fix | Delete
<button class="<?php echo esc_attr($this->pluginSlug) ?>-close-affiliate-popup"><span class="dashicons dashicons-no-alt"></span></button>
[213] Fix | Delete
<div class="<?php echo esc_attr($this->pluginSlug) ?>-affiliate-title"><?php esc_html_e("Would you like us to remind you about this later?", 'chaty') ?></div>
[214] Fix | Delete
<div class="<?php echo esc_attr($this->pluginSlug) ?>-affiliate-options">
[215] Fix | Delete
<a href="#" data-days="3"><?php esc_html_e("Remind me in 3 days", 'chaty') ?></a>
[216] Fix | Delete
<a href="#" data-days="10"><?php esc_html_e("Remind me in 10 days", 'chaty') ?></a>
[217] Fix | Delete
<a href="#" data-days="-1" class="dismiss"><?php esc_html_e("Don't remind me about this", 'chaty') ?></a>
[218] Fix | Delete
</div>
[219] Fix | Delete
</div>
[220] Fix | Delete
</div>
[221] Fix | Delete
<script>
[222] Fix | Delete
jQuery(document).ready(function () {
[223] Fix | Delete
jQuery(document).on("click", ".<?php echo esc_attr($this->pluginSlug) ?>-premio-affiliate p a.dismiss-btn", function () {
[224] Fix | Delete
jQuery(".<?php echo esc_attr($this->pluginSlug) ?>-affiliate-popup").show();
[225] Fix | Delete
});
[226] Fix | Delete
jQuery(document).on("click", ".<?php echo esc_attr($this->pluginSlug) ?>-close-affiliate-popup", function () {
[227] Fix | Delete
jQuery(".<?php echo esc_attr($this->pluginSlug) ?>-affiliate-popup").hide();
[228] Fix | Delete
});
[229] Fix | Delete
jQuery(document).on("click", ".<?php echo esc_attr($this->pluginSlug) ?>-affiliate-options a", function () {
[230] Fix | Delete
var dataDays = jQuery(this).attr("data-days");
[231] Fix | Delete
jQuery(".<?php echo esc_attr($this->pluginSlug) ?>-affiliate-popup").hide();
[232] Fix | Delete
jQuery(".<?php echo esc_attr($this->pluginSlug) ?>-premio-affiliate").hide();
[233] Fix | Delete
jQuery.ajax({
[234] Fix | Delete
url: "<?php echo esc_url(admin_url("admin-ajax.php")) ?>",
[235] Fix | Delete
data: "action=<?php echo esc_attr($this->pluginSlug) ?>_affiliate_program&days=" + dataDays + "&nonce=<?php echo esc_attr(wp_create_nonce($this->pluginSlug."_affiliate_program")) ?>",
[236] Fix | Delete
type: "post",
[237] Fix | Delete
success: function () {
[238] Fix | Delete
jQuery(".<?php echo esc_attr($this->pluginSlug) ?>-affiliate-popup").remove();
[239] Fix | Delete
jQuery(".<?php echo esc_attr($this->pluginSlug) ?>-premio-affiliate").remove();
[240] Fix | Delete
}
[241] Fix | Delete
});
[242] Fix | Delete
});
[243] Fix | Delete
});
[244] Fix | Delete
</script>
[245] Fix | Delete
<?php
[246] Fix | Delete
}//end if
[247] Fix | Delete
[248] Fix | Delete
}//end admin_notices()
[249] Fix | Delete
[250] Fix | Delete
[251] Fix | Delete
}//end class
[252] Fix | Delete
[253] Fix | Delete
$chatyAffiliateProgram = new Chaty_Affiliate_Program();
[254] Fix | Delete
[255] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function