Advertisement
SergeyBiryukov

oEmbed support for kiwi.kz

Jul 9th, 2011
551
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.98 KB | None | 0 0
  1. function wp_embed_handler_kiwikz( $matches, $attr, $url, $rawattr ) {
  2.     if ( !empty($rawattr['width']) && !empty($rawattr['height']) ) {
  3.         $width  = (int) $rawattr['width'];
  4.         $height = (int) $rawattr['height'];
  5.     } else {
  6.         list( $width, $height ) = wp_expand_dimensions( 640, 385, $attr['width'], $attr['height'] );
  7.     }
  8.  
  9.     $embed = sprintf(
  10.         '<object width="%1$s" height="%2$s">
  11.            <param name="movie" value="http://v.kiwi.kz/v/%3$s/"></param>
  12.            <param name="allowFullScreen" value="true"></param>
  13.            <param name="allowScriptAccess" value="always"></param>
  14.            <embed src="http://v.kiwi.kz/v/%3$s/" type="application/x-shockwave-flash" width="640" height="385" allowFullScreen="true" allowScriptAccess="always"></embed>
  15.        </object>',
  16.         $width, $height, esc_attr($matches[1])
  17.     );
  18.  
  19.     return $embed;
  20. }
  21. wp_embed_register_handler( 'kiwikz', '#http://kiwi\.kz/watch/(.+?)/#i', 'wp_embed_handler_kiwikz' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement