ap_cache_dir()

Description #

Handles AnsPress caching

Source #

File: includes/cache.php

function ap_cache_dir() {
		global $wp;
		$current_url_path = str_replace( rtrim( ap_base_page_link(), '/' ), '', esc_url( home_url( add_query_arg( [], $wp->request ) ) ) );

		$current_url_path = ltrim( $current_url_path, '/' );
	if ( empty( $current_url_path ) ) {
		$current_url_path = 'index';
	}
		$folder = rtrim( $current_url_path, basename( $current_url_path ) );
		return (object) array(
			'current_path' => $current_url_path,
			'filename'     => basename( $current_url_path ) . '.html',
			'folder'       => ANSPRESS_CACHE_DIR . '/' . $folder,
			'path'         => ANSPRESS_CACHE_DIR . '/' . $current_url_path . '.html',
		);
}

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Add your comment