Astra_WebFont_Loader::get_styles()

Get styles with fonts downloaded locally.


Description


Return

(string)


Source

File: inc/lib/webfont/class-astra-webfont-loader.php

	public function get_styles() {

		// If we already have the local file, return its contents.
		$local_stylesheet_contents = $this->get_local_stylesheet_contents();
		if ( $local_stylesheet_contents ) {
			return $local_stylesheet_contents;
		}

		// Get the remote URL contents.
		$this->remote_styles = $this->get_remote_url_contents();

		// Get an array of locally-hosted files.
		$files = $this->get_local_files_from_css();

		// Convert paths to URLs.
		foreach ( $files as $remote => $local ) {
			$files[ $remote ] = str_replace(
				$this->get_base_path(),
				$this->get_base_url(),
				$local
			);
		}

		$this->css = str_replace(
			array_keys( $files ),
			array_values( $files ),
			$this->remote_styles
		);

		$this->write_stylesheet();

		return $this->css;
	}

Changelog

Changelog
Version Description
3.6.0 Introduced.


User Contributed Notes

You must log in before being able to contribute a note or feedback.