Created
September 27, 2013 14:52
-
-
Save kopepasah/6729843 to your computer and use it in GitHub Desktop.
Much like the other lists I created here, this will list Exchange functions.
This file contains 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 | |
$GLOBALS['functions'] = array(); | |
function list_theme_functions( $directory ) { | |
global $functions; | |
$files = array_diff( scandir( $directory ), array( '.', '..', '_list-files.php', '_list-hooks.php', '_get-contents.php', '.DS_Store', 'nonce.php', '_list-hooks-duplicates.php', '_list-functions.php' ) ); | |
foreach ( $files as $file ) { | |
if ( dirname( __FILE__ ) == $directory ) { | |
if ( is_dir( $directory . '/' . $file ) ) { | |
$folder = $file . '.php'; | |
} | |
if ( $folder != $file ) { | |
if ( is_dir( $file ) ) { | |
if ( preg_match_all( "|" . preg_quote( 'it_exchange(' ) . "(.*?)\)|", file_get_contents( dirname( __FILE__ ) . '/' . $file . '.php' ), $matches ) ) { | |
$actions = str_replace( ' ', '', str_replace( '<?php ', '', str_replace( ');', ')', $matches[0] ) ) ); | |
foreach ( $actions as $action ) { | |
$action = explode( '\'', $action ); | |
// echo '*[[Exchange_Theme_API:_' . $action[1] . '_(' . $action[3] . ')|it_exchange( \'' . $action[1] . '\', \'' . $action[3] . '\' )]]' . "\n"; | |
$functions[$action[1]][$action[3]] = '*[[Exchange_Theme_API:_' . $action[1] . '_(' . $action[3] . ')|it_exchange( \'' . $action[1] . '\', \'' . $action[3] . '\' )]]'; | |
} | |
} | |
} else { | |
if ( preg_match_all( "|" . preg_quote( 'it_exchange(' ) . "(.*?)\)|", file_get_contents( dirname( __FILE__ ) . '/' . $file ), $matches ) ) { | |
$actions = str_replace( ' ', '', str_replace( '<?php ', '', str_replace( ');', ')', $matches[0] ) ) ); | |
foreach ( $actions as $action ) { | |
$action = explode( '\'', $action ); | |
// echo '*[[Exchange_Theme_API:_' . $action[1] . '_(' . $action[3] . ')|it_exchange( \'' . $action[1] . '\', \'' . $action[3] . '\' )]]' . "\n"; | |
$functions[$action[1]][$action[3]] = '*[[Exchange_Theme_API:_' . $action[1] . '_(' . $action[3] . ')|it_exchange( \'' . $action[1] . '\', \'' . $action[3] . '\' )]]'; | |
} | |
} | |
} | |
} | |
} else { | |
if ( ! is_dir( $directory . '/' . $file ) ) { | |
if ( preg_match_all( "|" . preg_quote( 'it_exchange(' ) . "(.*?)\)|", file_get_contents( $directory . '/' . $file ), $matches ) ) { | |
$actions = str_replace( ' ', '', str_replace( '<?php ', '', str_replace( ');', ')', $matches[0] ) ) ); | |
foreach ( $actions as $action ) { | |
$action = explode( '\'', $action ); | |
// echo '*[[Exchange_Theme_API:_' . $action[1] . '_(' . $action[3] . ')|it_exchange( \'' . $action[1] . '\', \'' . $action[3] . '\' )]]' . "\n"; | |
$functions[$action[1]][$action[3]] = '*[[Exchange_Theme_API:_' . $action[1] . '_(' . $action[3] . ')|it_exchange( \'' . $action[1] . '\', \'' . $action[3] . '\' )]]'; | |
} | |
} | |
} | |
} | |
if ( is_dir( $directory . '/' . $file ) ) | |
list_theme_functions( $directory . '/' . $file ); | |
} | |
} | |
list_theme_functions( dirname( __FILE__ ) ); | |
header('Content-Type: text/plain'); | |
foreach ( $functions as $context => $tag ) { | |
echo "\n===" . ucwords( str_replace( '-', ' ', $context ) ) . "===\n"; | |
foreach ( $tag as $link ) { | |
echo $link . "\n"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment