本文整理汇总了PHP中stream_register_wrapper函数的典型用法代码示例。如果您正苦于以下问题:PHP stream_register_wrapper函数的具体用法?PHP stream_register_wrapper怎么用?PHP stream_register_wrapper使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了stream_register_wrapper函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: registerWrapper
public static function registerWrapper()
{
if (!self::$registered) {
stream_register_wrapper('compress.lzw', __CLASS__);
}
self::$registered = true;
}
示例2: registerStreamWrapper
/**
* Register a stream wrapper according to its scheme and class.
* Must called prior the opening of first stream under this scheme
*/
public static function registerStreamWrapper()
{
if (in_array(static::SCHEME, stream_get_wrappers())) {
stream_wrapper_unregister(static::SCHEME);
}
stream_register_wrapper(static::SCHEME, get_called_class());
}
示例3: setUp
public function setUp()
{
$existed = in_array('imc', stream_get_wrappers());
if (!$existed) {
stream_register_wrapper('imc', 'ImcStream\\ImcStream');
}
}
示例4: setUpBeforeClass
public static function setUpBeforeClass()
{
\stream_wrapper_unregister('http');
\stream_wrapper_unregister('https');
// Register HTTP
\stream_register_wrapper('http', '\\Kshabazz\\Interception\\StreamWrappers\\Http', \STREAM_IS_URL);
// Register HTTPS
\stream_register_wrapper('https', '\\Kshabazz\\Interception\\StreamWrappers\\Http', \STREAM_IS_URL);
Http::setSaveDir(FIXTURES_PATH);
}
示例5: register
public static function register()
{
stream_register_wrapper('mmap', __CLASS__);
}
示例6: stream_seek
public function stream_seek($offset, $whence)
{
}
// end stream_seek();
/**
* PHP stream function - reports some data about the current file.
* @return Array
*/
public function stream_stat()
{
if (!isset(self::$files[$this->file])) {
return array();
}
return array('size' => strlen($this->file));
}
// end stream_stat();
/**
* PHP stream function - reports some data about the current file.
* @return Array
*/
public function url_stat($path, $flags)
{
if (!isset(self::$files[$path])) {
return false;
}
return array('size' => strlen($path));
}
}
// end Extra_TestFS;
stream_register_wrapper('test', 'Extra_TestFS');
示例7: error_reporting
<?php
// << ...custom stream wrapper goes somewhere here...>>
echo '<pre>';
error_reporting(E_ALL);
ini_set('display_errors', true);
clearstatcache();
stream_register_wrapper('test', 'MemoryStream');
mkdir('test://aaa');
mkdir('test://aaa/cc');
mkdir('test://aaa/dd');
echo 'PHP ' . PHP_VERSION;
echo '<br />node exists: ' . file_exists('test://aaa/cc');
echo '<br />node is writable: ' . is_writable('test://aaa/cc');
echo '<br />node is dir: ' . is_dir('test://aaa/cc');
echo '<br />tempnam in dir: ' . tempnam('test://aaa/cc', 'tmp');
echo "<br /></pre>";
示例8: registerStreamWrapper
/**
* Register this object as stream wrapper
*
* @param string $name Protocol name
*/
public function registerStreamWrapper($name = 'azure')
{
/**
* @see Microsoft_WindowsAzure_Storage_Blob_Stream
*/
require_once 'Microsoft/WindowsAzure/Storage/Blob/Stream.php';
stream_register_wrapper($name, 'Microsoft_WindowsAzure_Storage_Blob_Stream');
$this->registerAsClient($name);
}
示例9: registerStreamWrapper
/**
* Register this object as stream wrapper
*
* @param string $name
* @return Zend_Service_Amazon_S3
*/
public function registerStreamWrapper($name = 's3')
{
/**
* @see Zend_Service_Amazon_S3_Stream
*/
#require_once 'Zend/Service/Amazon/S3/Stream.php';
stream_register_wrapper($name, 'Zend_Service_Amazon_S3_Stream');
$this->registerAsClient($name);
}
示例10: registerStreamWrapper
/**
* Register this object as stream wrapper
*
* @param string $name
* @return Zend_Service_Amazon_S3
*/
public function registerStreamWrapper($name = 's3')
{
stream_register_wrapper($name, 'Zend_Service_Amazon_S3_Stream');
$this->registerAsClient($name);
}
示例11: stream_open
<?php
class test
{
function stream_open()
{
echo "open\n";
return true;
}
function stream_write($d)
{
echo "write {$d}\n";
return strlen($d);
}
function stream_flush()
{
echo "flush\n";
return true;
}
function stream_close()
{
echo "close\n";
}
}
stream_register_wrapper("test", "test", STREAM_IS_URL);
var_dump(file_put_contents("test://hello", "w"));
示例12: startTestSuite
/**
* @param \PHPUnit_Framework_TestSuite $suite
*/
public function startTestSuite(\PHPUnit_Framework_TestSuite $suite)
{
foreach ($this->wrappers as $wrapper) {
\stream_wrapper_unregister($wrapper);
\stream_register_wrapper($wrapper, self::STREAM_WRAPPER_NAME_SPACE . $this->wrapperClass, \STREAM_IS_URL);
}
Http::setSaveDir($this->saveDir);
}
示例13: strlen
} else {
return false;
}
break;
case SEEK_CUR:
if ($offset >= 0) {
$this->pos += $offset;
return true;
} else {
return false;
}
break;
case SEEK_END:
if (strlen($this->data) + $offset >= 0) {
$this->pos = strlen($this->data) + $offset;
return true;
} else {
return false;
}
break;
default:
return false;
}
}
}
stream_register_wrapper("test1", "test", STREAM_IS_URL);
stream_register_wrapper("test2", "test");
echo @file_get_contents("test1://hello"), "\n";
@(include "test1://hello");
echo @file_get_contents("test2://hello"), "\n";
include "test2://hello";
示例14: strlen
$this->position += $offset;
return true;
} else {
return false;
}
break;
case SEEK_END:
if (strlen($GLOBALS[$this->varname]) + $offset >= 0) {
$this->position = strlen($GLOBALS[$this->varname]) + $offset;
return true;
} else {
return false;
}
break;
default:
trigger_error("Unknown whence for fseek of global variable \${$this->varname}", E_USER_NOTICE);
return false;
}
}
/**
* Callback for fstat().
*
* @return array
*/
public function stream_stat()
{
return array();
}
}
stream_register_wrapper('global', 'Q\\VariableStream');
示例15: register
/**
* Register the stream
*/
public function register()
{
if (isset($GLOBALS['sugar_config']['upload_wrapper_class'])) {
SugarAutoLoader::requireWithCustom("include/{$GLOBALS['sugar_config']['upload_wrapper_class']}.php");
if (class_exists($GLOBALS['sugar_config']['upload_wrapper_class'])) {
self::$wrapper_class = $GLOBALS['sugar_config']['upload_wrapper_class'];
} else {
self::$wrapper_class = __CLASS__;
}
} else {
self::$wrapper_class = __CLASS__;
}
stream_register_wrapper(self::STREAM_NAME, self::$wrapper_class);
self::$instance = new self::$wrapper_class();
}