PluginProbe
Gutenberg / 12.1.0
Gutenberg v12.1.0
23.9.1 23.9.0 23.8.0 23.7.2 23.7.1 23.7.0 23.6.1 23.6.2 23.6.0 23.5.3 23.5.2 23.5.1 23.5.0 23.4.0 23.3.2 23.3.1 23.3.0 23.2.0 23.2.1 23.2.2 23.1.1 23.1.0 23.0.1 12.6.0 7.4.0 All 402 releases
gutenberg / lib / pwa.php

pwa.php in Gutenberg 12.1.0, at lib/pwa.php

35 lines 757 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Progressive Web App
4 *
5 * @package gutenberg
6 */
7
8 add_filter(
9 'admin_head',
10 function() {
11 $l10n = array(
12 'logo' => file_get_contents( ABSPATH . 'wp-admin/images/wordpress-logo-white.svg' ),
13 'siteTitle' => get_bloginfo( 'name' ),
14 'adminUrl' => admin_url(),
15 );
16 wp_enqueue_script( 'wp-admin-manifest' );
17 wp_localize_script( 'wp-admin-manifest', 'wpAdminManifestL10n', $l10n );
18 }
19 );
20
21 add_filter(
22 'load-index.php',
23 function() {
24 if ( ! isset( $_GET['service-worker'] ) ) {
25 return;
26 }
27
28 header( 'Content-Type: text/javascript' );
29 // Must be at the admin root so the scope is correct. Move to the
30 // wp-admin folder when merging with core.
31 echo file_get_contents( __DIR__ . '/service-worker.js' );
32 exit;
33 }
34 );
35