PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 7.1
Jetpack – WP Security, Backup, Speed, & Growth v7.1
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
← All changes | modules/blocks.php +2 -147 7.0.57.1 View file →
@@ -1,151 +1,6 @@
1 1 <?php
2 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 -jetpack_register_block(
9 - 'gif',
10 - array(
11 - 'render_callback' => 'jetpack_gif_block_render',
12 - )
13 -);
14 -
15 -jetpack_register_block(
16 - 'map',
17 - array(
18 - 'render_callback' => 'jetpack_map_block_load_assets',
19 - )
20 -);
21 -
22 -jetpack_register_block( 'vr' );
23 -
24 -/**
25 - * Tiled Gallery block. Depends on the Photon module.
3 + * Deprecated. No longer needed.
26 4 *
27 - * @since 6.9.0
28 -*/
29 -if (
30 - ( defined( 'IS_WPCOM' ) && IS_WPCOM ) ||
31 - class_exists( 'Jetpack_Photon' ) && Jetpack::is_module_active( 'photon' )
32 -) {
33 - jetpack_register_block(
34 - 'tiled-gallery',
35 - array(
36 - 'render_callback' => 'jetpack_tiled_gallery_load_block_assets',
37 - )
38 - );
39 -
40 - /**
41 - * Tiled gallery block registration/dependency declaration.
42 - *
43 - * @param array $attr - Array containing the block attributes.
44 - * @param string $content - String containing the block content.
45 - *
46 - * @return string
47 - */
48 - function jetpack_tiled_gallery_load_block_assets( $attr, $content ) {
49 - $dependencies = array(
50 - 'lodash',
51 - 'wp-i18n',
52 - 'wp-token-list',
53 - );
54 - Jetpack_Gutenberg::load_assets_as_required( 'tiled-gallery', $dependencies );
55 -
56 - /**
57 - * Filter the output of the Tiled Galleries content.
58 - *
59 - * @module tiled-gallery
60 - *
61 - * @since 6.9.0
62 - *
63 - * @param string $content Tiled Gallery block content.
64 - */
65 - return apply_filters( 'jetpack_tiled_galleries_block_content', $content );
66 - }
67 -}
68 -
69 -/**
70 - * Gif block registration/dependency declaration.
71 - *
72 - * @param array $attr - Array containing the map block attributes.
73 - *
74 - * @return string
5 + * @package Jetpack
75 6 */
76 -function jetpack_gif_block_render( $attr ) {
77 - $align = isset( $attr['align'] ) ? $attr['align'] : 'center';
78 - $padding_top = isset( $attr['paddingTop'] ) ? $attr['paddingTop'] : 0;
79 - $style = 'padding-top:' . $padding_top;
80 - $giphy_url = isset( $attr['giphyUrl'] ) ? $attr['giphyUrl'] : null;
81 - $search_text = isset( $attr['searchText'] ) ? $attr['searchText'] : '';
82 - $caption = isset( $attr['caption'] ) ? $attr['caption'] : null;
83 -
84 - if ( ! $giphy_url ) {
85 - return null;
86 - }
87 -
88 - $classes = array(
89 - 'wp-block-jetpack-gif',
90 - 'align' . $align,
91 - );
92 - if ( isset( $attr['className'] ) ) {
93 - array_push( $classes, $attr['className'] );
94 - }
95 -
96 - ob_start();
97 - ?>
98 - <div class="<?php echo esc_attr( implode( $classes, ' ' ) ); ?>">
99 - <figure>
100 - <div class="wp-block-jetpack-gif-wrapper" style="<?php echo esc_attr( $style ); ?>">
101 - <iframe src="<?php echo esc_url( $giphy_url ); ?>" title="<?php echo esc_attr( $search_text ); ?>"></iframe>
102 - </div>
103 - <?php if ( $caption ) : ?>
104 - <figcaption class="wp-block-jetpack-gif-caption gallery-caption"><?php echo wp_kses_post( $caption ); ?></figcaption>
105 - <?php endif; ?>
106 - </figure>
107 - </div>
108 - <?php
109 - $html = ob_get_clean();
110 -
111 - Jetpack_Gutenberg::load_assets_as_required( 'gif' );
112 - return $html;
113 -}
114 -
115 -/**
116 - * Map block registration/dependency declaration.
117 - *
118 - * @param array $attr - Array containing the map block attributes.
119 - * @param string $content - String containing the map block content.
120 - *
121 - * @return string
122 - */
123 -function jetpack_map_block_load_assets( $attr, $content ) {
124 - $dependencies = array(
125 - 'lodash',
126 - 'wp-element',
127 - 'wp-i18n',
128 - );
129 -
130 - $api_key = Jetpack_Options::get_option( 'mapbox_api_key' );
131 -
132 - Jetpack_Gutenberg::load_assets_as_required( 'map', $dependencies );
133 - return preg_replace( '/<div /', '<div data-api-key="'. esc_attr( $api_key ) .'" ', $content, 1 );
134 -}
135 -
136 -/**
137 - * Register the Contact Info block and its child blocks.
138 - */
139 -jetpack_register_block( 'contact-info' );
140 -jetpack_register_block(
141 - 'email',
142 - array( 'parent' => array( 'jetpack/contact-info' ) )
143 -);
144 -jetpack_register_block(
145 - 'address',
146 - array( 'parent' => array( 'jetpack/contact-info' ) )
147 -);
148 -jetpack_register_block(
149 - 'phone',
150 - array( 'parent' => array( 'jetpack/contact-info' ) )
151 -);