archives(); $this->attributes = $attributes; if ( 'asc' === strtolower( $this->attributes['order'] ) ) { $dateArchives = array_reverse( $dateArchives, true ); } $data = [ 'dateArchives' => $dateArchives, 'lines' => '' ]; foreach ( $dateArchives as $year => $months ) { $data['lines'] .= $this->generateYearLine( $year, $months ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } ob_start(); aioseo()->templates->getTemplate( 'sitemap/html/compact-archive.php', $data ); $output = ob_get_clean(); if ( $echo ) { echo $output; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } return $output; } // phpcs:enable VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable /** * Generates the HTML for a year line. * * @since 4.1.3 * * @param int $year The year archive. * @param array $months The month archives for the current year. * @return string The HTML code for the year. */ protected function generateYearLine( $year, $months ) { $html = '