MDL-60655 tool_httpsreplace: Use \core_text string functions
authorJun Pataleta <jun@moodle.com>
Wed, 1 Nov 2017 21:38:33 +0000 (10:38 +1300)
committerJun Pataleta <jun@moodle.com>
Wed, 1 Nov 2017 21:42:33 +0000 (10:42 +1300)
admin/tool/httpsreplace/classes/url_finder.php

index 18c8e22..8dc1416 100644 (file)
@@ -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;