Conditions | 5 |
Paths | 5 |
Total Lines | 19 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
12 | function pinterest_embed_handler( $matches, $attr, $url ) { |
||
13 | // Pinterest's JS handles making the embed |
||
14 | wp_enqueue_script( 'pinterest-embed', '//assets.pinterest.com/js/pinit.js', array(), false, true ); |
||
15 | |||
16 | $path = parse_url( $url, PHP_URL_PATH ); |
||
17 | if ( 0 === strpos( $path, '/pin/' ) ) { |
||
18 | $embed_type = 'embedPin'; |
||
19 | } elseif ( preg_match( '#^/([^/]+)/?$#', $path ) ) { |
||
20 | $embed_type = 'embedUser'; |
||
21 | } elseif ( preg_match( '#^/([^/]+)/([^/]+)/?$#', $path ) ) { |
||
22 | $embed_type = 'embedBoard'; |
||
23 | } else { |
||
24 | if ( current_user_can( 'edit_posts' ) ) |
||
25 | return __( 'Sorry, that Pinterest URL was not recognized.', 'jetpack' ); |
||
26 | return; |
||
27 | } |
||
28 | |||
29 | return sprintf( '<a data-pin-do="%s" href="%s"></a>', esc_attr( $embed_type ), esc_url( $url ) ); |
||
30 | } |
||
31 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.