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

Source for file mime.flash.php

Documentation is available at mime.flash.php

  1. <?php
  2. /**
  3.  * @version        $Header$
  4.  *
  5.  * @author        xing  <xing@synapse.plus.com>
  6.  * @version        $Revision$
  7.  *  created        Sunday Jul 02, 2006   14:42:13 CEST
  8.  * @package        liberty
  9.  * @subpackage    liberty_mime_handler
  10.  ***/
  11.  
  12. /**
  13.  * setup
  14.  */
  15. global $gLibertySystem;
  16.  
  17. /**
  18.  *  This is the name of the plugin - max char length is 16
  19.  * As a naming convention, the liberty mime handler definition should start with:
  20.  * PLUGIN_MIME_GUID_
  21.  */
  22. define'PLUGIN_MIME_GUID_FLASH''mimeflash' );
  23.  
  24. $pluginParams array(
  25.     // simply refer to the default functions - we only want to use a custom view_tpl here
  26.     'verify_function'    => 'mime_default_verify',
  27.     'store_function'     => 'mime_flash_store',
  28.     'update_function'    => 'mime_flash_update',
  29.     'load_function'      => 'mime_default_load',
  30.     'download_function'  => 'mime_default_download',
  31.     'expunge_function'   => 'mime_default_expunge',
  32.     // Brief description of what the plugin does
  33.     'title'              => 'Macromedia Flash',
  34.     'description'        => 'Allow upload and viewing of flash files.',
  35.     // Template used when viewing the item
  36.     'view_tpl'           => 'bitpackage:liberty/mime/flash/view.tpl',
  37.     'inline_tpl'         => 'bitpackage:liberty/mime/flash/inline.tpl',
  38.     'storage_tpl'        => 'bitpackage:liberty/mime/flash/inline.tpl',
  39.     'attachment_tpl'     => 'bitpackage:liberty/mime/flash/inline.tpl',
  40.     // This should be the same for all mime plugins
  41.     'plugin_type'        => MIME_PLUGIN,
  42.     // Set this to TRUE if you want the plugin active right after installation
  43.     'auto_activate'      => FALSE,
  44.     // Allow for additional processing options - passed in during verify and store
  45.     /* Depricated we should be able to get this automagically from the swf
  46.     'processing_options' =>
  47.         '<label>'.tra( "Width" ).': <input type="text" size="5" name="plugin[swf_width]" />px </label><br />'.
  48.         '<label>'.tra( "Height" ).': <input type="text" size="5" name="plugin[swf_height]" />px </label><br />'.
  49.         tra( 'If this is a flash file please insert the width and hight.' ),
  50.     */
  51.     // this should pick up all videos
  52.     'mimetypes'          => array(
  53.         '#application/x-shockwave-flash#i',
  54.     ),
  55. );
  56.  
  57. $gLibertySystem->registerPluginPLUGIN_MIME_GUID_FLASH$pluginParams );
  58.  
  59. /**
  60.  * Update file settings - taken over by mime_default_store appart from the width and height settings
  61.  * 
  62.  * @access public
  63.  * @return TRUE on success, FALSE on failure - $pStoreRow['errors'] will contain reason
  64.  */
  65. function mime_flash_update&$pStoreRow {
  66.     global $gBitSystem;
  67.  
  68.     // this will set the correct pluign guid, even if we let default handle the store process
  69.     $pStoreRow['attachment_plugin_guid'PLUGIN_MIME_GUID_FLASH;
  70.     if$ret mime_default_update$pStoreRow ) ) {
  71.         mime_flash_store_preferences$pStoreRow );
  72.     }
  73.     return $ret;
  74. }
  75.  
  76. /**
  77.  * Store file settings - taken over by mime_default_store appart from the width and height settings
  78.  * 
  79.  * @access public
  80.  * @return TRUE on success, FALSE on failure - $pStoreRow['errors'] will contain reason
  81.  */
  82. function mime_flash_store&$pStoreRow {
  83.     global $gBitSystem;
  84.  
  85.     // this will set the correct pluign guid, even if we let default handle the store process
  86.     $pStoreRow['attachment_plugin_guid'PLUGIN_MIME_GUID_FLASH;
  87.     if$ret mime_default_store$pStoreRow ) ) {
  88.         mime_flash_store_preferences$pStoreRow );
  89.     }
  90.     return $ret;
  91. }
  92.  
  93. /**
  94.  * mime_flash_store_preferences
  95.  * 
  96.  * @param array $pFileHash Flash information
  97.  * @access public
  98.  * @return TRUE on success, FALSE on failure - mErrors will contain reason for failure
  99.  */
  100. function mime_flash_store_preferences&$pFileHash {
  101.     $ret FALSE;
  102.  
  103.     if@BitBase::verifyId$pFileHash['attachment_id')) {
  104.         list$pFileHash['preferences']['width']$pFileHash['preferences']['height']$type$attrgetimagesizeSTORAGE_PKG_PATH.$pFileHash['upload']['dest_branch'].$pFileHash['upload']['name');
  105.  
  106.         // store width of video
  107.         if!empty$pFileHash['preferences']['width')) {
  108.             LibertyMime::storeAttachmentPreference$pFileHash['attachment_id']'width'$pFileHash['preferences']['width');
  109.         }
  110.         // store height of video
  111.         if!empty$pFileHash['preferences']['height')) {
  112.             LibertyMime::storeAttachmentPreference$pFileHash['attachment_id']'height'$pFileHash['preferences']['height');
  113.         }
  114.         $ret TRUE;
  115.     }
  116.  
  117.     return $ret;
  118. }
  119. ?>

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