Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

LLMS_Certificates::get_stylesheet_raw( string $stylesheet_href, boolean $allowed_only = true )

Get stylesheet raw content given its URL


Parameters Parameters

$stylesheet_href

(string) (Required) The stylesheet href.

$allowed_only

(boolean) (Optional) Get only stylesheet whose host is not in the export_blocked_stylesheet_hosts list.

Default value: true


Top ↑

Return Return

(string|false)


Top ↑

Source Source

File: includes/class.llms.certificates.php

	private function get_stylesheet_raw( $stylesheet_href, $allowed_only = true ) {

		$href_host = wp_parse_url( $stylesheet_href, PHP_URL_HOST );

		// Only include stylesheets from non blocked hosts.
		if ( $allowed_only && in_array( $href_host, $this->export_blocked_stylesheet_hosts, true ) ) {
			return false;
		}

		// Get the actual CSS.
		if ( in_array( $href_host, $this->export_local_hosts, true ) ) { // Is local?
			$raw = file_get_contents( untrailingslashit( ABSPATH ) . wp_parse_url( $stylesheet_href, PHP_URL_PATH ) ); // phpcs:ignore WordPress.WP.AlternativeFunctions -- getting a local file.
		} else {
			$response = wp_remote_get( $stylesheet_href );
			$raw      = wp_remote_retrieve_body( $response );
		}

		return $raw;

	}


Top ↑

Changelog Changelog

Changelog
Version Description
4.21.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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