Nie ma skryptu ani wtyczki, o których wiem, aby robić to, co chcesz. Jak już wspomniałeś, istnieją skrypty ( nawet zmienne globalne ), których możesz użyć do drukowania filtrów i aktualnie używanych akcji.
Jeśli chodzi o uśpione filtry i akcje, napisałem dwie bardzo podstawowe funkcje ( z pewną pomocą tu i tam ), które znajdują wszystkie apply_filtersi do_actioninstancje w pliku, a następnie drukują go
PODSTAWY
Będziemy używać RecursiveDirectoryIterator, RecursiveIteratorIteratora RegexIteratorklasy PHP, aby uzyskać wszystkie pliki PHP w katalogu. Jako przykład użyłem na moim localhostE:\xammp\htdocs\wordpress\wp-includes
Następnie przejdziemy przez pliki i przeszukamy i zwrócimy ( preg_match_all) wszystkie wystąpienia apply_filtersi do_action. Skonfigurowałem go, aby pasował do zagnieżdżonych instancji nawiasów, a także aby dopasować możliwe białe spacje między apply_filters/ do_actiona pierwszym nawiasiem
Po prostu utworzymy tablicę ze wszystkimi filtrami i akcjami, a następnie przejdziemy przez tablicę i wyprowadzimy nazwę pliku oraz filtry i akcje. Pomiń pliki bez filtrów / akcji
WAŻNE NOTATKI
Te funkcje są bardzo drogie. Uruchom je tylko na lokalnej instalacji testowej.
Zmodyfikuj funkcje zgodnie z potrzebami. Możesz zdecydować się zapisać wynik do pliku, utworzyć specjalną stronę zaplecza, opcje są nieograniczone
OPCJA 1
Pierwszy opcje funkcja jest bardzo prosta, wrócimy zawartość pliku jako ciąg znaków z wykorzystaniem file_get_contents, wyszukać apply_filters/ do_actionprzypadkach i po prostu wyjście nazwy pliku i filtrowanie nazw / action
Skomentowałem kod dla łatwego śledzenia
function get_all_filters_and_actions( $path = '' )
{
//Check if we have a path, if not, return false
if ( !$path )
return false;
// Validate and sanitize path
$path = filter_var( $path, FILTER_SANITIZE_URL );
/**
* If valiadtion fails, return false
*
* You can add an error message of something here to tell
* the user that the URL validation failed
*/
if ( !$path )
return false;
// Get each php file from the directory or URL
$dir = new RecursiveDirectoryIterator( $path );
$flat = new RecursiveIteratorIterator( $dir );
$files = new RegexIterator( $flat, '/\.php$/i' );
if ( $files ) {
$output = '';
foreach($files as $name=>$file) {
/**
* Match and return all instances of apply_filters(**) or do_action(**)
* The regex will match the following
* - Any depth of nesting of parentheses, so apply_filters( 'filter_name', parameter( 1,2 ) ) will be matched
* - Whitespaces that might exist between apply_filters or do_action and the first parentheses
*/
// Use file_get_contents to get contents of the php file
$get_file_content = file_get_contents( $file );
// Use htmlspecialchars() to avoid HTML in filters from rendering in page
$save_content = htmlspecialchars( $get_file_content );
preg_match_all( '/(apply_filters|do_action)\s*(\([^()]*(?:(?-1)[^()]*)*+\))/', $save_content, $matches );
// Build an array to hold the file name as key and apply_filters/do_action values as value
if ( $matches[0] )
$array[$name] = $matches[0];
}
foreach ( $array as $file_name=>$value ) {
$output .= '<ul>';
$output .= '<strong>File Path: ' . $file_name .'</strong></br>';
$output .= 'The following filters and/or actions are available';
foreach ( $value as $k=>$v ) {
$output .= '<li>' . $v . '</li>';
}
$output .= '</ul>';
}
return $output;
}
return false;
}
Możesz użyć w follow na szablonie, frontendzie lub backendu
echo get_all_filters_and_actions( 'E:\xammp\htdocs\wordpress\wp-includes' );
To zostanie wydrukowane

OPCJA 2
Ta opcja jest nieco droższa w uruchomieniu. Ta funkcja zwraca numer wiersza, w którym można znaleźć filtr / akcję.
Tutaj używamy filedo rozbicia pliku na tablicę, a następnie szukamy i zwracamy filtr / akcję oraz numer linii
function get_all_filters_and_actions2( $path = '' )
{
//Check if we have a path, if not, return false
if ( !$path )
return false;
// Validate and sanitize path
$path = filter_var( $path, FILTER_SANITIZE_URL );
/**
* If valiadtion fails, return false
*
* You can add an error message of something here to tell
* the user that the URL validation failed
*/
if ( !$path )
return false;
// Get each php file from the directory or URL
$dir = new RecursiveDirectoryIterator( $path );
$flat = new RecursiveIteratorIterator( $dir );
$files = new RegexIterator( $flat, '/\.php$/i' );
if ( $files ) {
$output = '';
$array = [];
foreach($files as $name=>$file) {
/**
* Match and return all instances of apply_filters(**) or do_action(**)
* The regex will match the following
* - Any depth of nesting of parentheses, so apply_filters( 'filter_name', parameter( 1,2 ) ) will be matched
* - Whitespaces that might exist between apply_filters or do_action and the first parentheses
*/
// Use file_get_contents to get contents of the php file
$get_file_contents = file( $file );
foreach ( $get_file_contents as $key=>$get_file_content ) {
preg_match_all( '/(apply_filters|do_action)\s*(\([^()]*(?:(?-1)[^()]*)*+\))/', $get_file_content, $matches );
if ( $matches[0] )
$array[$name][$key+1] = $matches[0];
}
}
if ( $array ) {
foreach ( $array as $file_name=>$values ) {
$output .= '<ul>';
$output .= '<strong>File Path: ' . $file_name .'</strong></br>';
$output .= 'The following filters and/or actions are available';
foreach ( $values as $line_number=>$string ) {
$whitespaces = ' ';
$output .= '<li>Line reference ' . $line_number . $whitespaces . $string[0] . '</li>';
}
$output .= '</ul>';
}
}
return $output;
}
return false;
}
Możesz użyć w follow na szablonie, frontendzie lub backendu
echo get_all_filters_and_actions2( 'E:\xammp\htdocs\wordpress\wp-includes' );
To zostanie wydrukowane

EDYTOWAĆ
Jest to w zasadzie tyle, ile mogę, bez przekroczenia limitu czasu skryptów lub braku pamięci. Z kodem w opcji 2 jest tak proste, jak przejście do wspomnianego pliku i linii w kodzie źródłowym, a następnie uzyskanie wszystkich prawidłowych wartości parametrów filtru / akcji, a także, co ważne, uzyskanie funkcji i dalszego kontekstu, w którym używany jest filtr / akcja