Conditions | 8 |
Paths | 48 |
Total Lines | 24 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
40 | function jetpack_google_calendar_block_load_assets( $attr ) { |
||
41 | $width = isset( $attr['width'] ) ? $attr['width'] : '800'; |
||
42 | $height = isset( $attr['height'] ) ? $attr['height'] : '600'; |
||
43 | $url = isset( $attr['url'] ) ? $attr['url'] : ''; |
||
44 | $align = isset( $attr['align'] ) ? 'align' . $attr['align'] : ''; |
||
45 | |||
46 | if ( empty( $url ) ) { |
||
47 | return; |
||
48 | } |
||
49 | |||
50 | if ( class_exists( 'Jetpack_AMP_Support' ) && Jetpack_AMP_Support::is_amp_request() ) { |
||
51 | return <<<EOT |
||
52 | <div class="wp-block-jetpack-google-calendar ${align}"> |
||
53 | <amp-iframe src="${url}" frameborder="0" style="border:0" scrolling="no" width="${width}" height="${height}" sandbox="allow-scripts allow-same-origin" layout="responsive"></amp-iframe> |
||
54 | </div> |
||
55 | EOT; |
||
56 | } else { |
||
57 | return <<<EOT |
||
58 | <div class="wp-block-jetpack-google-calendar ${align}"> |
||
59 | <iframe src="${url}" frameborder="0" style="border:0" scrolling="no" width="${width}" height="${height}"></iframe> |
||
60 | </div> |
||
61 | EOT; |
||
62 | } |
||
63 | } |
||
64 |