get_slug(); $unique_affix = $fs->get_unique_affix(); $cant_find_license_key_text = fs_text_inline( "Can't find your license key?", 'cant-find-license-key', $slug ); $message_above_input_field = fs_text_inline( 'Please enter the license key that you received in the email right after the purchase:', 'activate-license-message', $slug ); $message_below_input_field = ''; $header_title = $fs->is_free_plan() ? fs_text_inline( 'Activate License', 'activate-license', $slug ) : fs_text_inline( 'Update License', 'update-license', $slug ); if ( $fs->is_registered() ) { $activate_button_text = $header_title; } else { $message_below_input_field = sprintf( fs_text_inline( 'The %1$s will be periodically sending essential license data to %2$s to check for security and feature updates, and verify the validity of your license.', 'license-sync-disclaimer', $slug ), $fs->get_module_label( true ), "{$fs->get_plugin_title()}" ); $activate_button_text = fs_text_inline( 'Agree & Activate License', 'agree-activate-license', $slug ); } $license_key_text = fs_text_inline( 'License key', 'license-key' , $slug ); $is_network_activation = ( $fs->is_network_active() && fs_is_network_admin() && ! $fs->is_delegated_connection() ); $network_activation_html = ''; $sites_details = array(); if ( $is_network_activation ) { $all_sites = Freemius::get_sites(); $subsite_data_by_install_id = array(); $install_url_by_install_id = array(); foreach ( $all_sites as $site ) { $site_details = $fs->get_site_info( $site ); if ( FS_Clone_Manager::instance()->is_temporary_duplicate_by_blog_id( $site_details['blog_id'] ) ) { continue; } $blog_id = Freemius::get_site_blog_id( $site ); $install = $fs->get_install_by_blog_id($blog_id); if ( is_object( $install ) ) { if ( isset( $subsite_data_by_install_id[ $install->id ] ) ) { $clone_subsite_data = $subsite_data_by_install_id[ $install->id ]; $clone_install_url = $install_url_by_install_id[ $install->id ]; if ( /** * If we already have an install with the same URL as the subsite it's stored in, skip the current subsite. Otherwise, replace the existing install's data with the current subsite's install's data if the URLs match. * * @author Leo Fajardo (@leorw) * @since 2.5.0 */ fs_strip_url_protocol( untrailingslashit( $clone_install_url ) ) === fs_strip_url_protocol( untrailingslashit( $clone_subsite_data['url'] ) ) || fs_strip_url_protocol( untrailingslashit( $install->url ) ) !== fs_strip_url_protocol( untrailingslashit( $site_details['url'] ) ) ) { continue; } } if ( FS_Plugin_License::is_valid_id( $install->license_id ) ) { $site_details['license_id'] = $install->license_id; } $subsite_data_by_install_id[ $install->id ] = $site_details; $install_url_by_install_id[ $install->id ] = $install->url; } } if ( $is_network_activation ) { $vars = array( 'id' => $fs->get_id(), 'sites' => array_values( $subsite_data_by_install_id ), 'require_license_key' => true ); $network_activation_html = fs_get_template( 'partials/network-activation.php', $vars ); } } $premium_licenses = $fs->get_available_premium_licenses(); $available_licenses = array(); foreach ( $premium_licenses as $premium_license ) { $activations_left = $premium_license->left(); if ( ! ( $activations_left > 0 ) ) { continue; } $available_licenses[ $activations_left . '_' . $premium_license->id ] = $premium_license; } $total_available_licenses = count( $available_licenses ); if ( $total_available_licenses > 0 ) { $license_input_html = <<< HTML
HTML; if ( $total_available_licenses > 1 ) { // Sort the licenses by number of activations left in descending order. krsort( $available_licenses ); $license_input_html .= ''; } else { $available_licenses = array_values( $available_licenses ); /** * @var FS_Plugin_License $available_license */ $available_license = $available_licenses[0]; $value = sprintf( "%s-Site %s License - %s", ( 1 == $available_license->quota ? 'Single' : ( $available_license->is_unlimited() ? 'Unlimited' : $available_license->quota ) ), $fs->_get_plan_by_id( $available_license->plan_id )->title, $available_license->get_html_escaped_masked_secret_key() ); $license_input_html .= <<< HTML HTML; } $license_input_html .= <<< HTML
HTML; } else { $license_input_html = ""; } $ownership_change_option_text = fs_text_inline( "Associate with the license owner's account.", 'associate-account-with-license-owner', $slug ); $ownership_change_option_html = ""; /** * IMPORTANT: * DO NOT ADD MAXLENGTH OR LIMIT THE LICENSE KEY LENGTH SINCE * WE DO WANT TO ALLOW INPUT OF LONGER KEYS (E.G. WooCommerce Keys) * FOR MIGRATED MODULES. */ $modal_content_html = <<< HTML

{$message_above_input_field}

{$license_input_html} {$cant_find_license_key_text} {$network_activation_html}

{$message_below_input_field}

{$ownership_change_option_html} HTML; /** * Handle the ownership change option if not an add-on or if no license yet is activated for the * parent product in case of an add-on. * * @author Leo Fajardo (@leorw) * @since 2.3.2 */ $is_user_change_supported = ( ! $fs->is_addon() || ! $fs->get_parent_instance()->has_active_valid_license() ); fs_enqueue_local_style( 'fs_dialog_boxes', '/admin/dialog-boxes.css' ); ?>