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

Source for file storage.lulu.php

Documentation is available at storage.lulu.php

  1. <?php
  2. /**
  3.  * @version  $Revision$
  4.  * @package  liberty
  5.  * @subpackage plugins_storage
  6.  */
  7. global $gLibertySystem;
  8.  
  9. /**
  10.  * definitions
  11.  */
  12. define'PLUGIN_GUID_LULU''lulu' );
  13.  
  14. $pluginParams array 
  15.     'store_function' => 'lulu_store',
  16.     'load_function' => 'lulu_load',
  17.     'expunge_function' => 'lulu_expunge',
  18.     'verify_function' => 'lulu_verify',
  19.     'description' => 'Lulu Content ID',
  20.     'plugin_type' => STORAGE_PLUGIN,
  21.     'auto_activate' => FALSE,
  22.     'edit_label' => 'Enter <a href="http://www.lulu.com">Lulu</a> Content ID',
  23.     'edit_field' => '<input type="text" name="STORAGE['.PLUGIN_GUID_LULU.']" size="40" /> 
  24.         <a href="http://www.lulu.com">{biticon ipackage=liberty iname=lulu iexplain=lulu}</a>',
  25.     'edit_help' => 'Enter the ID of the Lulu item you would like to include.<br />The ID is the number that is displayed at the end of the URL in the browsers address bar, when viewing the image of choice.'
  26. );
  27.  
  28. $gLibertySystem->registerPluginPLUGIN_GUID_LULU$pluginParams );
  29.  
  30. /*
  31.     the lulu plugin doesn't need to do anything extra besides store the lulu image_id
  32.     in liberty_attachment.foreign_id - which has already happened in LibertyAttachable::store().
  33.     So, we don't need to even define this function
  34.     function lulu_store() {
  35.     }
  36. */
  37.     function lulu_verify&$pStoreRow {
  38.         if!empty$pStoreRow['upload') ) {
  39.             $pStoreRow['foreign_id'$pStoreRow['upload'];
  40.         }
  41.         return!empty$pStoreRow['foreign_id') );
  42.     }
  43.     
  44.     function lulu_expunge($pAttachmentId{
  45.         global $gBitSystem;
  46.         
  47.         $sql "DELETE FROM `".BIT_DB_PREFIX."liberty_attachments` WHERE `attachment_id` = ?";
  48.         $gBitSystem->mDb->query($sqlarray($pAttachmentId));
  49.         
  50.         return TRUE;
  51.     }
  52.  
  53.     function lulu_store({
  54.     }
  55.  
  56.     function lulu_load$pRow {
  57.         $ret array();
  58.         if$pRow['foreign_id'{
  59.             $cidGroup ((int)($pRow['foreign_id'1000)) 1000;
  60.             $ret['source_url''http://www.lulu.com/content/'.$pRow['foreign_id'];
  61.             $ret['thumbnail_url']['small']  'http://www.lulu.com/author/display_thumbnail.php?fSize=promo_&fCID='.$pRow['foreign_id'];
  62.             $ret['thumbnail_url']['medium''http://www.lulu.com/author/display_thumbnail.php?fSize=detail_&fCID='.$pRow['foreign_id'];
  63.             $ret['thumbnail_url']['large']  'http://www.lulu.com/author/display_thumbnail.php?fSize=320_&fCID='.$pRow['foreign_id'];
  64.             $ret['attachment_id'$pRow['attachment_id'];
  65.             $ret['wiki_plugin_link'"{attachment id=".$ret['attachment_id']."}";
  66.         }
  67.         return $ret;
  68.     }
  69. ?>

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