init( 'wc', $freemius, $wc_store_url, $wc_product_id, $wc_license_accessor, $migration_type, $was_freemius_in_prev_version, $is_blocking ); $freemius->add_filter( 'license_key', array( &$this, 'convert_wc_to_fs_license_key' ) ); add_action( 'admin_footer', 'allow_more_than_32_chars_key' ); } /** * Convert WC long license key to FS 32 chars key. * * WC Format: 'wc_order_5645bbd42dbfb_am_kii0TEYjrxEZ' * Converted to: 'er_5645bbd42dbfb_am_kii0TEYjrxEZ' * * @author Vova Feldman (@svovaf) * @since 1.1.0 * * @param string $license_key * * @return string */ function convert_wc_to_fs_license_key( $license_key ) { $len = strlen( $license_key ); if ( $len > 32 ) { $license_key = substr( $license_key, $len - 32 ); } return $license_key; } /** * Tweak license key input box of the opt-in view to support * longer WC licenses. * * @author Vova Feldman (@svovaf) * @since 1.1.0 */ function allow_more_than_32_chars_key() { if ( ! is_admin() ) { // Don't add logic in frontend. return; } if ( ! $this->_fs->is_activation_mode() ) { // Don't add code if not in activation mode. return; } if ( $this->_fs->_is_plugin_page() ) { // Don't add code if not on module's main page. return; } ?>