| Conditions | 7 |
| Paths | 24 |
| Total Lines | 28 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 37 | function load_assets( $attr ) { |
||
| 38 | $width = isset( $attr['width'] ) ? $attr['width'] : '800'; |
||
| 39 | $height = isset( $attr['height'] ) ? $attr['height'] : '600'; |
||
| 40 | $url = isset( $attr['url'] ) ? $attr['url'] : ''; |
||
| 41 | $classes = \Jetpack_Gutenberg::block_classes( 'google-calendar', $attr ); |
||
| 42 | |||
| 43 | if ( empty( $url ) ) { |
||
| 44 | return; |
||
| 45 | } |
||
| 46 | |||
| 47 | if ( class_exists( 'Jetpack_AMP_Support' ) && \Jetpack_AMP_Support::is_amp_request() ) { |
||
| 48 | return sprintf( |
||
| 49 | '<div class="%1$s"><amp-iframe src="%2$s" frameborder="0" style="border:0" scrolling="no" width="%3$d" height="%4$d" sandbox="allow-scripts allow-same-origin" layout="responsive"></amp-iframe></div>', |
||
| 50 | esc_attr( $classes ), |
||
| 51 | esc_url( $url ), |
||
| 52 | absint( $width ), |
||
| 53 | absint( $height ) |
||
| 54 | ); |
||
| 55 | } else { |
||
| 56 | return sprintf( |
||
| 57 | '<div class="%1$s"><iframe src="%2$s" frameborder="0" style="border:0" scrolling="no" width="%3$d" height="%4$d"></iframe></div>', |
||
| 58 | esc_attr( $classes ), |
||
| 59 | esc_url( $url ), |
||
| 60 | absint( $width ), |
||
| 61 | absint( $height ) |
||
| 62 | ); |
||
| 63 | } |
||
| 64 | } |
||
| 65 |