Astra_Minify::get_js_url()
Returns a URL for the cached JS file.
Description
Return
(string)
Source
File: classes/class-astra-minify.php
public static function get_js_url() {
if ( defined( 'ASTRA_THEME_HTTP2' ) && ASTRA_THEME_HTTP2 ) {
self::enqueue_http2_js();
return false;
} elseif ( ! get_option( 'astra-addon-js-status' ) ) {
// Get the cache dir and js key.
$cache_dir = self::get_cache_dir();
$js_slug = self::_asset_slug();
$js_key = get_option( self::$_js_key . '-' . $js_slug );
$js_path = $cache_dir['path'] . $js_slug . '-' . $js_key . '.js';
$js_url = $cache_dir['url'] . $js_slug . '-' . $js_key . '.js';
if ( ! $js_key ) {
self::render_js();
return self::get_js_url();
}
// Get dependent js added from addon modules.
self::$dependent_js_files = get_option( self::$_js_key . '-dep-' . $js_slug );
// Check to see if the file exists.
if ( ! file_exists( $js_path ) ) {
self::render_fallback_js();
return false;
}
// Return the url.
return $js_url;
} else {
self::render_fallback_js();
return false;
}
}
Expand full source code Collapse full source code View on Trac
Changelog
| Version | Description |
|---|---|
| 1.0 | Introduced. |