MDL-60281 general: create_function is deprecated in PHP7.2
This commit is contained in:
+16
-11
@@ -289,11 +289,12 @@ class ouwiki_line {
|
||||
// Note that using a single param for replace only works because all
|
||||
// the search strings are 6 characters long
|
||||
$data=str_replace(array(' ',' ',' '),' ',$data);
|
||||
|
||||
|
||||
// Tags replaced with equal number of spaces
|
||||
$data=preg_replace_callback('/<.*?'.'>/',create_function(
|
||||
'$matches','return preg_replace("/./"," ",$matches[0]);'),$data);
|
||||
|
||||
$data = preg_replace_callback('/<.*?'.'>/', function($matches) {
|
||||
return preg_replace("/./", " ", $matches[0]);
|
||||
}, $data);
|
||||
|
||||
// 2. Analyse string so that each space-separated thing
|
||||
// is counted as a 'word' (note these may not be real words,
|
||||
// for instance words may include punctuation at either end)
|
||||
@@ -409,9 +410,10 @@ function ouwiki_diff_html_to_lines($content) {
|
||||
// Get rid of all script, style, object tags (that might contain non-text
|
||||
// outside tags)
|
||||
$content=preg_replace_callback(
|
||||
'^(<script .*?</script>)|(<object .*?</object>)|(<style .*?</style>)^i',create_function(
|
||||
'$matches','return preg_replace("/./"," ",$matches[0]);'),$content);
|
||||
|
||||
'^(<script .*?</script>)|(<object .*?</object>)|(<style .*?</style>)^i', function($matches) {
|
||||
return preg_replace("/./", " ", $matches[0]);
|
||||
}, $content);
|
||||
|
||||
// Get rid of all ` symbols as we are going to use these for a marker later.
|
||||
$content=preg_replace('/[`]/',' ',$content);
|
||||
|
||||
@@ -424,8 +426,9 @@ function ouwiki_diff_html_to_lines($content) {
|
||||
}
|
||||
$taglist.="<$blocktag>|<\\/$blocktag>";
|
||||
}
|
||||
$content=preg_replace_callback('/(('.$taglist.')\s*)+/i',create_function(
|
||||
'$matches','return "`".preg_replace("/./"," ",substr($matches[0],1));'),$content);
|
||||
$content = preg_replace_callback('/((' . $taglist . ')\s*)+/i', function($matches) {
|
||||
return "`" . preg_replace("/./", " ", substr($matches[0], 1));
|
||||
}, $content);
|
||||
|
||||
// Now go through splitting each line
|
||||
$lines=array(); $index=1;
|
||||
@@ -709,8 +712,10 @@ function ouwiki_diff($file1,$file2) {
|
||||
*/
|
||||
function ouwiki_diff_add_markers($html,$words,$markerclass,$beforetext,$aftertext) {
|
||||
// Sort words by start position
|
||||
usort($words, create_function('$a,$b','return $a->start-$b->start;'));
|
||||
|
||||
usort($words, function($a, $b) {
|
||||
return $a->start - $b->start;
|
||||
});
|
||||
|
||||
// Add marker for each word. We use an odd tag name which will
|
||||
// be replaced by span later, this for ease of replacing
|
||||
$spanstart="<ouwiki_diff_add_markers>";
|
||||
|
||||
Reference in New Issue
Block a user