FindReplaceHtmlCode
extends FindReplaceWidget
in package
A doomtool for HTML code widgets.
This is registered in sprout core.
Table of Contents
Methods
- find() : iterable<string|int, array<string|int, mixed>>
- Find all occurrences of the the given string patterns.
- getName() : string
- The friendly name for this doomtool shown in the dbtools.
- getWidgetType() : string
- Get the widget type this replacer is for.
- key() : string
- The unique key for this doomtool.
- replace() : int
- Find and replace all occurrences of the given string patterns.
- findInWidget() : null|array<string|int, mixed>
- Find the text in a widget.
- getWidgetText() : string
- Get the widget text for replacing.
- replaceInWidget() : bool
- Replace the text in a widget.
- setWidgetText() : void
- Set the widget text after replacing.
Methods
find()
Find all occurrences of the the given string patterns.
public
find(array<string|int, mixed> $finds, array<string|int, mixed> $settings) : iterable<string|int, array<string|int, mixed>>
Parameters
- $finds : array<string|int, mixed>
-
regex patterns
- $settings : array<string|int, mixed>
-
[ ignore_case ]
Tags
Return values
iterable<string|int, array<string|int, mixed>> —[ id, key, text, url, indexes, count ]
getName()
The friendly name for this doomtool shown in the dbtools.
public
getName() : string
Tags
Return values
stringgetWidgetType()
Get the widget type this replacer is for.
public
static getWidgetType() : string
Tags
Return values
stringkey()
The unique key for this doomtool.
public
key() : string
Tags
Return values
stringreplace()
Find and replace all occurrences of the given string patterns.
public
replace(array<string|int, mixed> $replaces, array<string|int, mixed> $settings) : int
Parameters
- $replaces : array<string|int, mixed>
-
[ find => replace ] regex + replacements
- $settings : array<string|int, mixed>
-
[ ignore_case ]
Tags
Return values
int —number of replacements
findInWidget()
Find the text in a widget.
protected
findInWidget(array<string|int, mixed> $row, array<string|int, string> $finds, array<string|int, mixed> $settings) : null|array<string|int, mixed>
Null results are not included in by find().
Parameters
- $row : array<string|int, mixed>
-
page_widgets db row + page id, revision id, status
- $finds : array<string|int, string>
- $settings : array<string|int, mixed>
Return values
null|array<string|int, mixed> —result set, see find() - or null if not found
getWidgetText()
Get the widget text for replacing.
protected
getWidgetText(array<string|int, mixed> $row) : string
Parameters
- $row : array<string|int, mixed>
Tags
Return values
stringreplaceInWidget()
Replace the text in a widget.
protected
replaceInWidget(int $id, string $text) : bool
Parameters
- $id : int
- $text : string
Return values
boolsetWidgetText()
Set the widget text after replacing.
protected
setWidgetText(array<string|int, mixed> &$row, string $text) : void
Parameters
- $row : array<string|int, mixed>
-
db row
page_widgets - $text : string