<?php /** * PWA Plugin compatibility. * * @package Neve\Compatibility */ namespace Neve\Compatibility; /** * Class PWA */ class PWA { /** * Init function. * * @return bool */ public function init() { if ( ! $this->should_load() ) { return false; } $this->load_hooks(); return true; } /** * Decide if class should run. */ private function should_load() { return defined( 'PWA_VERSION' ) && function_exists( 'wp_service_worker_error_details_template' ) && function_exists( 'pwa_get_header' ) && function_exists( 'wp_service_worker_error_message_placeholder' ) && function_exists( 'pwa_get_footer' ); } /** * Load hooks. */ private function load_hooks() { add_action( 'neve_do_offline', array( $this, 'offline_default_template' ) ); add_action( 'neve_do_server_error', array( $this, 'server_error_default_template' ) ); } /** * Load offline default template. */ public function offline_default_template() { ?> <main> <h1><?php esc_html_e( 'Oops! It looks like you’re offline.', 'neve' ); ?></h1> <?php wp_service_worker_error_message_placeholder(); ?> </main> <?php } /** * Load server error template. */ public function server_error_default_template() { ?> <main> <h1><?php esc_html_e( 'Oops! Something went wrong.', 'neve' ); ?></h1> <?php wp_service_worker_error_message_placeholder(); ?> <?php wp_service_worker_error_details_template(); ?> </main> <?php } }
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
block-patterns | Folder | 0755 |
|
|
starter-content | Folder | 0755 |
|
|
amp.php | File | 11.03 KB | 0644 |
|
beaver.php | File | 4.77 KB | 0644 |
|
easy_digital_downloads.php | File | 2.24 KB | 0644 |
|
elementor.php | File | 16.21 KB | 0644 |
|
fse.php | File | 14.44 KB | 0644 |
|
generic.php | File | 1.85 KB | 0644 |
|
header_footer_beaver.php | File | 1.6 KB | 0644 |
|
header_footer_elementor.php | File | 1.26 KB | 0644 |
|
lifter.php | File | 8.72 KB | 0644 |
|
page_builder_base.php | File | 1.51 KB | 0644 |
|
patterns.php | File | 1.08 KB | 0644 |
|
ppom.php | File | 797 B | 0644 |
|
pwa.php | File | 1.43 KB | 0644 |
|
starter_content.php | File | 5.19 KB | 0644 |
|
web_stories.php | File | 1 KB | 0644 |
|
woocommerce.php | File | 29.88 KB | 0644 |
|
wpml.php | File | 1.61 KB | 0644 |
|