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