MDL-60655 tool_httpsreplace: Use \core_text string functions

This commit is contained in:
Jun Pataleta
2017-11-02 10:38:33 +13:00
parent 02331dcd48
commit e8da33d86e
@@ -177,7 +177,7 @@ class url_finder {
$regex = '#((src|data)\ *=\ *[\'\"])(http://)([^\s()<>]+(?:\([\w\d]+\)|([^[:punct:]\s]|/)))[\'\"]#i';
preg_match_all($regex, $record->$columnname, $match);
foreach ($match[0] as $i => $fullmatch) {
if (strpos($fullmatch, $CFG->wwwroot) !== false) {
if (\core_text::strpos($fullmatch, $CFG->wwwroot) !== false) {
continue;
}
$prefix = $match[1][$i];
@@ -189,7 +189,7 @@ class url_finder {
}
if ($replacing) {
// For replace string use: prefix, protocol, host and one extra character.
$found[$prefix . substr($url, 0, strlen($host) + 8)] = $host;
$found[$prefix . \core_text::substr($url, 0, \core_text::strlen($host) + 8)] = $host;
} else {
$entry["table"] = $table;
$entry["columnname"] = $columnname;