When selecting
#for explaining i included the selection
# view.sel()[0] = '$condition1 = isset($_POST[ $this->prefix . $customField['name'] ]);
$condition2 = trim( $_POST[ $this->prefix . $customField['name'] ] );'
view = self.view
region = view.sel()[0]
theLines = view.lines(region)
if len(theLines) > 0:
for region in theLines:
# print(regionContentActual)
if not region.empty():
currentLine = view.substr(region)
if ';' in currentLine:
lineVars = getVars(currentLine)
if lineVars:
lineVars = '$condition2, $_POST, $customField'
regionContentToAdd = 'var_dump(' + lineVars + ');'
newRegionContent = currentLine + regionContentToAdd
if regionContentToAdd in currentLine:
regionContentToAdd = re.sub(r"var_dump\((.*?)\);", "", currentLine)
newRegionContent = currentLine.replace(regionContentToAdd, "")
view.replace(edit, region, newRegionContent)
RESULTS
$condition1 = isset($_POST[ $this->prefix . $customField['name'] ]);var_dump($condition2, $_POST, $customField);
$condition2 = trim( $_POSvar_dump($condition2, $_POST, $customField);T[ $this->prefix . $customField['name'] ] );
INSTEAD OF
$condition1 = isset($_POST[ $this->prefix . $customField['name'] ]);var_dump($condition2, $_POST, $customField);
$condition2 = trim( $_POST[ $this->prefix . $customField['name'] ] );var_dump($condition2, $_POST, $customField);