is_dlm() ) { // Update footer text add_filter( 'admin_footer_text', [ $this, 'footer_text' ] ); // Enqueue admin scripts and styles only on the plugin's main page add_action( 'admin_enqueue_scripts', [ $this, 'admin_scripts' ] ); } // Register ajax calls $this->debug_log = new DLM\Classes\Debug_Log; add_action( 'wp_ajax_toggle_debugging', [ $this->debug_log, 'toggle_debugging' ] ); add_action( 'wp_ajax_toggle_autorefresh', [ $this->debug_log, 'toggle_autorefresh' ] ); add_action( 'wp_ajax_get_latest_entries', [ $this->debug_log, 'get_latest_entries' ] ); add_action( 'wp_ajax_clear_log', [ $this->debug_log, 'clear_log' ] ); } /** * Check if current screen is this plugin's main page * * @since 1.0.0 */ public function is_dlm() { $request_uri = sanitize_text_field( $_SERVER['REQUEST_URI'] ); // e.g. /wp-admin/index.php?page=page-slug if ( strpos( $request_uri, 'tools.php?page=' . DLM_SLUG ) !== false ) { return true; // Yes, this is the plugin's main page } else { return false; // Nope, this is NOT the plugin's page } } /** * Register admin menu * * @since 1.0.0 */ public function register_admin_menu() { add_submenu_page( 'tools.php', 'Debug Log Manager', 'Debug Log Manager', 'manage_options', 'debug-log-manager', [ $this, 'create_main_page' ] ); } /** * Register action links * * @since 1.0.0 */ public function action_links( $links ) { $settings_link = 'View Debug Log'; array_unshift($links, $settings_link); return $links; } /** * Change admin footer text * * @since 1.0.0 */ public function footer_text() { ?> Debug Log Manager (github) is built using DataTables.js, jSticky and jQuery Toast.