| @@ -12,12 +12,10 @@ | ||
| 12 | 12 | |
| 13 | 13 | /** |
| 14 | 14 | * @var array $VARS |
| 15 | 15 | * @var Freemius $fs |
| 16 | - * @var string $plugin_title | |
| 17 | 16 | */ |
| 18 | - $fs = freemius( $VARS['id'] ); | |
| 19 | - $plugin_title = $VARS['plugin_title']; | |
| 17 | + $fs = freemius( $VARS['id'] ); | |
| 20 | 18 | |
| 21 | 19 | $slug = $fs->get_slug(); |
| 22 | 20 | |
| 23 | 21 | $user = $fs->get_user(); |
| @@ -23,8 +21,9 @@ | ||
| 23 | 21 | $user = $fs->get_user(); |
| 24 | 22 | $affiliate = $fs->get_affiliate(); |
| 25 | 23 | $affiliate_terms = $fs->get_affiliate_terms(); |
| 26 | 24 | |
| 25 | + $plugin_title = $fs->get_plugin_title(); | |
| 27 | 26 | $module_type = $fs->is_plugin() ? |
| 28 | 27 | WP_FS__MODULE_TYPE_PLUGIN : |
| 29 | 28 | WP_FS__MODULE_TYPE_THEME; |
| 30 | 29 | |
| @@ -45,9 +44,9 @@ | ||
| 45 | 44 | $promotion_method_social_media = false; |
| 46 | 45 | $promotion_method_mobile_apps = false; |
| 47 | 46 | $statistics_information = false; |
| 48 | 47 | $promotion_method_description = false; |
| 49 | - $members_dashboard_login_url = 'https://users.freemius.com/login'; | |
| 48 | + $members_dashboard_login_url = 'https://members.freemius.com/login/'; | |
| 50 | 49 | |
| 51 | 50 | $affiliate_application_data = $fs->get_affiliate_application_data(); |
| 52 | 51 | |
| 53 | 52 | if ( $is_affiliate && $affiliate->is_pending() ) { |
| @@ -68,15 +67,12 @@ | ||
| 68 | 67 | $promotion_method_social_media = in_array( 'social_media', $promotion_methods ); |
| 69 | 68 | $promotion_method_mobile_apps = in_array( 'mobile_apps', $promotion_methods ); |
| 70 | 69 | } |
| 71 | 70 | } else { |
| 72 | - if ( ! is_object( $user ) ) { | |
| 73 | - $current_user = Freemius::_get_current_wp_user(); | |
| 74 | - $full_name = trim( $current_user->user_firstname . ' ' . $current_user->user_lastname ); | |
| 75 | - $email_address = $current_user->user_email; | |
| 76 | - } | |
| 77 | - | |
| 78 | - $domain = Freemius::get_unfiltered_site_url( null, true ); | |
| 71 | + $current_user = Freemius::_get_current_wp_user(); | |
| 72 | + $full_name = trim( $current_user->user_firstname . ' ' . $current_user->user_lastname ); | |
| 73 | + $email_address = $current_user->user_email; | |
| 74 | + $domain = fs_strip_url_protocol( get_site_url() ); | |
| 79 | 75 | } |
| 80 | 76 | |
| 81 | 77 | $affiliate_tracking = 30; |
| 82 | 78 | |
| @@ -86,13 +82,8 @@ | ||
| 86 | 82 | fs_text_inline( 'Non-expiring', 'non-expiring', $slug ) ); |
| 87 | 83 | } |
| 88 | 84 | |
| 89 | 85 | $apply_to_become_affiliate_text = fs_text_inline( 'Apply to become an affiliate', 'apply-to-become-an-affiliate', $slug ); |
| 90 | - | |
| 91 | - $module_id = $fs->get_id(); | |
| 92 | - $affiliate_program_terms_url = "https://freemius.com/plugin/{$module_id}/{$slug}/legal/affiliate-program/"; | |
| 93 | - | |
| 94 | - $has_tabs = $fs->_add_tabs_before_content(); | |
| 95 | 86 | ?> |
| 96 | 87 | <div id="fs_affiliation_content_wrapper" class="wrap"> |
| 97 | 88 | <form method="post" action=""> |
| 98 | 89 | <div id="poststuff"> |
| @@ -112,9 +103,9 @@ | ||
| 112 | 103 | echo sprintf( |
| 113 | 104 | fs_esc_html_inline( "Your affiliate application for %s has been accepted! Log in to your affiliate area at: %s.", 'affiliate-application-accepted', $slug ), |
| 114 | 105 | $plugin_title, |
| 115 | 106 | sprintf( |
| 116 | - '<a href="%s" target="_blank" rel="noopener">%s</a>', | |
| 107 | + '<a href="%s" target="_blank">%s</a>', | |
| 117 | 108 | $members_dashboard_login_url, |
| 118 | 109 | $members_dashboard_login_url |
| 119 | 110 | ) |
| 120 | 111 | ); |
| @@ -225,19 +216,13 @@ | ||
| 225 | 216 | <?php if ( ! $is_affiliate ) : ?> |
| 226 | 217 | <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> |
| 227 | 218 | <?php endif ?> |
| 228 | 219 | </div> |
| 229 | - <?php if ( ! $is_affiliate ) : ?> | |
| 230 | - <div> | |
| 231 | - <input type="checkbox" id="legal_consent_checkbox"> | |
| 232 | - <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> | |
| 233 | - </div> | |
| 234 | - <?php endif ?> | |
| 235 | 220 | </form> |
| 236 | 221 | </div> |
| 237 | 222 | <?php if ( ! $is_affiliate ) : ?> |
| 238 | 223 | <a id="cancel_button" href="#" class="button button-secondary button-cancel" style="display: none"><?php fs_esc_html_echo_inline( 'Cancel', 'cancel', $slug ) ?></a> |
| 239 | - <a id="submit_button" class="button button-primary disabled" href="#" style="display: none"><?php echo esc_html( $apply_to_become_affiliate_text ) ?></a> | |
| 224 | + <a id="submit_button" class="button button-primary" href="#" style="display: none"><?php echo esc_html( $apply_to_become_affiliate_text ) ?></a> | |
| 240 | 225 | <a id="apply_button" class="button button-primary" href="#"><?php fs_esc_html_echo_inline( 'Become an affiliate', 'become-an-affiliate', $slug ) ?></a> |
| 241 | 226 | <?php endif ?> |
| 242 | 227 | </div> |
| 243 | 228 | </div> |
| @@ -256,10 +241,9 @@ | ||
| 256 | 241 | $applicationFormContainer = $('#application_form_container'), |
| 257 | 242 | $errorMessageContainer = $('#error_message'), |
| 258 | 243 | $domain = $('#domain'), |
| 259 | 244 | $addDomain = $('#add_domain'), |
| 260 | - $extraDomainsContainer = $('#extra_domains_container'), | |
| 261 | - $legalConsentCheckbox = $( '#legal_consent_checkbox' ); | |
| 245 | + $extraDomainsContainer = $('#extra_domains_container'); | |
| 262 | 246 | |
| 263 | 247 | $applyButton.click(function (evt) { |
| 264 | 248 | evt.preventDefault(); |
| 265 | 249 | |
| @@ -370,14 +354,14 @@ | ||
| 370 | 354 | affiliate.promotion_methods = promotionMethods.join(','); |
| 371 | 355 | } |
| 372 | 356 | |
| 373 | 357 | $.ajax({ |
| 374 | - url : <?php echo Freemius::ajax_url() ?>, | |
| 358 | + url : ajaxurl, | |
| 375 | 359 | method : 'POST', |
| 376 | 360 | data : { |
| 377 | 361 | action : '<?php echo $fs->get_ajax_action( 'submit_affiliate_application' ) ?>', |
| 378 | 362 | security : '<?php echo $fs->get_ajax_security( 'submit_affiliate_application' ) ?>', |
| 379 | - module_id: '<?php echo $module_id ?>', | |
| 363 | + module_id: '<?php echo $fs->get_id() ?>', | |
| 380 | 364 | affiliate: affiliate |
| 381 | 365 | }, |
| 382 | 366 | beforeSend: function () { |
| 383 | 367 | $cancelButton.addClass('disabled'); |
| @@ -487,24 +471,16 @@ | ||
| 487 | 471 | $errorMessageContainer.show(); |
| 488 | 472 | |
| 489 | 473 | window.scrollTo(0, 0); |
| 490 | 474 | } |
| 491 | - | |
| 492 | - /** | |
| 493 | - * @author Xiaheng Chen (@xhchen) | |
| 494 | - * | |
| 495 | - * @since 2.4.0 | |
| 496 | - */ | |
| 497 | - $legalConsentCheckbox.click( function () { | |
| 498 | - if ( $( this ).prop( 'checked' ) ) { | |
| 499 | - $submitButton.removeClass( 'disabled' ); | |
| 500 | - } else { | |
| 501 | - $submitButton.addClass( 'disabled' ); | |
| 502 | - } | |
| 503 | - } ); | |
| 504 | 475 | }); |
| 505 | 476 | </script> |
| 506 | 477 | </div> |
| 507 | 478 | <?php |
| 508 | - if ( $has_tabs ) { | |
| 509 | - $fs->_add_tabs_after_content(); | |
| 510 | - } | |
| 479 | + $params = array( | |
| 480 | + 'page' => 'affiliation', | |
| 481 | + 'module_id' => $fs->get_id(), | |
| 482 | + 'module_slug' => $slug, | |
| 483 | + 'module_version' => $fs->get_plugin_version(), | |
| 484 | + ); | |
| 485 | + fs_require_template( 'powered-by.php', $params ); | |
| 486 | +?> | |