mirror of
https://github.com/danog/tgseclib.git
synced 2024-12-11 16:49:41 +01:00
67aedc240b
This has been produced as follows: <?php $replace = $files = []; $it = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($argv[1])); foreach ($it as $fileinfo) { if ($fileinfo->getExtension() === 'php') { $file = $fileinfo->getPathname(); $content = file_get_contents($file); $files[$file] = $content; $tokens = token_get_all($content); foreach ($tokens as $key => $value) { if ($value[0] === T_CLASS) { $class = $tokens[$key + 2][1]; $replace += array( "$class::$class(" => "$class::__construct(", "parent::$class(" => "parent::__construct(", "function $class(" => "function __construct(", ); } } } } foreach ($files as $file => $content) { file_put_contents( $file, str_replace( array_keys($replace), array_values($replace), $content ) ); } |
||
---|---|---|
.. | ||
SSH |