* * * *
Ghinzu - Cold Love (Mirror Mirror)
Uploaded by GhinzuTV. - Watch more music videos, in HD! * * Code as of 01.01.11: *
Funny cats and babies!
Uploaded by GilLavie. - Find more funny videos. * movie param enforces anti-xss protection * * Scroll down for the new '; if ( array_key_exists( 'video', $atts ) && $video = preg_replace( '/[^-a-z0-9_]/i', '', $atts['video'] ) && array_key_exists( 'title', $atts ) && $title = wp_kses( $atts['title'], array() ) ) { $output .= '
' . esc_html( $title ) . ''; } if ( array_key_exists( 'user', $atts ) && $user = preg_replace( '/[^-a-z0-9_]/i', '', $atts['user'] ) ) { /* translators: %s is a Dailymotion user name */ $output .= '
' . wp_kses( sprintf( __( 'Uploaded by %s', 'jetpack' ), '' . esc_html( $user ) . '' ), array( 'a' => array( 'href' => true, 'target' => true ) ) ) . ''; } } return $output; } add_shortcode( 'dailymotion', 'dailymotion_shortcode' ); /** * DailyMotion Channel Shortcode * * Examples: * [dailymotion-channel user=MatthewDominick] * [dailymotion-channel user=MatthewDominick type=grid] (supports grid, carousel, badge/default) */ function dailymotion_channel_shortcode( $atts ) { $username = $atts['user']; switch( $atts['type'] ) { case 'grid': return ''; break; case 'carousel': return ''; break; default: return ''; } } add_shortcode( 'dailymotion-channel', 'dailymotion_channel_shortcode' ); /** * Embed Reversal for Badge/Channel */ function dailymotion_channel_reversal( $content ) { if ( ! is_string( $content ) || false === stripos( $content, 'dailymotion.com/badge/' ) ) { return $content; } /* Sample embed code: */ $regexes = array(); $regexes[] = '#]+?src=" (?:https?:)?//(?:www\.)?dailymotion\.com/badge/user/([^"\'/]++) "[^>]*+>#ix'; // Let's play nice with the visual editor too. $regexes[] = '#<iframe(?:[^&]|&(?!gt;))+?src=" (?:https?:)?//(?:www\.)?dailymotion\.com/badge/user/([^"\'/]++) "(?:[^&]|&(?!gt;))*+></iframe>#ix'; foreach ( $regexes as $regex ) { if ( ! preg_match_all( $regex, $content, $matches, PREG_SET_ORDER ) ) { continue; } foreach ( $matches as $match ) { $url_pieces = parse_url( $match[1] ); if ( 'type=carousel' === $url_pieces['query'] ) { $type = 'carousel'; } else if ( 'type=grid' === $url_pieces['query'] ) { $type = 'grid'; } else { $type = 'badge'; } $shortcode = '[dailymotion-channel user=' . esc_attr( $url_pieces['path'] ) . ' type=' . esc_attr( $type ) . ']'; $replace_regex = sprintf( '#\s*%s\s*#', preg_quote( $match[0], '#' ) ); $content = preg_replace( $replace_regex, sprintf( "\n\n%s\n\n", $shortcode ), $content ); } } return $content; } add_filter( 'pre_kses', 'dailymotion_channel_reversal' ); /** * Dailymotion Embed Reversal (with new iframe code as of 17.09.2014) * * Converts a generic HTML embed code from Dailymotion into an * oEmbeddable URL. */ function jetpack_dailymotion_embed_reversal( $content ) { if ( ! is_string( $content ) || false === stripos( $content, 'dailymotion.com/embed' ) ) { return $content; } /* Sample embed code as of Sep 17th 2014:
Dog with legs in casts learns how to enter the... by videobash */ $regexes = array(); // I'm Konstantin and I love regex. $regexes[] = '#]+?src=" (?:https?:)?//(?:www\.)?dailymotion\.com/embed/video/([^"\'/]++) "[^>]*+>\s*+\s*+(?:)?\s*+ (?: ]+?href=" (?:https?:)?//(?:www\.)?dailymotion\.com/[^"\']++ "[^>]*+>.+?\s*+ )? (?: .*?]+?href=" (?:https?:)?//(?:www\.)?dailymotion\.com/[^"\']++ "[^>]*+>.+?\s*+ )?#ix'; $regexes[] = '#<iframe(?:[^&]|&(?!gt;))+?src=" (?:https?:)?//(?:www\.)?dailymotion\.com/embed/video/([^"\'/]++) "(?:[^&]|&(?!gt;))*+>\s*+</iframe>\s*+(?:<br\s*+/>)?\s*+ (?: <a(?:[^&]|&(?!gt;))+?href=" (?:https?:)?//(?:www\.)?dailymotion\.com/[^"\']++ "(?:[^&]|&(?!gt;))*+>.+?</a>\s*+ )? (?: <i>.*?<a(?:[^&]|&(?!gt;))+?href=" (?:https?:)?//(?:www\.)?dailymotion\.com/[^"\']++ "(?:[^&]|&(?!gt;))*+>.+?</a>\s*+</i> )?#ix'; foreach ( $regexes as $regex ) { if ( ! preg_match_all( $regex, $content, $matches, PREG_SET_ORDER ) ) { continue; } foreach ( $matches as $match ) { $url = esc_url( sprintf( 'https://dailymotion.com/video/%s', $match[1] ) ); $replace_regex = sprintf( '#\s*%s\s*#', preg_quote( $match[0], '#' ) ); $content = preg_replace( $replace_regex, sprintf( "\n\n%s\n\n", $url ), $content ); /** This action is documented in modules/shortcodes/youtube.php */ do_action( 'jetpack_embed_to_shortcode', 'dailymotion', $url ); } } return $content; } add_filter( 'pre_kses', 'jetpack_dailymotion_embed_reversal' );