Conditions | 5 |
Paths | 12 |
Total Lines | 29 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
39 | function load_assets( $attr ) { |
||
40 | $height = isset( $attr['height'] ) ? $attr['height'] : '600'; |
||
41 | $url = isset( $attr['url'] ) |
||
42 | ? Jetpack_Gutenberg::validate_block_embed_url( $attr['url'], array( 'calendar.google.com' ) ) : |
||
43 | ''; |
||
44 | $classes = Blocks::classes( FEATURE_NAME, $attr ); |
||
45 | |||
46 | Jetpack_Gutenberg::load_assets_as_required( FEATURE_NAME ); |
||
47 | |||
48 | if ( empty( $url ) ) { |
||
49 | return; |
||
50 | } |
||
51 | |||
52 | if ( Blocks::is_amp_request() ) { |
||
53 | return sprintf( |
||
54 | '<div class="%1$s"><amp-iframe src="%2$s" frameborder="0" style="border:0" scrolling="no" height="%3$d" sandbox="allow-scripts allow-same-origin" layout="responsive"></amp-iframe></div>', |
||
55 | esc_attr( $classes ), |
||
56 | esc_url( $url ), |
||
57 | absint( $height ) |
||
58 | ); |
||
59 | } else { |
||
60 | return sprintf( |
||
61 | '<div class="%1$s"><iframe src="%2$s" frameborder="0" style="border:0" scrolling="no" height="%3$d"></iframe></div>', |
||
62 | esc_attr( $classes ), |
||
63 | esc_url( $url ), |
||
64 | absint( $height ) |
||
65 | ); |
||
66 | } |
||
67 | } |
||
68 |