'', ]; } public function print_html_label( $log_label ) { $title = $this->get_title(); if ( empty( $_GET[ self::CLEAR_LOG_ACTION ] ) ) { // phpcs:ignore -- nonce validation is not require here. $nonce = wp_create_nonce( self::CLEAR_LOG_ACTION ); $url = add_query_arg( [ self::CLEAR_LOG_ACTION => 1, '_wpnonce' => $nonce, ] ); $title .= '' . esc_html__( 'Clear Log', 'elementor' ) . ''; $title .= ''; } parent::print_html_label( $title ); } public function get_log_entries() { /** @var \Elementor\Core\Logger\Manager $manager */ $manager = Manager::instance(); /** @var \Elementor\Core\Logger\Loggers\Db $logger */ $logger = $manager->get_logger( 'db' ); if ( ! empty( $_GET[ self::CLEAR_LOG_ACTION ] ) ) { $nonce = Utils::get_super_global_value( $_GET, '_wpnonce' ); if ( ! wp_verify_nonce( $nonce, self::CLEAR_LOG_ACTION ) ) { wp_die( 'Invalid Nonce', 'Invalid Nonce', [ 'back_link' => true, ] ); } $logger->clear(); } $log_string = 'No entries to display'; $log_entries = $logger->get_formatted_log_entries( self::MAX_ENTRIES, false ); if ( ! empty( $log_entries ) ) { $entries_string = ''; foreach ( $log_entries as $key => $log_entry ) { if ( $log_entry['count'] ) { $entries_string .= '