PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 16.3
Jetpack – WP Security, Backup, Speed, & Growth v16.3
16.3 16.3-beta 16.3-a.5 16.3-a.7 16.3-a.3 16.3-a.1 16.2 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 All 508 releases
← All changes | extensions/blocks/podcast-player/podcast-player.php +67 -0 16.2-beta → 16.3 View file →
@@ -1,0 +1,67 @@
1 +<?php
2 +/**
3 + * Podcast Player Block.
4 + *
5 + * @since 8.4.0
6 + *
7 + * @package automattic/jetpack
8 + */
9 +
10 +namespace Automattic\Jetpack\Extensions\Podcast_Player;
11 +
12 +use Automattic\Jetpack\Blocks;
13 +
14 +if ( ! defined( 'ABSPATH' ) ) {
15 + exit( 0 );
16 +}
17 +
18 +/**
19 + * Registers the block for use in Gutenberg. This is done via an action so that
20 + * we can disable registration if we need to.
21 + */
22 +function register_block() {
23 + Blocks::jetpack_register_block(
24 + __DIR__,
25 + array(
26 + 'render_callback' => __NAMESPACE__ . '\render_block',
27 + // Since Gutenberg #31873.
28 + 'style' => 'wp-mediaelement',
29 + 'render_email_callback' => __NAMESPACE__ . '\render_email',
30 + )
31 + );
32 +}
33 +add_action( 'init', __NAMESPACE__ . '\register_block' );
34 +
35 +/**
36 + * Podcast Player block registration/dependency declaration.
37 + *
38 + * The render implementation lives in render.php and is only loaded when the
39 + * block is actually rendered, keeping it out of the eager front-end path.
40 + *
41 + * @param array $attributes Array containing the Podcast Player block attributes.
42 + * @param string $content Fallback content - a direct link to RSS, as rendered by save.js.
43 + * @return string
44 + */
45 +function render_block( $attributes, $content ) {
46 + require_once __DIR__ . '/render.php';
47 + return render_block_implementation( $attributes, $content );
48 +}
49 +
50 +/**
51 + * Render podcast player block for email.
52 + *
53 + * The render implementation lives in render.php and is only loaded when the
54 + * block is actually rendered, keeping it out of the eager front-end path.
55 + *
56 + * @since 15.0
57 + *
58 + * @param string $block_content The original block HTML content.
59 + * @param array $parsed_block The parsed block data including attributes.
60 + * @param object $rendering_context Email rendering context.
61 + *
62 + * @return string
63 + */
64 +function render_email( $block_content, array $parsed_block, $rendering_context ) {
65 + require_once __DIR__ . '/render.php';
66 + return render_email_implementation( $block_content, $parsed_block, $rendering_context );
67 +}