Astra_Theme_Extension::astra_refresh_assets_files()

Include the refresh button to delete and regenerate new assets files.


Description


Source

File: classes/class-astra-theme-extension.php

		public function astra_refresh_assets_files() {

			if ( ! function_exists( 'astra_addon_filesystem' ) ) {
				return;
			}

			$allow_file_generation = get_option( '_astra_file_generation', 'disable' );

			$file_generation_message  = esc_html__( 'Enable this option to generate CSS files.', 'astra-addon' );
			$file_generation_doc_link = esc_url( 'https://wpastra.com/astra-2-1/?utm_source=astra-pro-dashboard&utm_medium=astra-menu-page&utm_campaign=astra-pro-plugin' );

			if ( astra_addon_filesystem()->can_access_filesystem() ) {
				$refresh_assets_button_text = esc_html__( 'Refresh', 'astra-addon' );
				$refresh_assets_message     = esc_html__( 'Click on the \'Refresh\' button to regenerate CSS files.', 'astra-addon' );
				$refresh_assets_doc_link    = esc_url( '#' );
			} else {
				$refresh_assets_button_text = esc_html__( 'Recheck', 'astra-addon' );
				$refresh_assets_message     = esc_html__( 'Click on the \'Recheck\' button to check if the uploads folder has write access.', 'astra-addon' );
				$refresh_assets_doc_link    = esc_url( '#' );
			}
			?>

			<div class="postbox">
				<h2 class="hndle ast-normal-cusror">
					<span class="dashicons dashicons-admin-page"></span>
					<span>
						<?php esc_html_e( 'CSS File Generation', 'astra-addon' ); ?>
					</span>
				</h2>
				<div class="inside">
					<p class="warning">
					</p>
						<?php echo esc_html( $file_generation_message ); ?>
					<p>
					<?php
					if ( Astra_Ext_White_Label_Markup::show_branding() ) {

						$a_tag_open  = '<a target="_blank" rel="noopener" href="' . $file_generation_doc_link . '">';
						$a_tag_close = '</a>';

						printf(
							/* translators: %1$s: a tag open. */
							__( 'Please read %1$s this article %2$s to know more.', 'astra-addon' ), // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
							$a_tag_open, // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
							$a_tag_close // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
						);
					}
					?>
					</p>
					<label for="astra_file_generation">
						<?php

						if ( 'disable' === $allow_file_generation ) {
							$file_generation_string = __( 'Enable File Generation', 'astra-addon' );
						} else {
							$file_generation_string = __( 'Disable File Generation', 'astra-addon' );
						}
						?>
						<button class="button astra-beta-updates" id="astra_file_generation" data-value="<?php echo esc_attr( $allow_file_generation ); ?>">
							<?php echo esc_html( $file_generation_string ); ?>
						</button>
					</label>
						<div class="astra-refresh-assets-wrapper" style="<?php echo ( 'disable' === $allow_file_generation ) ? 'display: none' : 'display: block'; ?>">
							<p class="warning">
								<?php echo esc_html( $refresh_assets_message ); ?>
							</p>

							<label for="astra_refresh_assets">
								<button class="button astra-refresh-assets" id="astra_refresh_assets">
									<span class="ast-loader"></span>
									<span class="ast-refresh-btn-text"><?php echo esc_html( $refresh_assets_button_text ); ?></span>
								</button>
							</label>
						</div>
				</div>
			</div>
			<?php
		}

Changelog

Changelog
Version Description
1.2.4 Introduced.

User Contributed Notes

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