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' ] ); } // Enqueue public scripts and styles add_action( 'wp_enqueue_scripts', [ $this, 'public_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' ] ); add_action( 'wp_ajax_log_js_errors', [ $this->debug_log, 'log_js_errors' ] ); add_action( 'wp_ajax_nopriv_log_js_errors', [ $this->debug_log, 'log_js_errors' ] ); } /** * 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.

Debug Log Manager by bowo.io

debug_log->get_status(); ?>
debug_log->get_autorefresh_status(); ?>
debug_log->get_entries_datatable(); ?>
$log_status, 'autorefreshStatus' => $autorefresh_status, 'jsErrorLogging' => array( 'status' => '', 'url' => admin_url( 'admin-ajax.php' ), 'nonce' => wp_create_nonce( DLM_SLUG ), 'action' => 'log_js_errors', ), ) ); } /** * Enqueue public scripts * * @since 1.4.0 */ public function public_scripts() { wp_enqueue_script( 'dlm-public', DLM_URL . 'assets/js/public.js', array( 'jquery' ), DLM_VERSION, false ); $log_info = get_option( 'debug_log_manager' ); $log_status = $log_info['status']; // WP_DEBUG log status: enabled / disabled wp_localize_script( 'dlm-public', 'dlmVars', array( 'logStatus' => $log_status, 'jsErrorLogging' => array( 'status' => '', 'url' => admin_url( 'admin-ajax.php' ), 'nonce' => wp_create_nonce( DLM_SLUG ), 'action' => 'log_js_errors', ), ) ); } } Debug_Log_Manager::get_instance();