/[drupal]/contributions/modules/bitcache/bitcache.module
ViewVC logotype

Diff of /contributions/modules/bitcache/bitcache.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.31, Tue May 19 15:27:22 2009 UTC revision 1.32, Wed Jul 1 04:09:48 2009 UTC
# Line 172  function bitcache_menu() { Line 172  function bitcache_menu() {
172  }  }
173    
174  /**  /**
175     * Implementation of hook_init().
176     */
177    function bitcache_init() {
178      foreach (array('token', 'services') as $module) {
179        if (module_exists($module)) {
180          module_load_include('inc', 'bitcache', 'bitcache.' . $module);
181        }
182      }
183    }
184    
185    /**
186   * Implementation of hook_form_alter().   * Implementation of hook_form_alter().
187   */   */
188  function bitcache_form_alter(&$form, $form_state, $form_id) {  function bitcache_form_alter(&$form, $form_state, $form_id) {
# Line 417  function bitcache_bitcache_algorithms($o Line 428  function bitcache_bitcache_algorithms($o
428  }  }
429    
430  //////////////////////////////////////////////////////////////////////////////  //////////////////////////////////////////////////////////////////////////////
 // Services API hooks  
   
 /**  
  * Implementation of hook_service().  
  */  
 function bitcache_service() {  
   return array(  
     array(  
       '#method'   => 'bitcache.exists',  
       '#callback' => 'bitcache_exists',  
       '#return'   => 'boolean',  
       '#args'     => array(  
         array('#name' => 'id', '#type' => 'string', '#optional' => FALSE, '#description' => t('The bitstream\'s identifier (SHA-1 fingerprint).')),  
       ),  
       '#help'     => t('Determines whether a given bitstream exists.'),  
     ),  
     array(  
       '#method'   => 'bitcache.get',  
       '#callback' => 'bitcache_get_contents',  
       '#return'   => 'base64',  
       '#args'     => array(  
         array('#name' => 'id', '#type' => 'string', '#optional' => FALSE, '#description' => t('The bitstream\'s identifier (SHA-1 fingerprint).')),  
       ),  
       '#help'     => t('Retrieves the contents of the given bitstream.'),  
     ),  
     array(  
       '#method'   => 'bitcache.put',  
       '#callback' => 'bitcache_put',  
       '#return'   => 'boolean',  
       '#args'     => array(  
         array('#name' => 'id', '#type' => 'string', '#optional' => FALSE, '#description' => t('The bitstream\'s identifier (SHA-1 fingerprint).')),  
         array('#name' => 'data', '#type' => 'base64', '#optional' => FALSE, '#description' => t('The bitstream\'s contents.')),  
       ),  
       '#help'     => t('Stores the contents of the given bitstream.'),  
     ),  
     array(  
       '#method'   => 'bitcache.delete',  
       '#callback' => 'bitcache_delete',  
       '#return'   => 'boolean',  
       '#args'     => array(  
         array('#name' => 'id', '#type' => 'string', '#optional' => FALSE, '#description' => t('The bitstream\'s identifier (SHA-1 fingerprint).')),  
       ),  
       '#help'     => t('Deletes the given bitstream.'),  
     ),  
   );  
 }  
   
 //////////////////////////////////////////////////////////////////////////////  
431  // Bitcache repository API  // Bitcache repository API
432    
433  /**  /**
# Line 897  function bitcache_tmpname($register = TR Line 860  function bitcache_tmpname($register = TR
860    }    }
861    return $path;    return $path;
862  }  }
863    
864    function bitcache_token_replace($text) {
865      if (module_exists('token')) {
866        return token_replace($text);
867      }
868      else { // simple fallback token support
869        $tokens = array(
870          '[file-directory-path]' => file_directory_path(),
871          '[file-directory-temp]' => file_directory_temp(),
872          '[site-host]'           => $_SERVER['HTTP_HOST'],
873        );
874        return str_replace(array_keys($tokens), array_values($tokens), $text);
875      }
876    }

Legend:
Removed from v.1.31  
changed lines
  Added in v.1.32

  ViewVC Help
Powered by ViewVC 1.1.2