PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 6.9
Jetpack – WP Security, Backup, Speed, & Growth v6.9
16.2-beta 12.0.3 12.1.3 12.2.3 12.3.2 12.4.2 12.5.2 12.6.4 12.7.3 12.8.3 12.9.5 13.0.2 13.1.5 13.2.4 13.3.3 13.4.5 13.5.2 13.6.2 13.7.2 13.8.3 13.9.2 14.0.1 14.1.1 14.2.2 14.3.1 All 501 releases
jetpack / modules / blocks.php
blocks.php
80 lines 1.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Load code specific to Gutenberg blocks which are not tied to a module.
4 * This file is unusual, and is not an actual `module` as such.
5 * It is included in ./module-extras.php
6 *
7 */
8
9 jetpack_register_block(
10 'map',
11 array(
12 'render_callback' => 'jetpack_map_block_load_assets',
13 )
14 );
15
16 jetpack_register_block( 'vr' );
17
18 /**
19 * Tiled Gallery block. Depends on the Photon module.
20 *
21 * @since 6.9.0
22 */
23 if ( class_exists( 'Jetpack_Photon' ) && Jetpack::is_module_active( 'photon' ) ) {
24 jetpack_register_block(
25 'tiled-gallery',
26 array(
27 'render_callback' => 'jetpack_tiled_gallery_load_block_assets',
28 )
29 );
30
31 /**
32 * Tiled gallery block registration/dependency declaration.
33 *
34 * @param array $attr - Array containing the block attributes.
35 * @param string $content - String containing the block content.
36 *
37 * @return string
38 */
39 function jetpack_tiled_gallery_load_block_assets( $attr, $content ) {
40 $dependencies = array(
41 'lodash',
42 'wp-i18n',
43 'wp-token-list',
44 );
45 Jetpack_Gutenberg::load_assets_as_required( 'tiled-gallery', $dependencies );
46
47 /**
48 * Filter the output of the Tiled Galleries content.
49 *
50 * @module tiled-gallery
51 *
52 * @since 6.9.0
53 *
54 * @param string $content Tiled Gallery block content.
55 */
56 return apply_filters( 'jetpack_tiled_galleries_block_content', $content );
57 }
58 }
59
60 /**
61 * Map block registration/dependency declaration.
62 *
63 * @param array $attr - Array containing the map block attributes.
64 * @param string $content - String containing the map block content.
65 *
66 * @return string
67 */
68 function jetpack_map_block_load_assets( $attr, $content ) {
69 $dependencies = array(
70 'lodash',
71 'wp-element',
72 'wp-i18n',
73 );
74
75 $api_key = Jetpack_Options::get_option( 'mapbox_api_key' );
76
77 Jetpack_Gutenberg::load_assets_as_required( 'map', $dependencies );
78 return preg_replace( '/<div /', '<div data-api-key="'. esc_attr( $api_key ) .'" ', $content, 1 );
79 }
80