Skip to content

Instantly share code, notes, and snippets.

@Rarst
Last active December 11, 2016 21:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Rarst/4012e07d1bf7db55f90624202aaa9fdc to your computer and use it in GitHub Desktop.
Save Rarst/4012e07d1bf7db55f90624202aaa9fdc to your computer and use it in GitHub Desktop.
Dump included PHP files from specific path.
<?php
add_action( 'shutdown', function () {
if ( ! defined( 'WPSEO_PATH' ) ) {
return;
}
$path = str_replace( '\\', '/', WPSEO_PATH );
$includes = array_reduce( get_included_files(), function ( $plugin_includes, $include_path ) use ( $path ) {
$include_path = str_replace( '\\', '/', $include_path );
if ( false !== stripos( $include_path, $path ) ) {
$plugin_includes[] = substr( $include_path, strlen( $path ) );
}
return $plugin_includes;
} );
sort( $includes );
s( $includes );
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment