Created
October 6, 2014 09:28
-
-
Save undertext/0c0510a5e029fd6c8707 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Implements hook_stream_wrappers. | |
*/ | |
function fics_stream_wrapper_stream_wrappers() { | |
return array( | |
'fics' => array( | |
'name' => t('FICS'), | |
'class' => 'FICSStreamWrapper', | |
'description' => t('Provides fics path.'), | |
'type' => STREAM_WRAPPERS_LOCAL_HIDDEN, | |
), | |
); | |
} | |
/** | |
* FICS (fics://) stream wrapper class. | |
* | |
* Provides support for storing fics documents with the Drupal file | |
* interface. | |
*/ | |
class FICSStreamWrapper extends DrupalPublicStreamWrapper { | |
/** | |
* Implements abstract public function getDirectoryPath() | |
*/ | |
public function getDirectoryPath() { | |
return parent::getDirectoryPath() . '/fics'; | |
} | |
function getExternalUrl() { | |
$path = str_replace('\\', '/', $this->getTarget()); | |
return $GLOBALS['base_url'] . '/' . self::getDirectoryPath() . '/' . drupal_encode_path($path); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment