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

Source for file storage.pbase.php

Documentation is available at storage.pbase.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_PBASE', 'pbase' );
  13.  
  14. $pluginParams = array ( 
  15.     'store_function' => 'pbase_store',
  16.     'load_function' => 'pbase_load',
  17.     'verify_function' => 'pbase_verify',
  18.     'expunge_function' => 'pbase_expunge',
  19.     'description' => 'PBase Image ID',
  20.     'plugin_type' => STORAGE_PLUGIN,
  21.     'auto_activate' => FALSE,
  22.     'edit_label' => 'Enter <a href="http://www.pbase.com">PBase</a> Image ID',
  23.     'edit_field' => '<input type="text" name="STORAGE['.PLUGIN_GUID_PBASE.']" size="40" /> 
  24.         <a href="http://www.pbase.com">{biticon ipackage=liberty iname=pbase iexplain=pbase}</a>',
  25.     'edit_help' => 'Enter the ID of the image 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->registerPlugin( PLUGIN_GUID_PBASE, $pluginParams );
  29.  
  30. /*
  31.     the pbase plugin doesn't need to do anything extra besides store the pbase 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 pbase_store() {
  35.     }
  36. */
  37.     function pbase_verify( &$pStoreRow ) {
  38.         if( !empty( $pStoreRow['upload'] ) ) {
  39.             $pStoreRow['foreign_id'] = $pStoreRow['upload'];
  40.         }
  41.         $pStoreRow['plugin_guid'] = PLUGIN_GUID_PBASE;
  42.         return( empty( $pStoreRow['foreign_id'] ) ? FALSE : TRUE );
  43.     }
  44.     
  45.     function pbase_expunge() {
  46.         return TRUE;
  47.     }
  48.  
  49.     function pbase_store() {
  50.         return TRUE;
  51.     }
  52.  
  53.     function pbase_load( $pRow ) {
  54.         $ret = array();
  55.         if( $pRow['foreign_id'] ) {
  56.             $ret['source_url'] = 'http://www.pbase.com/image/'.$pRow['foreign_id'];
  57.             $ret['thumbnail_url']['small'] = 'http://www.pbase.com/image/'.$pRow['foreign_id'].'/small.jpg';
  58.             $ret['thumbnail_url']['medium'] = 'http://www.pbase.com/image/'.$pRow['foreign_id'].'/medium.jpg';
  59.             $ret['thumbnail_url']['large'] = 'http://www.pbase.com/image/'.$pRow['foreign_id'].'/large.jpg';
  60.         }
  61.         return $ret;
  62.     }
  63.  
  64. ?>

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