collector->get_data(); if ( ! empty( $data->trans ) ) { $this->before_tabular_output(); echo ''; echo ''; echo '' . esc_html__( 'Updated Transient', 'query-monitor' ) . ''; if ( $data->has_type ) { echo '' . esc_html_x( 'Type', 'transient type', 'query-monitor' ) . ''; } echo '' . esc_html__( 'Expiration', 'query-monitor' ) . ''; echo '' . esc_html_x( 'Size', 'size of transient value', 'query-monitor' ) . ''; echo '' . esc_html__( 'Caller', 'query-monitor' ) . ''; echo '' . esc_html__( 'Component', 'query-monitor' ) . ''; echo ''; echo ''; echo ''; foreach ( $data->trans as $row ) { $component = $row['component']; echo ''; printf( '%s', esc_html( $row['name'] ) ); if ( $data->has_type ) { printf( '%s', esc_html( $row['type'] ) ); } if ( 0 === $row['expiration'] ) { printf( '%s', esc_html__( 'none', 'query-monitor' ) ); } else { printf( '%s (~%s)', esc_html( (string) $row['expiration'] ), esc_html( $row['exp_diff'] ) ); } printf( '~%s', esc_html( $row['size_formatted'] ) ); $stack = array(); foreach ( $row['filtered_trace'] as $frame ) { $stack[] = self::output_filename( $frame['display'], $frame['calling_file'], $frame['calling_line'] ); } $caller = array_shift( $stack ); echo ''; if ( ! empty( $stack ) ) { echo self::build_toggler(); // WPCS: XSS ok; } echo '
    '; echo "
  1. {$caller}
  2. "; // WPCS: XSS ok. if ( ! empty( $stack ) ) { echo '
  3. ' . implode( '
  4. ', $stack ) . '
  5. '; // WPCS: XSS ok. } echo '
'; printf( '%s', esc_html( $component->name ) ); echo ''; } $this->after_tabular_output(); } else { $this->before_non_tabular_output(); $notice = __( 'No transients set.', 'query-monitor' ); echo $this->build_notice( $notice ); // WPCS: XSS ok. $this->after_non_tabular_output(); } } /** * @param array $menu * @return array */ public function admin_menu( array $menu ) { /** @var QM_Data_Transients $data */ $data = $this->collector->get_data(); $count = count( $data->trans ); $title = ( empty( $count ) ) ? __( 'Transient Updates', 'query-monitor' ) /* translators: %s: Number of transient values that were updated */ : __( 'Transient Updates (%s)', 'query-monitor' ); $menu[ $this->collector->id() ] = $this->menu( array( 'title' => esc_html( sprintf( $title, number_format_i18n( $count ) ) ), ) ); return $menu; } } /** * @param array $output * @param QM_Collectors $collectors * @return array */ function register_qm_output_html_transients( array $output, QM_Collectors $collectors ) { $collector = QM_Collectors::get( 'transients' ); if ( $collector ) { $output['transients'] = new QM_Output_Html_Transients( $collector ); } return $output; } add_filter( 'qm/outputter/html', 'register_qm_output_html_transients', 100, 2 );