Esempio n. 1
0
 
     <tr>
      <td>Build Array</td>
      <td>
          <pre>
<?php 
print_r(buildArray("One", "Two", "Three", "Four"));
?>
          </pre>
      </td>
    </tr>
 
    <tr>
      <td>Read Local File</td>
      <td class="localfile"><?php 
echo readLocalFile();
?>
</td>
    </tr>

    <tr>
      <td>Server Software</td>
      <td><?php 
echo serverSoftware();
?>
</td>
    </tr>

    <tr>
      <td>Make Object</td>
      <td>
            $tmp = array();
            $has_exclusion = false;
            foreach ($experiment as $combination) {
                $combination = str_replace(" ", "_", $combination);
                if (!array_key_exists($combination, $_POST)) {
                    array_push($tmp, "\"" . str_replace("_", " ", $combination) . "\"");
                    $has_exclusion = true;
                }
            }
            $json_str_experiment = str_replace("__ID__", $experiment_id, $json_str_experiment);
            $json_str_experiment = str_replace("__MVT_COMBINATION__", implode(",", $tmp), $json_str_experiment);
            if ($has_exclusion) {
                array_push($tmp_json_str, $json_str_experiment);
            }
        }
        $new_code = readLocalFile("project_js_template.js");
        if (count($tmp_json_str) == 0) {
            $new_code = str_replace("__MVT_CONFIG__", "", $new_code);
        } else {
            $new_code = str_replace("__MVT_CONFIG__", implode(",", $tmp_json_str), $new_code);
        }
        $pjs = $project->project_javascript;
        $canvas->replace_app_code($project, $new_code);
        // get the project again with updated project JS
        $project = $optimizely->get_project($canvas->get_project_id());
    }
    // show which combinations are disabled on the UI
    $existing_disabled_combinations = getExistingMVTConfig($canvas, $project);
    //disableCanvasApp($canvas, $project);
}
// ********************** END OF MAIN ***********************************