Created
December 31, 2009 07:47
-
-
Save co3k/266660 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$modules = array( | |
'pc' => 'pc_frontend', | |
'ktai' => 'mobile_frontend', | |
); | |
$ds = DIRECTORY_SEPARATOR; | |
if (!isset($argv[1]) || !realpath($argv[1])) | |
{ | |
echo 'You must give the OpenPNE2 directory'.PHP_EOL; | |
exit(1); | |
} | |
if (!isset($argv[2]) || !isset($modules[$argv[2]])) | |
{ | |
echo 'You must give the OpenPNE2 module name'.PHP_EOL; | |
exit(1); | |
} | |
$module = $argv[2]; | |
$path = realpath($argv[1]).$ds.'webapp'.$ds.'modules'.$ds.$module.$ds.'validate'.$ds.'page'; | |
$result = array(); | |
$iterator = new FileSystemIterator($path); | |
foreach ($iterator as $fileinfo) | |
{ | |
if (!$fileinfo->isFile()) | |
{ | |
continue; | |
} | |
$params = array(); | |
foreach (array_keys(parse_ini_file((string)$fileinfo, true)) as $k) | |
{ | |
$params[$k] = ''; | |
} | |
$result['page_'.$fileinfo->getbaseName('.ini')] = array( | |
'module' => '', | |
'action' => '', | |
'params' => $params, | |
); | |
} | |
echo '<?php'.PHP_EOL.'return '.var_export($result, true).';'.PHP_EOL; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment