-
Notifications
You must be signed in to change notification settings - Fork 0
/
fix-links.php
36 lines (31 loc) · 1001 Bytes
/
fix-links.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
require_once 'common.php';
function fixLinks($page){
global $list;
$original = $data = file_get_contents(getFileName($page));
foreach($list as $link){
$name = utf8_decode($link['name']);
$normal = $link['normal'];
//if($name==$normal) continue;
//echo "cambiando $name a $normal\n";
$data=str_replace("[$normal|$normal]","[[$normal]]",$data);
$data=str_replace("[$normal]($normal)","[[$normal]]",$data);
$data=str_replace("[[$name]]","[[$normal]]",$data);
$data=str_replace("]($name)","]($normal)",$data);
$data=str_replace("|$name]","]($normal)",$data);
$data=str_replace("]($name#","]($normal#",$data);
}
$data=str_replace("~[","[",$data);
$data=str_replace("~]","]",$data);
if($original == $data){
echo "SIN CAMBIOS: ".$page['normal']."\n";
}else{
savePage($page,$data);
}
}
foreach($list as $page){
if(!exists($page)) continue;
//if($page['name']!='Denko') continue;
fixLinks($page);
}
echo "\n\nListo, ya estan arreglados los links y todo :)\n\n";