Skip to content

Commit

Permalink
Merge pull request #2549 from WPO-Foundation/2548
Browse files Browse the repository at this point in the history
2548 - handle find/replace differently than other swaps so we don't interfere with the other swaps
  • Loading branch information
scottjehl authored Nov 30, 2022
2 parents 4c99979 + b18624b commit 8d9569c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion www/experiments/custom.inc
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ $assessment[$category]["opportunities"][] = array(
'id' => '026',
'title' => 'Find/Replace Text',
"desc" => '<p>This experiment will find and replace occurrences of text in the page, with the option of using regular expressions, capturing parentheses, and flags as well</p>',
"expvar" => 'swap',
"expvar" => 'findreplace',
"expfields" => array(
(object) [
'label' => 'find',
Expand Down
9 changes: 5 additions & 4 deletions www/runtest.php
Original file line number Diff line number Diff line change
Expand Up @@ -975,7 +975,6 @@ function buildSelfHost($hosts)
) {
$error = "Attempt to use unauthorized experiments feature.";
} else {
$recipeScript .= $recipeSansId;
$experimentSpof = array();
$experimentBlock = array();
$experimentOverrideHost = array();
Expand All @@ -997,8 +996,10 @@ function buildSelfHost($hosts)
if ($recipeSansId === "setinitialurl") {
$experimentRunURL = $ingredients;
}
if ($recipeSansId === "swap") {
$experimentSwap = $ingredients;
if ($recipeSansId === "findreplace") {
// findreplace is used in the form to submit the pieces for a swap experiment.
// we don't need that term from here. we'll build the swap.
$recipeSansId === "swap"
if ($ingredients[0]) {
$ingredients[0] = rawurlencode($ingredients[0]);
}
Expand All @@ -1020,7 +1021,7 @@ function buildSelfHost($hosts)
) {
$ingredients = rawurlencode($ingredients);
}
$recipeScript .= ":=" . $ingredients;
$recipeScript .= "$recipeSansId:=" . $ingredients;
}
$recipeScript .= ";";
}
Expand Down

0 comments on commit 8d9569c

Please sign in to comment.