Commit 97a890a2 authored by Luke081515's avatar Luke081515

Let the user choose a different pattern

* Allows the user to enter a pattern different from the needle
parent 4c843f21
Pipeline #1814 failed with stages
in 1 minute and 42 seconds
......@@ -11,6 +11,7 @@ require './Cygnus/BotCore.php';
class Corrector extends Core {
private $summary;
private $search;
private $pattern;
private $replace;
private $needle;
private $accountname;
......@@ -29,6 +30,9 @@ class Corrector extends Core {
* Defines the condition for search and replace
*/
private function defineConditions () {
if ($this->askOperator('Use a pattern? [y/N] ') === 'y') {
$this->pattern = $this->askOperator('What should be the pattern? ');
}
$needle = $this->askOperator('What should be replaced? ');
$replace = $this->askOperator('What should be the replacement? ');
$this->needle = $needle;
......@@ -59,8 +63,11 @@ class Corrector extends Core {
*/
private function searchPages () {
echo "\n" . 'Searching…' . "\n";
$suche = urlencode('insource:' . $this->needle);
if (isset($this->pattern)) {
$suche = urlencode($this->pattern);
} else {
$suche = urlencode('insource:' . $this->needle);
}
$i = 0;
$Again = true;
$Continue = '0';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment