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.

Astra_Minify::render_css()

Compiles the cached CSS file.


Description


Return

(void|false) Checks early if cache directory was emptied before generating the new files


Source

File: classes/class-astra-minify.php

		private static function render_css() {

			self::load_filesystem();

			if ( ! defined( 'FS_CHMOD_FILE' ) ) {
				define( 'FS_CHMOD_FILE', ( fileperms( ABSPATH . 'index.php' ) & 0777 | 0644 ) );
			}

			if ( get_option( 'ast-theme-css-status' ) ) {
				$assets_status = self::clear_assets_cache();

				if ( false == $assets_status ) {
					return false;
				}
			}

			$cache_dir   = self::get_cache_dir();
			$new_css_key = str_replace( '.', '-', uniqid( '', true ) );
			$css_slug    = self::_asset_slug();
			$css_files   = self::get_css_files();
			$css         = '';
			$css_min     = '';
			$filepath    = $cache_dir['path'] . $css_slug . '-' . $new_css_key . '.css';

			if ( count( $css_files ) > 0 ) {

				foreach ( $css_files as $k => $file ) {

					if ( ! empty( $file ) && file_exists( $file ) ) {
						$css .= self::$astra_addon_filesystem->get_contents(
							$file,
							FS_CHMOD_FILE
						);
					}
				}
			}

			$css = apply_filters( 'astra_render_css', $css );

			$status = self::$astra_addon_filesystem->put_contents(
				$filepath,
				$css,
				FS_CHMOD_FILE
			);

			$status = ! $status;

			// Save the new css key.
			update_option( 'ast-theme-css-status', $status );
			update_option( self::$_css_key . '-' . $css_slug, $new_css_key );
		}

Changelog

Changelog
Version Description
1.0 Introduced.

User Contributed Notes

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