Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/wp-conte.../plugins/content-.../inc/freemius/template.../forms
File: affiliation.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* @package Freemius
[2] Fix | Delete
* @copyright Copyright (c) 2015, Freemius, Inc.
[3] Fix | Delete
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
[4] Fix | Delete
* @since 1.2.3
[5] Fix | Delete
*/
[6] Fix | Delete
[7] Fix | Delete
if ( ! defined( 'ABSPATH' ) ) {
[8] Fix | Delete
exit;
[9] Fix | Delete
}
[10] Fix | Delete
[11] Fix | Delete
/**
[12] Fix | Delete
* @var array $VARS
[13] Fix | Delete
* @var Freemius $fs
[14] Fix | Delete
* @var string $plugin_title
[15] Fix | Delete
*/
[16] Fix | Delete
$fs = freemius( $VARS['id'] );
[17] Fix | Delete
$plugin_title = $VARS['plugin_title'];
[18] Fix | Delete
[19] Fix | Delete
$slug = $fs->get_slug();
[20] Fix | Delete
[21] Fix | Delete
$user = $fs->get_user();
[22] Fix | Delete
$affiliate = $fs->get_affiliate();
[23] Fix | Delete
$affiliate_terms = $fs->get_affiliate_terms();
[24] Fix | Delete
[25] Fix | Delete
$module_type = $fs->is_plugin() ?
[26] Fix | Delete
WP_FS__MODULE_TYPE_PLUGIN :
[27] Fix | Delete
WP_FS__MODULE_TYPE_THEME;
[28] Fix | Delete
[29] Fix | Delete
$commission = $affiliate_terms->get_formatted_commission();
[30] Fix | Delete
[31] Fix | Delete
$readonly = false;
[32] Fix | Delete
$is_affiliate = is_object( $affiliate );
[33] Fix | Delete
$is_pending_affiliate = false;
[34] Fix | Delete
$email_address = ( is_object( $user ) ?
[35] Fix | Delete
$user->email :
[36] Fix | Delete
'' );
[37] Fix | Delete
$full_name = ( is_object( $user ) ?
[38] Fix | Delete
$user->get_name() :
[39] Fix | Delete
'' );
[40] Fix | Delete
$paypal_email_address = '';
[41] Fix | Delete
$domain = '';
[42] Fix | Delete
$extra_domains = array();
[43] Fix | Delete
$promotion_method_social_media = false;
[44] Fix | Delete
$promotion_method_mobile_apps = false;
[45] Fix | Delete
$statistics_information = false;
[46] Fix | Delete
$promotion_method_description = false;
[47] Fix | Delete
$members_dashboard_login_url = 'https://users.freemius.com/login';
[48] Fix | Delete
[49] Fix | Delete
$affiliate_application_data = $fs->get_affiliate_application_data();
[50] Fix | Delete
[51] Fix | Delete
if ( $is_affiliate && $affiliate->is_pending() ) {
[52] Fix | Delete
$readonly = 'readonly';
[53] Fix | Delete
$is_pending_affiliate = true;
[54] Fix | Delete
[55] Fix | Delete
$paypal_email_address = $affiliate->paypal_email;
[56] Fix | Delete
$domain = $affiliate->domain;
[57] Fix | Delete
$statistics_information = $affiliate_application_data['stats_description'];
[58] Fix | Delete
$promotion_method_description = $affiliate_application_data['promotion_method_description'];
[59] Fix | Delete
[60] Fix | Delete
if ( ! empty( $affiliate_application_data['additional_domains'] ) ) {
[61] Fix | Delete
$extra_domains = $affiliate_application_data['additional_domains'];
[62] Fix | Delete
}
[63] Fix | Delete
[64] Fix | Delete
if ( ! empty( $affiliate_application_data['promotion_methods'] ) ) {
[65] Fix | Delete
$promotion_methods = explode( ',', $affiliate_application_data['promotion_methods'] );
[66] Fix | Delete
$promotion_method_social_media = in_array( 'social_media', $promotion_methods );
[67] Fix | Delete
$promotion_method_mobile_apps = in_array( 'mobile_apps', $promotion_methods );
[68] Fix | Delete
}
[69] Fix | Delete
} else {
[70] Fix | Delete
if ( ! is_object( $user ) ) {
[71] Fix | Delete
$current_user = Freemius::_get_current_wp_user();
[72] Fix | Delete
$full_name = trim( $current_user->user_firstname . ' ' . $current_user->user_lastname );
[73] Fix | Delete
$email_address = $current_user->user_email;
[74] Fix | Delete
}
[75] Fix | Delete
[76] Fix | Delete
$domain = Freemius::get_unfiltered_site_url( null, true );
[77] Fix | Delete
}
[78] Fix | Delete
[79] Fix | Delete
$affiliate_tracking = 30;
[80] Fix | Delete
[81] Fix | Delete
if ( is_object( $affiliate_terms ) ) {
[82] Fix | Delete
$affiliate_tracking = ( ! is_null( $affiliate_terms->cookie_days ) ?
[83] Fix | Delete
( $affiliate_terms->cookie_days . '-day' ) :
[84] Fix | Delete
fs_text_inline( 'Non-expiring', 'non-expiring', $slug ) );
[85] Fix | Delete
}
[86] Fix | Delete
[87] Fix | Delete
$apply_to_become_affiliate_text = fs_text_inline( 'Apply to become an affiliate', 'apply-to-become-an-affiliate', $slug );
[88] Fix | Delete
[89] Fix | Delete
$module_id = $fs->get_id();
[90] Fix | Delete
$affiliate_program_terms_url = "https://freemius.com/plugin/{$module_id}/{$slug}/legal/affiliate-program/";
[91] Fix | Delete
[92] Fix | Delete
$has_tabs = $fs->_add_tabs_before_content();
[93] Fix | Delete
?>
[94] Fix | Delete
<div id="fs_affiliation_content_wrapper" class="wrap">
[95] Fix | Delete
<form method="post" action="">
[96] Fix | Delete
<div id="poststuff">
[97] Fix | Delete
<div class="postbox">
[98] Fix | Delete
<div class="inside">
[99] Fix | Delete
<div id="messages">
[100] Fix | Delete
<div id="error_message" class="error" style="display: none">
[101] Fix | Delete
<p><strong></strong></p>
[102] Fix | Delete
</div>
[103] Fix | Delete
<div id="message" class="updated" style="display: none">
[104] Fix | Delete
<p><strong></strong></p>
[105] Fix | Delete
</div>
[106] Fix | Delete
<?php if ( $is_affiliate ) : ?>
[107] Fix | Delete
<?php if ( $affiliate->is_active() ) : ?>
[108] Fix | Delete
<div class="updated">
[109] Fix | Delete
<p><strong><?php
[110] Fix | Delete
echo sprintf(
[111] Fix | Delete
fs_esc_html_inline( "Your affiliate application for %s has been accepted! Log in to your affiliate area at: %s.", 'affiliate-application-accepted', $slug ),
[112] Fix | Delete
$plugin_title,
[113] Fix | Delete
sprintf(
[114] Fix | Delete
'<a href="%s" target="_blank" rel="noopener">%s</a>',
[115] Fix | Delete
$members_dashboard_login_url,
[116] Fix | Delete
$members_dashboard_login_url
[117] Fix | Delete
)
[118] Fix | Delete
);
[119] Fix | Delete
?></strong></p>
[120] Fix | Delete
</div>
[121] Fix | Delete
<?php else : ?>
[122] Fix | Delete
<?php
[123] Fix | Delete
$message_text = '';
[124] Fix | Delete
[125] Fix | Delete
if ( $is_pending_affiliate ) {
[126] Fix | Delete
$message_text = fs_text_inline( "Thank you for applying for our affiliate program, we'll review your details during the next 14 days and will get back to you with further information.", 'affiliate-application-thank-you', $slug );
[127] Fix | Delete
$message_container_class = 'updated';
[128] Fix | Delete
} else if ( $affiliate->is_suspended() ) {
[129] Fix | Delete
$message_text = fs_text_inline( 'Your affiliation account was temporarily suspended.', 'affiliate-account-suspended', $slug );
[130] Fix | Delete
$message_container_class = 'notice notice-warning';
[131] Fix | Delete
} else if ( $affiliate->is_rejected() ) {
[132] Fix | Delete
$message_text = fs_text_inline( "Thank you for applying for our affiliate program, unfortunately, we've decided at this point to reject your application. Please try again in 30 days.", 'affiliate-application-rejected', $slug );
[133] Fix | Delete
$message_container_class = 'error';
[134] Fix | Delete
} else if ( $affiliate->is_blocked() ) {
[135] Fix | Delete
$message_text = fs_text_inline( 'Due to violation of our affiliation terms, we decided to temporarily block your affiliation account. If you have any questions, please contact support.', 'affiliate-account-blocked', $slug );
[136] Fix | Delete
$message_container_class = 'error';
[137] Fix | Delete
}
[138] Fix | Delete
?>
[139] Fix | Delete
<div class="<?php echo $message_container_class ?>">
[140] Fix | Delete
<p><strong><?php echo esc_html( $message_text ) ?></strong></p>
[141] Fix | Delete
</div>
[142] Fix | Delete
<?php endif ?>
[143] Fix | Delete
<?php endif ?>
[144] Fix | Delete
</div>
[145] Fix | Delete
<div class="entry-content">
[146] Fix | Delete
<?php if ( ! $is_affiliate ) : ?>
[147] Fix | Delete
<div id="application_messages_container">
[148] Fix | Delete
<p><?php echo esc_html( sprintf( fs_text_inline( 'Like the %s? Become our ambassador and earn cash ;-)', 'become-an-ambassador', $slug ), $module_type ) ) ?></p>
[149] Fix | Delete
<p><?php echo esc_html( sprintf( fs_text_inline( 'Refer new customers to our %s and earn %s commission on each successful sale you refer!', 'refer-new-customers', $slug ), $module_type, $commission ) ) ?></p>
[150] Fix | Delete
</div>
[151] Fix | Delete
<?php endif ?>
[152] Fix | Delete
<h3><?php fs_esc_html_echo_inline( 'Program Summary', 'program-summary', $slug ) ?></h3>
[153] Fix | Delete
<ul>
[154] Fix | Delete
<li><?php echo esc_html( sprintf( fs_text_inline( '%s commission when a customer purchases a new license.', 'commission-on-new-license-purchase', $slug ), $commission ) ) ?></li>
[155] Fix | Delete
<?php if ( is_object( $affiliate_terms ) && $affiliate_terms->has_renewals_commission() ) : ?>
[156] Fix | Delete
<li><?php echo esc_html( sprintf( fs_text_inline( 'Get commission for automated subscription renewals.', 'renewals-commission', $slug ) ) ) ?></li>
[157] Fix | Delete
<?php endif ?>
[158] Fix | Delete
<?php if ( is_object( $affiliate_terms ) && ( ! $affiliate_terms->is_session_cookie() ) ) : ?>
[159] Fix | Delete
<li><?php echo esc_html( sprintf( fs_text_inline( '%s tracking cookie after the first visit to maximize earnings potential.', 'affiliate-tracking', $slug ), $affiliate_tracking ) ) ?></li>
[160] Fix | Delete
<?php endif ?>
[161] Fix | Delete
<?php if ( is_object( $affiliate_terms ) && $affiliate_terms->has_lifetime_commission() ) : ?>
[162] Fix | Delete
<li><?php fs_esc_html_echo_inline( 'Unlimited commissions.', 'unlimited-commissions', $slug ) ?></li>
[163] Fix | Delete
<?php endif ?>
[164] Fix | Delete
<li><?php echo esc_html( sprintf( fs_text_inline( '%s minimum payout amount.', 'minimum-payout-amount', $slug ), '$100' ) ) ?></li>
[165] Fix | Delete
<li><?php fs_esc_html_echo_inline( 'Payouts are in USD and processed monthly via PayPal.', 'payouts-unit-and-processing', $slug ) ?></li>
[166] Fix | Delete
<li><?php fs_esc_html_echo_inline( 'As we reserve 30 days for potential refunds, we only pay commissions that are older than 30 days.', 'commission-payment', $slug ) ?></li>
[167] Fix | Delete
</ul>
[168] Fix | Delete
<div id="application_form_container" <?php echo ( $is_pending_affiliate ) ? '' : 'style="display: none"' ?>>
[169] Fix | Delete
<h3><?php fs_esc_html_echo_inline( 'Affiliate', 'affiliate', $slug ) ?></h3>
[170] Fix | Delete
<form>
[171] Fix | Delete
<div class="input-container input-container-text">
[172] Fix | Delete
<label class="input-label"><?php fs_esc_html_echo_inline( 'Email address', 'email-address', $slug ) ?></label>
[173] Fix | Delete
<input id="email_address" type="text" value="<?php echo esc_attr( $email_address ) ?>" class="regular-text" <?php echo ( $readonly || is_object( $user ) ) ? 'readonly' : '' ?>>
[174] Fix | Delete
</div>
[175] Fix | Delete
<div class="input-container input-container-text">
[176] Fix | Delete
<label class="input-label"><?php fs_esc_html_echo_inline( 'Full name', 'full-name', $slug ) ?></label>
[177] Fix | Delete
<input id="full_name" type="text" value="<?php echo esc_attr( $full_name ) ?>" class="regular-text" <?php echo $readonly ?>>
[178] Fix | Delete
</div>
[179] Fix | Delete
<div class="input-container input-container-text">
[180] Fix | Delete
<label class="input-label"><?php fs_esc_html_echo_inline( 'PayPal account email address', 'paypal-account-email-address', $slug ) ?></label>
[181] Fix | Delete
<input id="paypal_email" type="text" value="<?php echo esc_attr( $paypal_email_address ) ?>" class="regular-text" <?php echo $readonly ?>>
[182] Fix | Delete
</div>
[183] Fix | Delete
<div class="input-container input-container-text">
[184] Fix | Delete
<label class="input-label"><?php echo esc_html( sprintf( fs_text_inline( 'Where are you going to promote the %s?', 'domain-field-label', $slug ), $module_type ) ) ?></label>
[185] Fix | Delete
<input id="domain" type="text" value="<?php echo esc_attr( $domain ) ?>" class="domain regular-text" <?php echo $readonly ?>>
[186] Fix | Delete
<p class="description"><?php echo esc_html( sprintf( fs_text_inline( 'Enter the domain of your website or other websites from where you plan to promote the %s.', 'domain-field-desc', $slug ), $module_type ) ) ?></p>
[187] Fix | Delete
<?php if ( ! $is_affiliate ) : ?>
[188] Fix | Delete
<a id="add_domain" href="#" class="disabled">+ <?php fs_esc_html_echo_inline( 'Add another domain', 'add-another-domain', $slug ) ?>...</a>
[189] Fix | Delete
<?php endif ?>
[190] Fix | Delete
</div>
[191] Fix | Delete
<div id="extra_domains_container" class="input-container input-container-text" <?php echo $is_pending_affiliate ? '' : 'style="display: none"' ?>>
[192] Fix | Delete
<label class="input-label"><?php fs_esc_html_echo_inline( 'Extra Domains', 'extra-domain-fields-label', $slug ) ?></label>
[193] Fix | Delete
<p class="description"><?php fs_esc_html_echo_inline( 'Extra domains where you will be marketing the product from.', 'extra-domain-fields-desc', $slug ) ?></p>
[194] Fix | Delete
<?php if ( $is_pending_affiliate && ! empty( $extra_domains ) ) : ?>
[195] Fix | Delete
<?php foreach ( $extra_domains as $extra_domain ) : ?>
[196] Fix | Delete
<div class="extra-domain-input-container">
[197] Fix | Delete
<input type="text" value="<?php echo esc_attr( $extra_domain ) ?>" class="domain regular-text" <?php echo $readonly ?>>
[198] Fix | Delete
</div>
[199] Fix | Delete
<?php endforeach ?>
[200] Fix | Delete
<?php endif ?>
[201] Fix | Delete
</div>
[202] Fix | Delete
<div class="input-container">
[203] Fix | Delete
<label class="input-label"><?php fs_esc_html_echo_inline( 'Promotion methods', 'promotion-methods', $slug ) ?></label>
[204] Fix | Delete
<div>
[205] Fix | Delete
<input id="promotion_method_social_media" type="checkbox" <?php checked( $promotion_method_social_media ) ?> <?php disabled( $is_affiliate ) ?>/>
[206] Fix | Delete
<label for="promotion_method_social_media"><?php fs_esc_html_echo_inline( 'Social media (Facebook, Twitter, etc.)', 'social-media', $slug ) ?></label>
[207] Fix | Delete
</div>
[208] Fix | Delete
<div>
[209] Fix | Delete
<input id="promotion_method_mobile_apps" type="checkbox" <?php checked( $promotion_method_mobile_apps ) ?> <?php disabled( $is_affiliate ) ?>/>
[210] Fix | Delete
<label for="promotion_method_mobile_apps"><?php fs_esc_html_echo_inline( 'Mobile apps', 'mobile-apps', $slug ) ?></label>
[211] Fix | Delete
</div>
[212] Fix | Delete
</div>
[213] Fix | Delete
<div class="input-container input-container-text">
[214] Fix | Delete
<label class="input-label"><nobr><?php fs_esc_html_echo_inline( 'Website, email, and social media statistics (optional)', 'statistics-information-field-label', $slug ) ?></nobr></label>
[215] Fix | Delete
<textarea id="statistics_information" rows="5" <?php echo $readonly ?> class="regular-text"><?php echo $statistics_information ?></textarea>
[216] Fix | Delete
<?php if ( ! $is_affiliate ) : ?>
[217] Fix | Delete
<p class="description"><?php fs_esc_html_echo_inline( 'Please feel free to provide any relevant website or social media statistics, e.g. monthly unique site visits, number of email subscribers, followers, etc. (we will keep this information confidential).', 'statistics-information-field-desc', $slug ) ?></p>
[218] Fix | Delete
<?php endif ?>
[219] Fix | Delete
</div>
[220] Fix | Delete
<div class="input-container input-container-text">
[221] Fix | Delete
<label class="input-label"><?php fs_esc_html_echo_inline( 'How will you promote us?', 'promotion-method-desc-field-label', $slug ) ?></label>
[222] Fix | Delete
<textarea id="promotion_method_description" rows="5" <?php echo $readonly ?> class="regular-text"><?php echo $promotion_method_description ?></textarea>
[223] Fix | Delete
<?php if ( ! $is_affiliate ) : ?>
[224] Fix | Delete
<p class="description"><?php echo esc_html( sprintf( fs_text_inline( 'Please provide details on how you intend to promote %s (please be as specific as possible).', 'promotion-method-desc-field-desc', $slug ), $plugin_title ) ) ?></p>
[225] Fix | Delete
<?php endif ?>
[226] Fix | Delete
</div>
[227] Fix | Delete
<?php if ( ! $is_affiliate ) : ?>
[228] Fix | Delete
<div>
[229] Fix | Delete
<input type="checkbox" id="legal_consent_checkbox">
[230] Fix | Delete
<label for="legal_consent_checkbox">I agree to the <a href="<?php echo $affiliate_program_terms_url ?>" target="_blank" rel="noopener">Referrer Program</a>'s terms & conditions.</label>
[231] Fix | Delete
</div>
[232] Fix | Delete
<?php endif ?>
[233] Fix | Delete
</form>
[234] Fix | Delete
</div>
[235] Fix | Delete
<?php if ( ! $is_affiliate ) : ?>
[236] Fix | Delete
<a id="cancel_button" href="#" class="button button-secondary button-cancel" style="display: none"><?php fs_esc_html_echo_inline( 'Cancel', 'cancel', $slug ) ?></a>
[237] Fix | Delete
<a id="submit_button" class="button button-primary disabled" href="#" style="display: none"><?php echo esc_html( $apply_to_become_affiliate_text ) ?></a>
[238] Fix | Delete
<a id="apply_button" class="button button-primary" href="#"><?php fs_esc_html_echo_inline( 'Become an affiliate', 'become-an-affiliate', $slug ) ?></a>
[239] Fix | Delete
<?php endif ?>
[240] Fix | Delete
</div>
[241] Fix | Delete
</div>
[242] Fix | Delete
</div>
[243] Fix | Delete
</div>
[244] Fix | Delete
</form>
[245] Fix | Delete
<script type="text/javascript">
[246] Fix | Delete
jQuery(function ($) {
[247] Fix | Delete
var
[248] Fix | Delete
$contentWrapper = $('#fs_affiliation_content_wrapper'),
[249] Fix | Delete
$socialMedia = $('#promotion_method_social_media'),
[250] Fix | Delete
$mobileApps = $('#promotion_method_mobile_apps'),
[251] Fix | Delete
$applyButton = $('#apply_button'),
[252] Fix | Delete
$submitButton = $('#submit_button'),
[253] Fix | Delete
$cancelButton = $('#cancel_button'),
[254] Fix | Delete
$applicationFormContainer = $('#application_form_container'),
[255] Fix | Delete
$errorMessageContainer = $('#error_message'),
[256] Fix | Delete
$domain = $('#domain'),
[257] Fix | Delete
$addDomain = $('#add_domain'),
[258] Fix | Delete
$extraDomainsContainer = $('#extra_domains_container'),
[259] Fix | Delete
$legalConsentCheckbox = $( '#legal_consent_checkbox' );
[260] Fix | Delete
[261] Fix | Delete
$applyButton.click(function (evt) {
[262] Fix | Delete
evt.preventDefault();
[263] Fix | Delete
[264] Fix | Delete
var $this = $(this);
[265] Fix | Delete
$this.hide();
[266] Fix | Delete
[267] Fix | Delete
$applicationFormContainer.show();
[268] Fix | Delete
$cancelButton.show();
[269] Fix | Delete
$submitButton.show();
[270] Fix | Delete
[271] Fix | Delete
$contentWrapper.find('input[type="text"]:first').focus();
[272] Fix | Delete
});
[273] Fix | Delete
[274] Fix | Delete
$submitButton.click(function (evt) {
[275] Fix | Delete
evt.preventDefault();
[276] Fix | Delete
[277] Fix | Delete
var $this = $(this);
[278] Fix | Delete
[279] Fix | Delete
if ($this.hasClass('disabled')) {
[280] Fix | Delete
return;
[281] Fix | Delete
}
[282] Fix | Delete
[283] Fix | Delete
$errorMessageContainer.hide();
[284] Fix | Delete
[285] Fix | Delete
var
[286] Fix | Delete
$emailAddress = $('#email_address'),
[287] Fix | Delete
emailAddress = null,
[288] Fix | Delete
paypalEmailAddress = $('#paypal_email').val().trim();
[289] Fix | Delete
[290] Fix | Delete
if (1 === $emailAddress.length) {
[291] Fix | Delete
emailAddress = $emailAddress.val().trim();
[292] Fix | Delete
[293] Fix | Delete
if (0 === emailAddress.length) {
[294] Fix | Delete
showErrorMessage('<?php fs_esc_js_echo_inline( 'Email address is required.', 'email-address-is-required', $slug ) ?>');
[295] Fix | Delete
return;
[296] Fix | Delete
}
[297] Fix | Delete
}
[298] Fix | Delete
[299] Fix | Delete
if (0 === paypalEmailAddress.length) {
[300] Fix | Delete
showErrorMessage('<?php fs_esc_js_echo_inline( 'PayPal email address is required.', 'paypal-email-address-is-required', $slug ) ?>');
[301] Fix | Delete
return;
[302] Fix | Delete
}
[303] Fix | Delete
[304] Fix | Delete
var
[305] Fix | Delete
$extraDomains = $extraDomainsContainer.find('.domain'),
[306] Fix | Delete
domain = $domain.val().trim().toLowerCase(),
[307] Fix | Delete
extraDomains = [];
[308] Fix | Delete
[309] Fix | Delete
if (0 === domain.length) {
[310] Fix | Delete
showErrorMessage('<?php fs_esc_js_echo_inline( 'Domain is required.', 'domain-is-required', $slug ) ?>');
[311] Fix | Delete
return;
[312] Fix | Delete
} else if ('freemius.com' === domain) {
[313] Fix | Delete
showErrorMessage('<?php fs_esc_js_echo_inline( 'Invalid domain', 'invalid-domain', $slug ) ?>' + ' [' + domain + '].');
[314] Fix | Delete
return;
[315] Fix | Delete
}
[316] Fix | Delete
[317] Fix | Delete
if ($extraDomains.length > 0) {
[318] Fix | Delete
var hasError = false;
[319] Fix | Delete
[320] Fix | Delete
$extraDomains.each(function () {
[321] Fix | Delete
var
[322] Fix | Delete
$this = $(this),
[323] Fix | Delete
extraDomain = $this.val().trim().toLowerCase();
[324] Fix | Delete
if (0 === extraDomain.length || extraDomain === domain) {
[325] Fix | Delete
return true;
[326] Fix | Delete
} else if ('freemius.com' === extraDomain) {
[327] Fix | Delete
showErrorMessage('<?php fs_esc_js_echo_inline( 'Invalid domain', 'invalid-domain', $slug ) ?>' + ' [' + extraDomain + '].');
[328] Fix | Delete
hasError = true;
[329] Fix | Delete
return false;
[330] Fix | Delete
}
[331] Fix | Delete
[332] Fix | Delete
extraDomains.push(extraDomain);
[333] Fix | Delete
});
[334] Fix | Delete
[335] Fix | Delete
if (hasError) {
[336] Fix | Delete
return;
[337] Fix | Delete
}
[338] Fix | Delete
}
[339] Fix | Delete
[340] Fix | Delete
var
[341] Fix | Delete
promotionMethods = [],
[342] Fix | Delete
statisticsInformation = $('#statistics_information').val(),
[343] Fix | Delete
promotionMethodDescription = $('#promotion_method_description').val();
[344] Fix | Delete
[345] Fix | Delete
if ($socialMedia.attr('checked')) {
[346] Fix | Delete
promotionMethods.push('social_media');
[347] Fix | Delete
}
[348] Fix | Delete
[349] Fix | Delete
if ($mobileApps.attr('checked')) {
[350] Fix | Delete
promotionMethods.push('mobile_apps');
[351] Fix | Delete
}
[352] Fix | Delete
[353] Fix | Delete
var affiliate = {
[354] Fix | Delete
full_name : $('#full_name').val().trim(),
[355] Fix | Delete
paypal_email : paypalEmailAddress,
[356] Fix | Delete
stats_description : statisticsInformation,
[357] Fix | Delete
promotion_method_description: promotionMethodDescription
[358] Fix | Delete
};
[359] Fix | Delete
[360] Fix | Delete
if (null !== emailAddress) {
[361] Fix | Delete
affiliate.email = emailAddress;
[362] Fix | Delete
}
[363] Fix | Delete
[364] Fix | Delete
affiliate.domain = domain;
[365] Fix | Delete
affiliate.additional_domains = extraDomains;
[366] Fix | Delete
[367] Fix | Delete
if (promotionMethods.length > 0) {
[368] Fix | Delete
affiliate.promotion_methods = promotionMethods.join(',');
[369] Fix | Delete
}
[370] Fix | Delete
[371] Fix | Delete
$.ajax({
[372] Fix | Delete
url : <?php echo Freemius::ajax_url() ?>,
[373] Fix | Delete
method : 'POST',
[374] Fix | Delete
data : {
[375] Fix | Delete
action : '<?php echo $fs->get_ajax_action( 'submit_affiliate_application' ) ?>',
[376] Fix | Delete
security : '<?php echo $fs->get_ajax_security( 'submit_affiliate_application' ) ?>',
[377] Fix | Delete
module_id: '<?php echo $module_id ?>',
[378] Fix | Delete
affiliate: affiliate
[379] Fix | Delete
},
[380] Fix | Delete
beforeSend: function () {
[381] Fix | Delete
$cancelButton.addClass('disabled');
[382] Fix | Delete
$submitButton.addClass('disabled');
[383] Fix | Delete
$submitButton.text('<?php fs_esc_js_echo_inline( 'Submitting', 'submitting' ) ?>...');
[384] Fix | Delete
},
[385] Fix | Delete
success : function (result) {
[386] Fix | Delete
if (result.success) {
[387] Fix | Delete
location.reload();
[388] Fix | Delete
} else {
[389] Fix | Delete
if (result.error && result.error.length > 0) {
[390] Fix | Delete
showErrorMessage(result.error);
[391] Fix | Delete
}
[392] Fix | Delete
[393] Fix | Delete
$cancelButton.removeClass('disabled');
[394] Fix | Delete
$submitButton.removeClass('disabled');
[395] Fix | Delete
$submitButton.text('<?php echo esc_js( $apply_to_become_affiliate_text ) ?>')
[396] Fix | Delete
}
[397] Fix | Delete
}
[398] Fix | Delete
});
[399] Fix | Delete
});
[400] Fix | Delete
[401] Fix | Delete
$cancelButton.click(function (evt) {
[402] Fix | Delete
evt.preventDefault();
[403] Fix | Delete
[404] Fix | Delete
var $this = $(this);
[405] Fix | Delete
[406] Fix | Delete
if ($this.hasClass('disabled')) {
[407] Fix | Delete
return;
[408] Fix | Delete
}
[409] Fix | Delete
[410] Fix | Delete
$applicationFormContainer.hide();
[411] Fix | Delete
$this.hide();
[412] Fix | Delete
$submitButton.hide();
[413] Fix | Delete
[414] Fix | Delete
$applyButton.show();
[415] Fix | Delete
[416] Fix | Delete
window.scrollTo(0, 0);
[417] Fix | Delete
});
[418] Fix | Delete
[419] Fix | Delete
$domain.on('input propertychange', onDomainChange);
[420] Fix | Delete
[421] Fix | Delete
$addDomain.click(function (evt) {
[422] Fix | Delete
evt.preventDefault();
[423] Fix | Delete
[424] Fix | Delete
var
[425] Fix | Delete
$this = $(this),
[426] Fix | Delete
domain = $domain.val().trim();
[427] Fix | Delete
[428] Fix | Delete
if ($this.hasClass('disabled') || 0 === domain.length) {
[429] Fix | Delete
return;
[430] Fix | Delete
}
[431] Fix | Delete
[432] Fix | Delete
$domain.off('input propertychange');
[433] Fix | Delete
$this.addClass('disabled');
[434] Fix | Delete
[435] Fix | Delete
var
[436] Fix | Delete
$extraDomainInputContainer = $('<div class="extra-domain-input-container"><input type="text" class="domain regular-text"/></div>'),
[437] Fix | Delete
$extraDomainInput = $extraDomainInputContainer.find('input'),
[438] Fix | Delete
$removeDomain = $('<a href="#" class="remove-domain"><i class="dashicons dashicons-no" title="<?php fs_esc_js_echo_inline( 'Remove', 'remove', $slug ) ?>"></i></a>');
[439] Fix | Delete
[440] Fix | Delete
$extraDomainInputContainer.append($removeDomain);
[441] Fix | Delete
[442] Fix | Delete
$extraDomainInput.on('input propertychange', onDomainChange);
[443] Fix | Delete
[444] Fix | Delete
$removeDomain.click(function (evt) {
[445] Fix | Delete
evt.preventDefault();
[446] Fix | Delete
[447] Fix | Delete
var
[448] Fix | Delete
$extraDomainInputs = $('.extra-domain-input-container .domain');
[449] Fix | Delete
[450] Fix | Delete
if (1 === $extraDomainInputs.length)
[451] Fix | Delete
$extraDomainInputs.val('').focus();
[452] Fix | Delete
else
[453] Fix | Delete
$(this).parent().remove();
[454] Fix | Delete
});
[455] Fix | Delete
[456] Fix | Delete
$extraDomainsContainer.show();
[457] Fix | Delete
[458] Fix | Delete
$extraDomainInputContainer.appendTo($extraDomainsContainer);
[459] Fix | Delete
$extraDomainInput.focus();
[460] Fix | Delete
[461] Fix | Delete
$this.appendTo($extraDomainsContainer);
[462] Fix | Delete
});
[463] Fix | Delete
[464] Fix | Delete
/**
[465] Fix | Delete
* @author Leo Fajardo (@leorw)
[466] Fix | Delete
*/
[467] Fix | Delete
function onDomainChange() {
[468] Fix | Delete
var
[469] Fix | Delete
domain = $(this).val().trim();
[470] Fix | Delete
[471] Fix | Delete
if (domain.length > 0) {
[472] Fix | Delete
$addDomain.removeClass('disabled');
[473] Fix | Delete
} else {
[474] Fix | Delete
$addDomain.addClass('disabled');
[475] Fix | Delete
}
[476] Fix | Delete
}
[477] Fix | Delete
[478] Fix | Delete
/**
[479] Fix | Delete
* @author Leo Fajardo (@leorw)
[480] Fix | Delete
*
[481] Fix | Delete
* @param {String} message
[482] Fix | Delete
*/
[483] Fix | Delete
function showErrorMessage(message) {
[484] Fix | Delete
$errorMessageContainer.find('strong').text(message);
[485] Fix | Delete
$errorMessageContainer.show();
[486] Fix | Delete
[487] Fix | Delete
window.scrollTo(0, 0);
[488] Fix | Delete
}
[489] Fix | Delete
[490] Fix | Delete
/**
[491] Fix | Delete
* @author Xiaheng Chen (@xhchen)
[492] Fix | Delete
*
[493] Fix | Delete
* @since 2.4.0
[494] Fix | Delete
*/
[495] Fix | Delete
$legalConsentCheckbox.click( function () {
[496] Fix | Delete
if ( $( this ).prop( 'checked' ) ) {
[497] Fix | Delete
$submitButton.removeClass( 'disabled' );
[498] Fix | Delete
} else {
[499] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function