if (!strstr($hook, 'woocommerce') && !strstr($hook, 'product') && !strstr($hook, 'wc_')) { unset(self::$custom_hooks_found[$hook]); } } ksort(self::$custom_hooks_found); if (!empty(self::$custom_hooks_found)) { echo '<div class="panel panel-default"><div class="panel-heading"><h2>' . $heading . '</h2></div>'; echo '<table class="summary table table-bordered table-striped"><thead><tr><th>Hook</th><th>Type</th><th>File(s)</th></tr></thead><tbody>'; foreach (self::$custom_hooks_found as $hook => $details) { echo '<tr> <td>' . self::get_hook_link($hook, $details) . '</td> <td>' . $details['type'] . '</td> <td>' . implode(', ', array_unique($details['file'])) . '</td> </tr>' . "\n"; } echo '</tbody></table></div>'; } } echo '</div><div id="footer">'; $html = file_get_contents('../wc-apidocs/tree.html'); $header = current(explode('<div id="content">', $html)); $header = str_replace('<li class="active">', '<li>', $header); $header = str_replace('<li class="hooks">', '<li class="active">', $header); $header = str_replace('Tree | ', 'Hook Reference | ', $header); $footer = end(explode('<div id="footer">', $html)); file_put_contents('../wc-apidocs/hook-docs.html', $header . ob_get_clean() . $footer); echo "Hook docs generated :)\n"; } } WC_HookFinder::process_hooks();