liberty
[ class tree: liberty ] [ index: liberty ] [ all elements ]

Source for file data.video.php

Documentation is available at data.video.php

  1. <?php
  2. /**
  3.  * @version  $Revision$
  4.  * @package  liberty
  5.  * @subpackage plugins_data
  6.  */
  7.  
  8. /**
  9.  * definitions
  10.  */
  11.  
  12. global $gLibertySystem;
  13. define'PLUGIN_GUID_DATAVIDEO''datavideo' );
  14. $pluginParams array (
  15.     'tag'           => 'VIDEO',
  16.     'auto_activate' => FALSE,
  17.     'requires_pair' => FALSE,
  18.     'preload_function'    => 'data_video_preload',
  19.     'load_function' => 'data_video',
  20.     'title'         => 'Video',
  21.     'help_page'     => 'DataPluginVideo',
  22.     'description'   => tra"This plugin allows you to simply and safely insert a video in a page. Currently it only supports Flash Video (.flv) files." ),
  23.     'help_function' => 'data_video_help',
  24.     'syntax'        => "{video video= player=}",
  25.     'plugin_type'   => DATA_PLUGIN
  26. );
  27. $gLibertySystem->registerPluginPLUGIN_GUID_DATAVIDEO$pluginParams );
  28. $gLibertySystem->registerDataTag$pluginParams['tag']PLUGIN_GUID_DATAVIDEO );
  29.  
  30. /**
  31.  * data_video_help
  32.  * 
  33.  * @access public
  34.  * @return HTML help in a table
  35.  */
  36. function data_video_help({
  37.     return
  38.         '<table class="data help">'
  39.             .'<tr>'
  40.                 .'<th>' tra"Key" '</th>'
  41.                 .'<th>' tra"Type" '</th>'
  42.                 .'<th>' tra"Comments" '</th>'
  43.             .'</tr>'
  44.             .'<tr class="odd">'
  45.                 .'<td>video</td>'
  46.                 .'<td>' tra"string" '<br />' tra("(required)"'</td>'
  47.                 .'<td>' tra"URL of the video file. E.g. http://example.com/foo.flv" '</td>'
  48.             .'</tr>'
  49.             .'<tr class="even">'
  50.                 .'<td>player</td>'
  51.                 .'<td>' tra"sting" '<br />' tra"(optional)" '</td>'
  52.                 .'<td>' tra"URL of the player object. E.g. http://example.com/player.swf" '</td>'
  53.             .'</tr>'
  54.             .'<tr class="odd">'
  55.                 .'<td>height</td>'
  56.                 .'<td>' tra"numeric" '<br />' tra("(optional)"'</td>'
  57.                 .'<td>' tra"Alternate height of the video box in pixels." '</td>'
  58.             .'</tr>'
  59.             .'<tr class="even">'
  60.                 .'<td>width</td>'
  61.                 .'<td>' tra"numeric" '<br />' tra"(optional)" '</td>'
  62.                 .'<td>' tra"Alternate width of the video box in pixels." '</td>'
  63.             .'</tr>'
  64.         .'</table>'
  65.         . tra"Example: " '{video video=http://example.com/foo.flv player=http://example.com/player.swf width=425 height=355}';
  66. }
  67.  
  68. /**
  69.  * data_video_preload This function is loaded on every page load before anything happens and is used to load required scripts.
  70.  * 
  71.  * @access public
  72.  * @return TRUE on success, FALSE on failure - mErrors will contain reason for failure
  73.  */
  74. function data_video_preload({
  75.     global $gBitThemes;
  76.     $gBitThemes->loadJavascriptUTIL_PKG_PATH."javascript/flv_player/swfobject.js"FALSE25 );
  77. }
  78.  
  79. /**
  80.  * data_video
  81.  * 
  82.  * @param array $pData 
  83.  * @param array $pParams 
  84.  * @access public
  85.  * @return TRUE on success, FALSE on failure - mErrors will contain reason for failure
  86.  */
  87. function data_video$pData$pParams {
  88.     // static var in case multiple videos on one page
  89.     static $playerCount 1;
  90.     extract$pParams );
  91.     $width   !empty$width )  $width  "425" );
  92.     $height  !empty$height $height "355" );
  93.  
  94.     ifempty$player ) ) {
  95.         $player UTIL_PKG_URL.'javascript/flv_player/mediaplayer.swf';
  96.     }
  97.  
  98.     $playerId "flv_player_".$playerCount++;
  99.  
  100.     $ret '<div class="video-plugin">
  101. <p id="'.$playerId.'"><a href="http://www.macromedia.com/go/getflashplayer">Get the Flash Player</a> to see this video.</p>
  102. <script type="text/javascript"> var so = new SWFObject(\''.$player.'\',\'player\',\''.$width.'\',\''.$height.'\',\'7\');   so.addVariable("file","'.$video.'");so.addVariable("overstretch","fit"); so.addVariable("frontcolor","0xffffff"); so.addVariable("backcolor","0x193d55"); so.write(\''.$playerId.'\');</script>';
  103.  
  104.     return $ret;
  105. }
  106. ?>

Documentation generated on Wed, 29 Jul 2015 13:56:21 +0000 by phpDocumentor 1.5.0-lsces