PluginProbe
Gutenify – Visual Site Builder Blocks & Starter Templates / 1.0.2
Gutenify – Visual Site Builder Blocks & Starter Templates v1.0.2
1.9.0 1.8.0 1.7.0 1.6.6 1.6.5 1.6.4 trunk 0.0.1 0.0.2 0.0.3 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 All 74 releases
gutenify / src / blocks / count-down / index.php

index.php in Gutenify – Visual Site Builder Blocks & Starter Templates 1.0.2, at src/blocks/count-down/index.php

53 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 * Server-side rendering of the `gutenify/social` block.
4 *
5 * @package Gutenify
6 */
7
8 /**
9 * Map Block render
10 *
11 * @param array $attributes Map Attributes.
12 * @return string
13 */
14 function gutenify_render_count_down_block( $attributes ) {
15 $client_id = ! empty( $attributes['blockClientId'] ) ? $attributes['blockClientId'] : '';
16 $align = ! empty( $attributes['align'] ) ? $attributes['align'] : 'full';
17 $class = ! empty( $attributes['className'] ) ? $attributes['className'] : '';
18 $class = 'wp-block-gutenify-map align' . $align . ' ' . $class;
19 $location = ! empty( $attributes['location'] ) ? $attributes['location'] : '';
20 $language = ! empty( $attributes['language'] ) ? $attributes['language'] : 'en';
21 $zoom = ! empty( $attributes['zoom'] ) ? $attributes['zoom'] : 12;
22 $height = ! empty( $attributes['height'] ) ? $attributes['height'] : 400;
23
24 return '<div class="' . $class . '"><div id="gutenify-section-' . $client_id . '"><iframe title="Google Map" frameBorder="0" src="https://www.google.com/maps?q=' . $location . '&output=embed&hl=' . $language . '&z=' . $zoom . '" style="width:100%;min-height:' . $height . 'px"></iframe></div></div>';
25 }
26
27 /**
28 * Registers the block on server.
29 */
30 function gutenify_register_count_down_block() {
31 // Return early if this function does not exist.
32 if ( ! function_exists( 'register_block_type' ) ) {
33 return;
34 }
35
36 // Load attributes from block.json.
37 ob_start();
38 include GUTENIFY_PLUGIN_DIR . 'src/blocks/count-down/block.json';
39 $metadata = json_decode( ob_get_clean(), true );
40
41 register_block_type(
42 'gutenify/count-down',
43 array(
44 'editor_script' => 'gutenify-editor',
45 'editor_style' => 'gutenify-editor',
46 'style' => 'gutenify-frontend',
47 'attributes' => $metadata['attributes'],
48 'render_callback' => 'gutenify_render_count_down_block',
49 )
50 );
51 }
52 add_action( 'init', 'gutenify_register_count_down_block' );
53