function wpsolr_admin_action_form_temporary_index(&$response_object)
{
    // recaptcha response
    $g_recaptcha_response = isset($_POST['g-recaptcha-response']) ? $_POST['g-recaptcha-response'] : '';
    // A recaptcha response must be set
    if (empty($g_recaptcha_response)) {
        return;
    }
    $form_data = WpSolrExtensions::extract_form_data(true, array('managed_solr_service_id' => array('default_value' => '', 'can_be_empty' => false)));
    $managed_solr_server = new OptionManagedSolrServer($form_data['managed_solr_service_id']['value']);
    $response_object = $managed_solr_server->call_rest_create_solr_index($g_recaptcha_response);
    if (isset($response_object) && OptionManagedSolrServer::is_response_ok($response_object)) {
        $option_indexes_object = new OptionIndexes();
        $option_indexes_object->create_index($managed_solr_server->get_id(), OptionIndexes::STORED_INDEX_TYPE_MANAGED_TEMPORARY, OptionManagedSolrServer::get_response_result($response_object, 'urlCore'), 'Test index from ' . $managed_solr_server->get_label(), OptionManagedSolrServer::get_response_result($response_object, 'urlScheme'), OptionManagedSolrServer::get_response_result($response_object, 'urlDomain'), OptionManagedSolrServer::get_response_result($response_object, 'urlPort'), '/' . OptionManagedSolrServer::get_response_result($response_object, 'urlPath') . '/' . OptionManagedSolrServer::get_response_result($response_object, 'urlCore'), OptionManagedSolrServer::get_response_result($response_object, 'key'), OptionManagedSolrServer::get_response_result($response_object, 'secret'));
        // Redirect automatically to Solr options if it is the first solr index created
        if (count($option_indexes_object->get_indexes()) === 1) {
            $redirect_location = '?page=solr_settings&tab=solr_option';
            header("Location: {$redirect_location}", true, 302);
            // wp_redirect() is not found
            exit;
        }
    }
}
<div class="wrapper">

	<form method="POST" id="form_temporary_index">
		<input type="hidden" name="wpsolr_action" value="wpsolr_admin_action_form_temporary_index"/>
		<input type="hidden" name="data-sitekey" value=""/>
		<input type="hidden" name="zdata-stoken" value=""/>

		<h4 class='head_div'>Get your free Solr index to test WPSOLR</h4>

		<div class="wdm_row">
			<div class='col_left' style='width: 10%;'>

				<select name='managed_solr_service_id'>
					<?php 
foreach (OptionManagedSolrServer::get_managed_solr_services() as $list_managed_solr_service_id => $managed_solr_service) {
    printf("<option value='%s' %s>%s</option>", $list_managed_solr_service_id, selected($list_managed_solr_service_id, $managed_solr_service_id, false), $managed_solr_service[OptionManagedSolrServer::MANAGED_SOLR_SERVICE_LABEL]);
}
?>
				</select>

			</div>

			<div class='col_right' style='width: 80%;'>
				<?php 
