'; include_once( AIOSEO_DIR . '/app/Common/Views/sitemap/xsl/default.php' ); exit; } /** * Save the data to use in the XSL. * * @since 4.1.5 * * @param string $fileName The sitemap file name. * @param array $entries The sitemap entries. * @param int $total The total sitemap entries count. * @return void */ public function saveXslData( $fileName, $entries, $total ) { $counts = []; $datetime = []; $dateFormat = get_option( 'date_format' ); $timeFormat = get_option( 'time_format' ); foreach ( $entries as $index ) { $url = ! empty( $index['guid'] ) ? $index['guid'] : $index['loc']; if ( ! empty( $index['count'] ) && aioseo()->options->sitemap->general->linksPerIndex !== (int) $index['count'] ) { $counts[ $url ] = $index['count']; } if ( ! empty( $index['lastmod'] ) || ! empty( $index['publicationDate'] ) || ! empty( $index['pubDate'] ) ) { $date = ! empty( $index['lastmod'] ) ? $index['lastmod'] : ( ! empty( $index['publicationDate'] ) ? $index['publicationDate'] : $index['pubDate'] ); $isTimezone = ! empty( $index['isTimezone'] ) && $index['isTimezone']; $datetime[ $url ] = [ 'date' => $isTimezone ? date_i18n( $dateFormat, strtotime( $date ) ) : get_date_from_gmt( $date, $dateFormat ), 'time' => $isTimezone ? date_i18n( $timeFormat, strtotime( $date ) ) : get_date_from_gmt( $date, $timeFormat ) ]; } } $data = [ 'counts' => $counts, 'datetime' => $datetime, 'pagination' => [ 'showing' => count( $entries ), 'total' => $total ] ]; // Set a high expiration date so we still have the cache for static sitemaps. aioseo()->core->cache->update( 'aioseo_sitemap_' . $fileName, $data, MONTH_IN_SECONDS ); } /** * Retrieve the data to use on the XSL. * * @since 4.2.1 * * @param string $fileName The sitemap file name. * @return array The XSL data for the given file name. */ public function getXslData( $fileName ) { return aioseo()->core->cache->get( 'aioseo_sitemap_' . $fileName ); } }