JFIF x x C C " } !1AQa "q2#BR$3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz w !1AQ aq"2B #3Rbr{
File "languageDynamic.php"
Full Path: /home/u703019046/domains/nawabs.com.au/public_html/app/Helpers/languageDynamic.php
File size: 2.49 KB
MIME-type: text/x-php
Charset: utf-8
<?php
function getAllResourceFiles($dir, &$results = array()) {
$files = scandir($dir);
foreach ($files as $key => $value) {
$path = $dir ."/". $value;
if (!is_dir($path)) {
$results[] = $path;
} else if ($value != "." && $value != "..") {
getAllResourceFiles($path, $results);
}
}
return $results;
}
function getRegexBetween($content) {
preg_match_all("%\{{ __\(['|\"](.*?)['\"]\) }}%i", $content, $matches1, PREG_PATTERN_ORDER);
preg_match_all("%\@lang\(['|\"](.*?)['\"]\)%i", $content, $matches2, PREG_PATTERN_ORDER);
preg_match_all("%trans\(['|\"](.*?)['\"]\)%i", $content, $matches3, PREG_PATTERN_ORDER);
$Alldata = [$matches1[1], $matches2[1], $matches3[1]];
$data = [];
foreach ($Alldata as $value) {
if(!empty($value)){
foreach ($value as $val) {
$data[$val] = $val;
}
}
}
return $data;
}
function generateLang($path = ''){
// user panel
$paths = getAllResourceFiles(resource_path('views'));
$paths = array_merge($paths, getAllResourceFiles(app_path()));
$paths = array_merge($paths, getAllResourceFiles(resource_path('views/test')));
// end user panel
// user validation
$paths = getAllResourceFiles(app_path());
$paths = array_merge($paths, getAllResourceFiles(app_path('Http/Controllers/test')));
$paths = array_merge($paths, getAllResourceFiles(app_path('Http/Controllers/Auth')));
// end user validation
// admin panel
$paths = getAllResourceFiles(resource_path('views/admin'));
// end admin panel
// admin validation
$paths = getAllResourceFiles(app_path('Http/Controllers/Admin'));
// end validation
$AllData= [];
foreach ($paths as $key => $path) {
$AllData[] = getRegexBetween(file_get_contents($path));
}
$modifiedData = [];
foreach ($AllData as $value) {
if(!empty($value)){
foreach ($value as $val) {
$modifiedData[$val] = $val;
}
}
}
$modifiedData = var_export($modifiedData, true);
file_put_contents('lang/en/translate.php', "<?php\n return {$modifiedData};\n ?>");
}
function html_decode($text){
$after_decode = htmlspecialchars_decode($text, ENT_QUOTES);
return $after_decode;
}
function num_format($amount){
$formattedAmount = number_format($amount, 2, '.', ',');
return $formattedAmount;
}