if (empty($google_recaptcha_token)) {
    ?>
				<input name="submit_button_form_temporary_index_select_managed_solr_service_id" type="submit"
				       class="button-primary "
				       value="Create my instant free Solr index"/>
/**
 * Page listing all managed Solr account's indexes.
 */
?>

<div class="wdm-vertical-tabs-content">
	<div class="wrapper">

		<h4 class='head_div'>Select an index</h4>

		<?php 
// Add menu items for all the managed Solr account's indexes
$subtabs = array();
$result_object = $managed_solr_server->call_rest_account_indexes($account_uuid);
if (OptionManagedSolrServer::is_response_ok($result_object)) {
    foreach ($managed_solr_server->get_response_results($result_object) as $result) {
        $subtabs[$managed_solr_server->get_id() . ':' . $result->uuid . ':' . $result->uuid] = $result->label;
    }
}
// Display menu
$subtab_composed = wpsolr_admin_sub_tabs($subtabs);
// Display index detail if index appears in parameters
$subtab_exploded = explode(':', $subtab_composed);
if (count($subtab_exploded) >= 3) {
    $subtab = $subtab_exploded[2];
}
?>

	</div>
</div>
							<div class="clear"></div>
							<span class='sec_err'></span>
						</div>
						<div class="clear"></div>
					</div>

					<?php 
    // Display managed offers links
    if ($is_index_type_temporary) {
        ?>

						<div class='col_right' style='width:90%'>

							<?php 
        $managed_solr_service_id = $option_object->get_index_managed_solr_service_id($option_data['solr_indexes'][$index_indice]);
        $OptionManagedSolrServer = new OptionManagedSolrServer($managed_solr_service_id);
        foreach ($OptionManagedSolrServer->generate_convert_orders_urls($index_indice) as $managed_solr_service_orders_url) {
            ?>

								<input name="gotosolr_plan_yearly_trial"
								       type="button" class="button-primary"
								       value="<?php 
            echo $managed_solr_service_orders_url[OptionManagedSolrServer::MANAGED_SOLR_SERVICE_ORDER_URL_BUTTON_LABEL];
            ?>
"
								       onclick="window.open('<?php 
            echo $managed_solr_service_orders_url[OptionManagedSolrServer::MANAGED_SOLR_SERVICE_ORDER_URL_LINK];
            ?>
', '__blank');"
								/>
$subtabs = array('unmanaged_solr_servers' => 'Unmanaged Solr server');
// Add menu items for all the managed Solr services
foreach (OptionManagedSolrServer::get_managed_solr_services() as $managed_solr_service_id => $managed_solr_service) {
    $subtabs[$managed_solr_service_id] = $managed_solr_service[OptionManagedSolrServer::MANAGED_SOLR_SERVICE_LABEL];
}
// Display menu
$subtab = wpsolr_admin_sub_tabs($subtabs);
$subtab_exploded = explode(':', $subtab);
$managed_solr_service_id = $subtab_exploded[0];
// When a menu item is selected, display specific template.
switch ($managed_solr_service_id) {
    case 'unmanaged_solr_servers':
        WpSolrExtensions::require_with(WpSolrExtensions::get_option_template_file(WpSolrExtensions::OPTION_MANAGED_SOLR_SERVERS, 'template-unmanaged-form.php'));
        break;
    default:
        $managed_solr_server = new OptionManagedSolrServer($managed_solr_service_id);
        /*
         *  Form logout ?
         */
        $is_submit_form_logout = isset($_POST['submit-form-logout']);
        if ($is_submit_form_logout) {
            // Clear the managed service token
            $managed_solr_server->set_service_option('token', '');
        }
        /*
         *  Form signin ?
         */
        $is_submit_form_signin = isset($_POST['submit-form-signin']);
        $form_data = WpSolrExtensions::extract_form_data($is_submit_form_signin, array('email' => array('default_value' => wp_get_current_user()->user_email, 'is_email' => true), 'password' => array('default_value' => '', 'can_be_empty' => false)));
        if ($is_submit_form_signin) {
            if (!$form_data['is_error']) {
 /**
  * Ajax call to verify a license
  */
 public static function ajax_verify_licence()
 {
     $option_licenses = new OptionLicenses();
     $licenses = $option_licenses->get_licenses();
     $license_package = isset($_POST['data']) && isset($_POST['data'][self::FIELD_LICENSE_PACKAGE]) ? $_POST['data'][self::FIELD_LICENSE_PACKAGE] : null;
     $license_activation_uuid = $option_licenses->get_license_activation_uuid($license_package);
     if (empty($license_activation_uuid)) {
         $licenses[$license_package] = array(self::FIELD_LICENSE_SUBSCRIPTION_NUMBER => $licenses[$license_package][self::FIELD_LICENSE_SUBSCRIPTION_NUMBER]);
         self::set_option_data(self::OPTION_LICENSES, $licenses);
         echo json_encode((object) array('status' => (object) array('state' => 'ERROR', 'message' => 'This license activation code is missing. Try to unactivate manually, by signin to your subscription account.')));
         die;
     }
     $managed_solr_server = new OptionManagedSolrServer();
     $response_object = $managed_solr_server->call_rest_verify_license(self::get_license_api_url(), $license_activation_uuid);
     if (isset($response_object) && OptionManagedSolrServer::is_response_ok($response_object)) {
         if (isset($licenses[$license_package])) {
             // Remove the license type activation
             $licenses = self::get_option_data(self::OPTION_LICENSES, array());
             unset($licenses[$license_package][self::FIELD_NEEDS_VERIFICATION]);
             self::set_option_data(self::OPTION_LICENSES, $licenses);
         }
     }
     // Return the whole object
     echo json_encode($response_object);
     die;
 }