[ Index ]
 

Code source de b2evolution 2.1.0-beta

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/blogs/plugins/videoplug_plugin/ -> _videoplug.plugin.php (source)

   1  <?php
   2  /**

   3   * This file implements the Video Plug plugin for b2evolution

   4   *

   5   * b2evolution - {@link http://b2evolution.net/}

   6   * Released under GNU GPL License - {@link http://b2evolution.net/about/license.html}

   7   * @copyright (c)2003-2007 by Francois PLANQUE - {@link http://fplanque.net/}

   8   *

   9   * @package plugins

  10   */
  11  if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' );
  12  
  13  /**

  14   * Replaces Video Plug markup in HTML (not XML).

  15   *

  16   * @package plugins

  17   */
  18  class videoplug_plugin extends Plugin
  19  {
  20      var $code = 'evo_videoplug';
  21      var $name = 'Video Plug';
  22      var $priority = 65;
  23      var $apply_rendering = 'opt-out';
  24      var $group = 'rendering';
  25      var $short_desc;
  26      var $long_desc;
  27      var $version = '2.0';
  28      var $number_of_installs = 1;
  29  
  30  
  31      /**

  32       * Init

  33       */
  34  	function PluginInit( & $params )
  35      {
  36          $this->short_desc = T_('Video plug for a few popular video sites.');
  37          $this->long_desc = T_('This is a basic video plug pluigin. Use it by entering [video:youtube:123xyz] or [video:dailymotion:123xyz] into your post, where 123xyz is the ID of the video.');
  38      }
  39  
  40  
  41      /**

  42       * Perform rendering

  43       *

  44       * @todo add more video sites, anyone...

  45       *

  46       * @see Plugin::RenderItemAsHtml()

  47       */
  48  	function RenderItemAsHtml( & $params )
  49      {
  50          $content = & $params['data'];
  51  
  52          // Youtube:

  53          $content = preg_replace( '¤\[video:youtube:(.+?)]¤', '<div class="videoblock"><object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/\\1"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/\\1" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object></div>', $content );
  54  
  55          // Dailymotion:

  56          $content = preg_replace( '¤\[video:dailymotion:(.+?)]¤', '<div class="videoblock"><object width="425" height="335"><param name="movie" value="http://www.dailymotion.com/swf/\\1"></param><param name="allowfullscreen" value="true"></param><embed src="http://www.dailymotion.com/swf/\\1" type="application/x-shockwave-flash" width="425" height="335" allowfullscreen="true"></embed></object></div>', $content );
  57  
  58          // Google video:

  59          $content = preg_replace( '¤\[video:google:(.+?)]¤', '<div class="videoblock"><embed style="width:400px; height:326px;" id="VideoPlayback" type="application/x-shockwave-flash" src="http://video.google.com/googleplayer.swf?docId=\\1&hl=en" flashvars=""></embed></div>', $content );
  60  
  61          // LiveVideo

  62          $content = preg_replace( '¤\[video:livevideo:(.+?)]¤', '<div class="videoblock"><object width="425" height="350"><param name="movie" value="http://www.livevideo.com/flvplayer/embed/\\1"></param><param name="wmode" value="transparent"></param><embed src="http://www.livevideo.com/flvplayer/embed/\\1" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object></div>', $content );
  63  
  64          // iFilm

  65          $content = preg_replace( '¤\[video:ifilm:(.+?)]¤', '<div class="videoblock"><embed width="425" height="350" src="http://www.ifilm.com/efp" quality="high" bgcolor="000000" name="efp" align="middle" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="flvbaseclip=\\1"> </embed></div>', $content );
  66  
  67          return true;
  68      }
  69  
  70  
  71  
  72      /**

  73       * Perform rendering for XML feeds

  74       *

  75       * @see Plugin::RenderItemAsXml()

  76       */
  77  	function RenderItemAsXml( & $params )
  78      {
  79          $this->RenderItemAsHtml( $params );
  80  
  81          /*

  82          $content = & $params['data'];

  83          $Item = & $params['Item'];

  84  

  85          $content = preg_replace( '¤\[video:.+?]¤', '<p>'.$Item->get_permanent_link( T_('See video').' &raquo;' ).'</p>', $content );

  86          */
  87  
  88          return true;
  89      }
  90  
  91      /**

  92       * Display a toolbar in admin

  93       * dh>> Do the service names, e.g. "YouTube" have to be marked for i18n?

  94       * fp> nope

  95       *

  96       * @param array Associative array of parameters

  97       * @return boolean did we display a toolbar?

  98       */
  99  	function AdminDisplayToolbar( & $params )
 100      {
 101          if( $params['edit_layout'] == 'simple' )
 102          {    // This is too complex for simple mode, don't display it:
 103              return false;
 104          }
 105  
 106          echo '<div class="edit_toolbar">';
 107          echo T_('Video').': ';
 108          echo '<input type="button" id="video_youtube" title="'.T_('Insert Youtube video').'" class="quicktags" onclick="videotag(\'youtube\');" value="'.T_('YouTube').'" />';
 109          echo '<input type="button" id="video_google" title="'.T_('Insert Google video').'" class="quicktags" onclick="videotag(\'google\');" value="'.T_('Google video').'" />';
 110          echo '<input type="button" id="video_dailymotion" title="'.T_('Insert DailyMotion video').'" class="quicktags" onclick="videotag(\'dailymotion\');" value="'.T_('DailyMotion').'" />';
 111          echo '<input type="button" id="video_livevideo" title="'.T_('Insert LiveVideo video').'" class="quicktags" onclick="videotag(\'livevideo\');" value="'.T_('LiveVideo').'" />';
 112          echo '<input type="button" id="video_ifilm" title="'.T_('Insert iFilm video').'" class="quicktags" onclick="videotag(\'ifilm\');" value="'.T_('iFilm').'" />';
 113  
 114          echo '</div>';
 115  
 116          ?>
 117          <script type="text/javascript">
 118              //<![CDATA[

 119  			function videotag( tag )
 120              {
 121                  var p = '<?php echo TS_('Enter video ID from %s:') ?>';
 122                  var video_ID = prompt( p.replace( /%s/, tag ), '' );
 123                  if( ! video_ID )
 124                  {
 125                      return;
 126                  }
 127  
 128                  tag = '[video:'+tag+':'+video_ID+']';
 129  
 130                  textarea_wrap_selection( b2evoCanvas, tag, '', 1 );
 131              }
 132              //]]>

 133          </script>
 134          <?php
 135  
 136          return true;
 137      }
 138  
 139  }
 140  
 141  
 142  /*

 143   * $Log: _videoplug.plugin.php,v $

 144   * Revision 1.9  2007/09/16 22:16:46  fplanque

 145   * minor

 146   *

 147   * Revision 1.8  2007/09/16 03:04:21  blueyed

 148   * fixed doc. added question about using i18n for service names

 149   *

 150   * Revision 1.7  2007/09/11 20:57:51  fplanque

 151   * minor fixes

 152   *

 153   * Revision 1.6  2007/07/07 22:21:34  fplanque

 154   * doc

 155   *

 156   * Revision 1.5  2007/05/15 21:22:16  blueyed

 157   * Use+replace %s for dynamic value instead of appending some string!

 158   *

 159   * Revision 1.4  2007/05/04 20:43:09  fplanque

 160   * MFB

 161   *

 162   * Revision 1.1.2.5  2007/04/25 22:18:09  fplanque

 163   * (c) 2007

 164   *

 165   * Revision 1.1.2.4  2007/04/24 11:45:13  yabs

 166   * added a couple more video sources

 167   *

 168   * Revision 1.1.2.3  2007/04/20 01:44:24  fplanque

 169   * added toolbar

 170   *

 171   * Revision 1.1.2.2  2007/04/19 01:14:43  fplanque

 172   * minor

 173   *

 174   * Revision 1.1.2.1  2007/04/19 01:03:54  fplanque

 175   * basic videoplug plugin

 176   *

 177   */
 178  ?>


Généré le : Thu Nov 29 23:58:50 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics