ustreamsocial_shortcode

Parse shortcode arguments and render output for ustream's Social Stream.

Description

(string) ustreamsocial_shortcode( $atts ); 

Returns (string)

HTML output.

Parameters (1)

0. $atts
Array of user-supplied arguments.

Usage

  1. if ( !function_exists( 'ustreamsocial_shortcode' ) ) { 
  2. require_once '/modules/shortcodes/ustream.php'; 
  3.  
  4. // array of user-supplied arguments. 
  5. $atts = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = ustreamsocial_shortcode($atts); 
  9.  

Defined (1)

The function is defined in the following location(s).

/modules/shortcodes/ustream.php  
  1. function ustreamsocial_shortcode( $atts ) { 
  2. $defaults = array( 
  3. 'id' => 0,  
  4. 'height' => 420,  
  5. 'width' => 320,  
  6. ); 
  7.  
  8. $atts = array_map( 'intval', shortcode_atts( $defaults, $atts ) ); 
  9.  
  10. $ustream_id = $atts['id']; 
  11. $width = $atts['width']; 
  12. $height = $atts['height']; 
  13.  
  14. if ( 0 >= $ustream_id ) { 
  15. return '<!-- ustreamsocial error: bad social stream ID -->'; 
  16.  
  17. if ( 0 >= $height ) { 
  18. return '<!-- ustreamsocial error: height invalid -->'; 
  19.  
  20. if ( 0 >= $width ) { 
  21. return '<!-- ustreamsocial error: width invalid -->'; 
  22.  
  23. $url = set_url_scheme( "http://www.ustream.tv/socialstream/$ustream_id" ); 
  24.  
  25. return '<iframe id="SocialStream" class="" name="SocialStream" width="' . esc_attr( $width ) . '" height="' . esc_attr( $height ) . '" scrolling="no" allowtransparency="true" src="' . esc_url( $url ) . '" style="visibility: visible; margin-top: 0; margin-bottom: 0; border: 0;"></iframe>';