forked from SaturnTeam/saturn-datepicker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rename.php
41 lines (38 loc) · 1.18 KB
/
rename.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
37
38
39
40
41
<?php
function replace($dir) {
$files = scandir($dir);
$sources = [
'mat-calendar',
'MatCalendar',
'MatDatepicker',
'mat-datepicker',
'mat-month',
'MatMonth',
'mat-multi',
'MatMulti',
'mat-year',
'MatYear',
'MatNativeDateModule',
];
$targets = str_replace(['mat', 'Mat'], ['sat', 'Sat'], $sources);
array_push($sources, '.sat');
array_push($sources, '"sat');
array_push($sources, "'class': 'sat");
array_push($sources, "exportAs: 'sat");
array_push($sources, "panelClass: 'sat");
array_push($targets, '.mat');
array_push($targets, '"mat');
array_push($targets, "'class': 'mat");
array_push($targets, "exportAs: 'mat");
array_push($targets, "panelClass: 'mat");
foreach ($files as $file) {
if (strrpos($file, 'html') > 0 || strrpos($file, 'ts') > 0) {
$contents = file_get_contents($dir . $file);
$contents = str_replace($sources, $targets, $contents);
file_put_contents($dir . $file, $contents);
// echo $contents;
}
}
}
replace('src/material/datepicker/');
replace('src/material/core/datetime/');