diff options
author | Thomas Willingham <founder@kakste.com> | 2013-06-07 03:46:43 +0100 |
---|---|---|
committer | Thomas Willingham <founder@kakste.com> | 2013-06-07 03:46:43 +0100 |
commit | 466a6d5227fbaf0a36cd76b5603cb42bb1b7462b (patch) | |
tree | 395936a63e27fa105e0dc69d13c1b951dc9e9439 /util/tpldebug.php | |
parent | dc6472e046ee6ac0afc934e8ad1edc1e281a3cb0 (diff) | |
parent | c21f8c68e39e22a0348e5717109f0005d4d35809 (diff) | |
download | volse-hubzilla-466a6d5227fbaf0a36cd76b5603cb42bb1b7462b.tar.gz volse-hubzilla-466a6d5227fbaf0a36cd76b5603cb42bb1b7462b.tar.bz2 volse-hubzilla-466a6d5227fbaf0a36cd76b5603cb42bb1b7462b.zip |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'util/tpldebug.php')
-rw-r--r-- | util/tpldebug.php | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/util/tpldebug.php b/util/tpldebug.php new file mode 100644 index 000000000..80da410dc --- /dev/null +++ b/util/tpldebug.php @@ -0,0 +1,43 @@ +<?php + +// Tool to assist with figuring out what variables are passed to templates. +// It will take a source php file and print all the template calls it finds, including the passed args. +// With no args it will enumerate all templates in boot.php, include/* and mod/* +// This is a quick hack and far from perfect (there's a template call in boot.php that buggers the regex from the get-go) +// but is one step towards template documentation. + + +if($argc > 1) { + echo "{$argv[1]}: templates\n"; + print_template($argv[1]); +} +else { + + + echo 'boot.php: templates' . "\n"; + print_template('boot.php'); + + $files = glob('include/*.php'); + foreach($files as $file) { + echo $file . ': templates'. "\n"; + print_template($file); + } + + $files = glob('mod/*.php'); + foreach($files as $file) { + echo $file . ': templates'. "\n"; + print_template($file); + } +} + +function print_template($s) { + $x = file_get_contents($s); + + $cnt = preg_match_all('/replace_macros(.*?)\)\;/ism',$x,$matches); + + if($cnt) { + print_r($matches[0]); + + } + +}
\ No newline at end of file |