79 lines
1.8 KiB
PHP
79 lines
1.8 KiB
PHP
<?php
|
|
|
|
function to_camel_case_from_upper_underscore($string, $capitalizeFirstCharacter = true)
|
|
{
|
|
|
|
$str = str_replace(' ', '', ucwords(str_replace('_', ' ', strtolower($string))));
|
|
|
|
if (!$capitalizeFirstCharacter) {
|
|
$str[0] = strtolower($str[0]);
|
|
}
|
|
|
|
return $str;
|
|
}
|
|
|
|
function from_camel_case($input) {
|
|
preg_match_all('!([A-Z][A-Z0-9]*(?=$|[A-Z][a-z0-9])|[A-Za-z][a-z0-9]+)!', $input, $matches);
|
|
$ret = $matches[0];
|
|
foreach ($ret as &$match) {
|
|
$match = $match == strtoupper($match) ? strtolower($match) : lcfirst($match);
|
|
}
|
|
return implode('_', $ret);
|
|
}
|
|
|
|
if (isset($argc)) {
|
|
for ($i = 0; $i < $argc; $i++) {
|
|
echo "Argument #" . $i . " - " . $argv[$i] . "\n";
|
|
}
|
|
}
|
|
else {
|
|
echo "argc and argv disabled\n";
|
|
}
|
|
|
|
$files = [];
|
|
|
|
if ($argv[1] == 'all') {
|
|
$files = scandir('src/r3/', SCANDIR_SORT_DESCENDING);
|
|
$systemFiles = scandir('src/r3/r3-system', SCANDIR_SORT_DESCENDING);
|
|
$componentFiles = scandir('src/r3/r3-component', SCANDIR_SORT_DESCENDING);
|
|
|
|
$newFiles = [];
|
|
|
|
for ($i = 0; $i < sizeof($files); $i++) {
|
|
|
|
if (preg_match('/index\.js$/', $files[$i])) {
|
|
continue;
|
|
}
|
|
|
|
if (preg_match('/\.js$/', $files[$i])) {
|
|
array_push($newFiles, 'src/r3/' . $files[$i]);
|
|
}
|
|
}
|
|
|
|
for ($i = 0; $i < sizeof($systemFiles); $i++) {
|
|
|
|
if (preg_match('/index\.js$/', $systemFiles[$i])) {
|
|
continue;
|
|
}
|
|
|
|
if (preg_match('/\.js$/', $systemFiles[$i])) {
|
|
array_push($newFiles, 'src/r3/r3-system/' . $systemFiles[$i]);
|
|
}
|
|
}
|
|
|
|
for ($i = 0; $i < sizeof($componentFiles); $i++) {
|
|
|
|
if (preg_match('/index\.js$/', $componentFiles[$i])) {
|
|
continue;
|
|
}
|
|
|
|
if (preg_match('/\.js$/', $componentFiles[$i])) {
|
|
array_push($newFiles, 'src/r3/r3-component/' . $componentFiles[$i]);
|
|
}
|
|
}
|
|
|
|
$files = $newFiles;
|
|
|
|
} else {
|
|
$files = [$argv[1]];
|
|
} |