本文整理汇总了PHP中stream_get_filters函数的典型用法代码示例。如果您正苦于以下问题:PHP stream_get_filters函数的具体用法?PHP stream_get_filters怎么用?PHP stream_get_filters使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了stream_get_filters函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: test_register_filter
public function test_register_filter()
{
ConvertMbstringEncoding::register();
$filterName = ConvertMbstringEncoding::getFilterName();
$registeredFilters = stream_get_filters();
$this->assertTrue(in_array($filterName, $registeredFilters));
}
开发者ID:Exquance,项目名称:csv,代码行数:7,代码来源:ConvertMbstringEncodingTest.php
示例2: setUp
/**
* Setup method. Ensure filter we depend on is available
*
* @return void
*/
public function setUp()
{
$depend = $this->filter();
if (!in_array($depend, stream_get_filters())) {
throw new PrerequisitesNotMetError(ucfirst($depend) . ' stream filter not available', null, [$depend]);
}
}
开发者ID:johannes85,项目名称:core,代码行数:12,代码来源:AbstractCompressingOutputStreamTest.class.php
示例3: setUp
public function setUp()
{
// register filter
$filters = stream_get_filters();
if (!in_array('crypto.filter', $filters)) {
stream_filter_register('crypto.filter', 'Fruit\\CryptoKit\\CryptoFilter');
}
}
开发者ID:Ronmi,项目名称:fruit-cryptokit,代码行数:8,代码来源:CryptoFilterTest.php
示例4: register
/**
* Register the stream filter
*
* @return bool
*/
public static function register()
{
$result = false;
$name = self::getName();
if (!empty($name) && !in_array($name, stream_get_filters())) {
$result = stream_filter_register(self::getName(), get_called_class());
}
return $result;
}
开发者ID:janssit,项目名称:www.rvproductions.be,代码行数:14,代码来源:abstract.php
示例5: renderWithContext
protected function renderWithContext()
{
if (!in_array("displayObjectRenderer", stream_get_filters())) {
stream_filter_register("displayObjectRenderer", "DisplayObjectRenderer");
}
$pointer = fopen($this->url, "r");
if ($this->context) {
stream_filter_append($pointer, "displayObjectRenderer", STREAM_FILTER_READ, $this->context);
} else {
stream_filter_append($pointer, "displayObjectRenderer", STREAM_FILTER_READ);
}
return stream_get_contents($pointer);
}
开发者ID:aventurella,项目名称:displayobject,代码行数:13,代码来源:DisplayObject.php
示例6: renderDisplayObjectWithUri
public static function renderDisplayObjectWithUri($uri, &$dictionary = null)
{
if (!in_array("displayObjectRenderer_mustache", stream_get_filters())) {
stream_filter_register("displayObjectRenderer_mustache", "AMMustacheRenderer");
}
if (file_exists($uri)) {
$pointer = fopen($uri, "r");
stream_filter_append($pointer, "displayObjectRenderer_mustache", STREAM_FILTER_READ);
return stream_get_contents($pointer);
} else {
trigger_error('AMMustache unable to open file ' . $uri, E_USER_ERROR);
}
}
开发者ID:aventurella,项目名称:Galaxy,代码行数:13,代码来源:AMMustache.php
示例7: renderDisplayObjectWithURLAndDictionary
public static function renderDisplayObjectWithURLAndDictionary($url, &$dictionary = null)
{
static $suffix;
// = 1;
if (!in_array("displayObjectRenderer_{$suffix}", stream_get_filters())) {
stream_filter_register("displayObjectRenderer_{$suffix}", "DisplayObjectRenderer");
}
$pointer = fopen($url, "r");
if ($dictionary) {
stream_filter_append($pointer, "displayObjectRenderer_{$suffix}", STREAM_FILTER_READ, $dictionary);
} else {
stream_filter_append($pointer, "displayObjectRenderer_{$suffix}", STREAM_FILTER_READ);
}
//$suffix++;
return stream_get_contents($pointer);
}
开发者ID:aventurella,项目名称:Galaxy,代码行数:16,代码来源:DisplayObject.php
示例8: testHandlesCompression
public function testHandlesCompression()
{
$body = EntityBody::factory('testing 123...testing 123');
$this->assertFalse($body->getContentEncoding(), '-> getContentEncoding() must initially return FALSE');
$size = $body->getContentLength();
$body->compress();
$this->assertEquals('gzip', $body->getContentEncoding(), '-> getContentEncoding() must return the correct encoding after compressing');
$this->assertEquals(gzdeflate('testing 123...testing 123'), (string) $body);
$this->assertTrue($body->getContentLength() < $size);
$this->assertTrue($body->uncompress());
$this->assertEquals('testing 123...testing 123', (string) $body);
$this->assertFalse($body->getContentEncoding(), '-> getContentEncoding() must reset to FALSE');
if (in_array('bzip2.*', stream_get_filters())) {
$this->assertTrue($body->compress('bzip2.compress'));
$this->assertEquals('compress', $body->getContentEncoding(), '-> compress() must set \'compress\' as the Content-Encoding');
}
$this->assertFalse($body->compress('non-existent'), '-> compress() must return false when a non-existent stream filter is used');
// Release the body
unset($body);
// Use gzip compression on the initial content. This will include a
// gzip header which will need to be stripped when deflating the stream
$body = EntityBody::factory(gzencode('test'));
$this->assertSame($body, $body->setStreamFilterContentEncoding('zlib.deflate'));
$this->assertTrue($body->uncompress('zlib.inflate'));
$this->assertEquals('test', (string) $body);
unset($body);
// Test using a very long string
$largeString = '';
for ($i = 0; $i < 25000; $i++) {
$largeString .= chr(rand(33, 126));
}
$body = EntityBody::factory($largeString);
$this->assertEquals($largeString, (string) $body);
$this->assertTrue($body->compress());
$this->assertNotEquals($largeString, (string) $body);
$compressed = (string) $body;
$this->assertTrue($body->uncompress());
$this->assertEquals($largeString, (string) $body);
$this->assertEquals($compressed, gzdeflate($largeString));
$body = EntityBody::factory(fopen(__DIR__ . '/../TestData/compress_test', 'w'));
$this->assertFalse($body->compress());
unset($body);
unlink(__DIR__ . '/../TestData/compress_test');
}
开发者ID:jorjoh,项目名称:Varden,代码行数:44,代码来源:EntityBodyTest.php
示例9: streams
function streams()
{
$sw = stream_get_wrappers();
$sf = stream_get_filters();
/*
Console::writeLn("Stream Management");
Console::writeLn(" |- Registered wrappers");
for($n=0; $n<count($sw); $n++) {
$this->treenode( $sw[$n] , !(($n+1)<count($sw)), false );
}
Console::writeLn(" '- Registered filters");
for($n=0; $n<count($sf); $n++) {
$this->treenode( $sf[$n] , !(($n+1)<count($sf)), true );
}
*/
$cb = 0;
Console::writeLn(__astr("\\b{Registered Wrappers:}"));
sort($sw);
foreach ($sw as $val) {
Console::write(' %-18s', $val);
$cb++;
if ($cb > 3 && $val != end($sw)) {
Console::writeLn();
$cb = 0;
}
}
Console::writeLn();
Console::writeLn();
$cb = 0;
Console::writeLn(__astr("\\b{Registered Filters:}"));
sort($sf);
foreach ($sf as $val) {
Console::write(' %-18s', $val);
$cb++;
if ($cb > 3 && $val != end($sf)) {
Console::writeLn();
$cb = 0;
}
}
Console::writeLn();
Console::writeLn();
}
开发者ID:noccy80,项目名称:lepton-ng,代码行数:43,代码来源:info.php
示例10: putfile
//.........这里部分代码省略.........
$errno = 0;
$errstr = '';
$hosts = (!empty($proxyHost) ? $scheme . $proxyHost : $scheme . $host) . ':' . (!empty($proxyPort) ? $proxyPort : $port);
$fp = @stream_socket_client($hosts, $errno, $errstr, 120, STREAM_CLIENT_CONNECT);
if (!$fp) {
if (!function_exists('stream_socket_client')) {
html_error('[ERROR] stream_socket_client() is disabled.');
}
$dis_host = !empty($proxyHost) ? $proxyHost : $host;
$dis_port = !empty($proxyPort) ? $proxyPort : $port;
html_error(sprintf(lang(88), $dis_host, $dis_port));
}
if ($errno || $errstr) {
$lastError = $errstr;
return false;
}
if ($proxy) {
echo '<p>' . sprintf(lang(89), $proxyHost, $proxyPort) . '<br />PUT: <b>' . htmlspecialchars($url) . "</b>...<br />\n";
} else {
echo '<p>' . sprintf(lang(90), $host, $port) . '</p>';
}
echo lang(104) . ' <b>' . htmlspecialchars($filename) . '</b>, ' . lang(56) . ' <b>' . bytesToKbOrMbOrGb($fileSize) . '</b>...<br />';
$GLOBALS['id'] = md5(time() * rand(0, 10));
require TEMPLATE_DIR . '/uploadui.php';
flush();
$timeStart = microtime(true);
$chunkSize = GetChunkSize($fileSize);
fwrite($fp, $request);
fflush($fp);
$fs = fopen($file, 'r');
$totalsend = $time = $lastChunkTime = 0;
while (!feof($fs) && !$errno && !$errstr) {
$data = fread($fs, $chunkSize);
if ($data === false) {
fclose($fs);
fclose($fp);
html_error(lang(112));
}
$sendbyte = @fwrite($fp, $data);
fflush($fp);
if ($sendbyte === false || strlen($data) > $sendbyte) {
fclose($fs);
fclose($fp);
html_error(lang(113));
}
$totalsend += $sendbyte;
$time = microtime(true) - $timeStart;
$chunkTime = $time - $lastChunkTime;
$chunkTime = $chunkTime > 0 ? $chunkTime : 1;
$lastChunkTime = $time;
$speed = round($sendbyte / 1024 / $chunkTime, 2);
$percent = round($totalsend / $fileSize * 100, 2);
echo "<script type='text/javascript'>pr('{$percent}', '" . bytesToKbOrMbOrGb($totalsend) . "', '{$speed}');</script>\n";
flush();
}
if ($errno || $errstr) {
$lastError = $errstr;
return false;
}
fclose($fs);
fflush($fp);
$llen = 0;
$header = '';
do {
$header .= fgets($fp, 16384);
$len = strlen($header);
if (!$header || $len == $llen) {
$lastError = lang(91);
stream_socket_shutdown($fp, STREAM_SHUT_RDWR);
fclose($fp);
return false;
}
$llen = $len;
} while (strpos($header, $nn . $nn) === false);
// Array for active stream filters
$sFilters = array();
if (stripos($header, "\nTransfer-Encoding: chunked") !== false && in_array('dechunk', stream_get_filters())) {
$sFilters['dechunk'] = stream_filter_append($fp, 'dechunk', STREAM_FILTER_READ);
}
// Add built-in dechunk filter
$page = '';
do {
$data = @fread($fp, 16384);
if ($data == '') {
break;
}
$page .= $data;
} while (!feof($fp) && strlen($data) > 0);
stream_socket_shutdown($fp, STREAM_SHUT_RDWR);
fclose($fp);
if (stripos($header, "\nTransfer-Encoding: chunked") !== false && empty($sFilters['dechunk']) && function_exists('http_chunked_decode')) {
$dechunked = http_chunked_decode($page);
if ($dechunked !== false) {
$page = $dechunked;
}
unset($dechunked);
}
$page = $header . $page;
return $page;
}
开发者ID:Transcodes,项目名称:rapidleech,代码行数:101,代码来源:http.php
示例11: CheckBack
public function CheckBack($header)
{
if (stripos($header, "\nContent-Type: text/html") !== false) {
global $fp, $sFilters;
if (empty($fp) || !is_resource($fp)) {
html_error('[filesflash_com] Cannot check download error.');
}
$is_chunked = stripos($header, "\nTransfer-Encoding: chunked") !== false;
if (!isset($sFilters) || !is_array($sFilters)) {
$sFilters = array();
}
if ($is_chunked && empty($sFilters['dechunk']) && in_array('dechunk', stream_get_filters())) {
$sFilters['dechunk'] = stream_filter_append($fp, 'dechunk', STREAM_FILTER_READ);
}
$body = stream_get_contents($fp);
if ($is_chunked && empty($sFilters['dechunk']) && function_exists('http_chunked_decode')) {
$dechunked = http_chunked_decode($body);
if ($dechunked !== false) {
$body = $dechunked;
}
unset($dechunked);
}
is_present($body, 'Your IP address is not valid for this link.', '[filesflash_com] Your IP address is not valid for this link.');
is_present($body, 'Your IP address is already downloading another link.', '[filesflash_com] Your IP address is already downloading another link.');
is_present($body, 'Your link has expired.', '[filesflash_com] Your link has expired.');
is_present($body, 'Interrupted free downloads cannot be resumed.', '[filesflash_com] Interrupted free downloads cannot be resumed.');
html_error('[filesflash_com] Unknown download error.');
}
}
开发者ID:SheppeR,项目名称:rapidleech,代码行数:29,代码来源:filesflash_com.php
示例12: attachFilter
/**
* Attach a filter in FIFO order
*
* @param mixed $filter An object that implements ObjectInterface, ObjectIdentifier object
* or valid identifier string
* @param array $config An optional array of filter config options
* @return bool Returns TRUE if the filter was attached, FALSE otherwise
*/
public function attachFilter($filter, $config = array())
{
$result = false;
//Handle custom filters
if (!in_array($filter, stream_get_filters())) {
//Create the complete identifier if a partial identifier was passed
if (is_string($filter) && strpos($filter, '.') === false) {
$identifier = clone $this->getIdentifier();
$identifier->path = array('stream', 'filter');
$identifier->name = $filter;
} else {
$identifier = $this->getIdentifier($filter);
}
if ($identifier->inherits('Nooku\\Library\\FilesystemStreamFilterInterface')) {
$filter = $identifier->classname;
$filter::register();
$filter = $filter::getName();
}
}
//If we have a valid filter name create the filter and append it
if (is_string($filter) && !empty($filter)) {
$mode = 0;
if ($this->isReadable()) {
$mode = $mode & STREAM_FILTER_READ;
}
if ($this->isWritable()) {
$mode = $mode & STREAM_FILTER_WRITE;
}
if ($resource = stream_filter_append($this->_resource, $filter, $mode, $config)) {
$this->_filters[$filter] = $filter;
$result = true;
}
}
return $result;
}
开发者ID:janssit,项目名称:www.rvproductions.be,代码行数:43,代码来源:stream.php
示例13: testRespondWithPaddedStreamFilterOutput
/**
* @runInSeparateProcess
*/
public function testRespondWithPaddedStreamFilterOutput()
{
$availableFilter = stream_get_filters();
if (in_array('mcrypt.*', $availableFilter) && in_array('mdecrypt.*', $availableFilter)) {
$app = new App();
$app->get('/foo', function ($req, $res) {
$key = base64_decode('xxxxxxxxxxxxxxxx');
$iv = base64_decode('Z6wNDk9LogWI4HYlRu0mng==');
$data = 'Hello';
$length = strlen($data);
$stream = fopen('php://temp', 'r+');
$filter = stream_filter_append($stream, 'mcrypt.rijndael-128', STREAM_FILTER_WRITE, ['key' => $key, 'iv' => $iv]);
fwrite($stream, $data);
rewind($stream);
stream_filter_remove($filter);
stream_filter_append($stream, 'mdecrypt.rijndael-128', STREAM_FILTER_READ, ['key' => $key, 'iv' => $iv]);
return $res->withHeader('Content-Length', $length)->withBody(new Body($stream));
});
// Prepare request and response objects
$env = Environment::mock(['SCRIPT_NAME' => '/index.php', 'REQUEST_URI' => '/foo', 'REQUEST_METHOD' => 'GET']);
$uri = Uri::createFromEnvironment($env);
$headers = Headers::createFromEnvironment($env);
$cookies = [];
$serverParams = $env->all();
$body = new RequestBody();
$req = new Request('GET', $uri, $headers, $cookies, $serverParams, $body);
$res = new Response();
// Invoke app
$resOut = $app($req, $res);
$app->respond($resOut);
$this->assertInstanceOf('\\Psr\\Http\\Message\\ResponseInterface', $resOut);
$this->expectOutputString('Hello');
} else {
$this->assertTrue(true);
}
}
开发者ID:hidayat365,项目名称:phpindonesia.or.id-membership2,代码行数:39,代码来源:AppTest.php
示例14: registerStreamExtensions
/**
* Registers stream extensions for PartStream and CharsetStreamFilter
*
* @see stream_filter_register
* @see stream_wrapper_register
*/
protected function registerStreamExtensions()
{
stream_filter_register(UUEncodeStreamFilter::STREAM_FILTER_NAME, __NAMESPACE__ . '\\Stream\\UUEncodeStreamFilter');
stream_filter_register(CharsetStreamFilter::STREAM_FILTER_NAME, __NAMESPACE__ . '\\Stream\\CharsetStreamFilter');
stream_wrapper_register(PartStream::STREAM_WRAPPER_PROTOCOL, __NAMESPACE__ . '\\Stream\\PartStream');
// hhvm compatibility -- at time of writing, no convert.* filters
// should return false if already registered
$filters = stream_get_filters();
// @codeCoverageIgnoreStart
if (!in_array('convert.*', $filters)) {
stream_filter_register(QuotedPrintableDecodeStreamFilter::STREAM_FILTER_NAME, __NAMESPACE__ . '\\Stream\\QuotedPrintableDecodeStreamFilter');
stream_filter_register(Base64DecodeStreamFilter::STREAM_FILTER_NAME, __NAMESPACE__ . '\\Stream\\Base64DecodeStreamFilter');
}
// @codeCoverageIgnoreEnd
}
开发者ID:bogolubov,项目名称:owncollab_talks-1,代码行数:21,代码来源:SimpleDi.php
示例15: CheckBack
public function CheckBack(&$headers)
{
if (substr($headers, 9, 3) == '416') {
html_error('[google_com.php] Plugin needs a fix, \'Range\' method is not working.');
}
if (stripos($headers, "\nTransfer-Encoding: chunked") !== false) {
global $fp, $sFilters;
if (empty($fp) || !is_resource($fp)) {
html_error('Error: Your rapidleech copy is outdated and it doesn\'t support functions required by this plugin.');
}
if (!in_array('dechunk', stream_get_filters())) {
html_error('Error: dechunk filter not available, cannot download chunked file.');
}
if (!isset($sFilters) || !is_array($sFilters)) {
$sFilters = array();
}
if (empty($sFilters['dechunk'])) {
$sFilters['dechunk'] = stream_filter_append($fp, 'dechunk', STREAM_FILTER_READ);
}
if (!$sFilters['dechunk']) {
html_error('Error: Unknown error while initializing dechunk filter, cannot download chunked file.');
}
// Little hack to get the filesize.
$headers = preg_replace('@\\nContent-Range\\: bytes 0-\\d+/@i', "\nContent-Length: ", $headers, 1);
}
}
开发者ID:SheppeR,项目名称:rapidleech,代码行数:26,代码来源:google_com.php
示例16: getFilters
/**
* Returns a list of filters
*
* @return array
*
* @since 11.1
*/
function getFilters()
{
// Note: This will look like the getSupported() function with J! filters.
// TODO: add user space filter loading like user space stream loading
return stream_get_filters();
}
开发者ID:Radek-Suski,项目名称:joomla-platform,代码行数:13,代码来源:helper.php
示例17: var_dump
<?php
var_dump(stream_get_filters("a"));
var_dump(stream_filter_register());
var_dump(stream_filter_append());
var_dump(stream_filter_prepend());
var_dump(stream_filter_remove());
var_dump(stream_bucket_make_writeable());
var_dump(stream_bucket_append());
var_dump(stream_bucket_prepend());
开发者ID:badlamer,项目名称:hhvm,代码行数:10,代码来源:user_filter_errors.php
示例18: EncodeQP
public function EncodeQP($string, $line_max = 76, $space_conv = false)
{
if (function_exists('quoted_printable_encode')) {
return quoted_printable_encode($string);
}
$filters = stream_get_filters();
if (!in_array('convert.*', $filters)) {
return $this->EncodeQPphp($string, $line_max, $space_conv);
}
$fp = fopen('php://temp/', 'r+');
$string = preg_replace('/\\r\\n?/', $this->LE, $string);
$params = array('line-length' => $line_max, 'line-break-chars' => $this->LE);
$s = stream_filter_append($fp, 'convert.quoted-printable-encode', STREAM_FILTER_READ, $params);
fputs($fp, $string);
rewind($fp);
$out = stream_get_contents($fp);
stream_filter_remove($s);
$out = preg_replace('/^\\./m', '=2E', $out);
fclose($fp);
return $out;
}
开发者ID:pengweifu,项目名称:myConfigFiles,代码行数:21,代码来源:Mail.class.php
示例19: CheckBack
public function CheckBack($header)
{
$statuscode = intval(substr($header, 9, 3));
if ($statuscode != 200) {
switch ($statuscode) {
case 509:
html_error('[Mega_co_nz] Transfer quota exeeded.');
case 503:
html_error('[Mega_co_nz] Too many connections for this download.');
case 403:
html_error('[Mega_co_nz] Link used/expired.');
case 404:
html_error('[Mega_co_nz] Link expired.');
default:
html_error('[Mega_co_nz][HTTP] ' . trim(substr($header, 9, strpos($header, "\n") - 8)));
}
}
global $fp, $sFilters;
if (empty($fp) || !is_resource($fp)) {
html_error("Error: Your rapidleech version is outdated and it doesn't support this plugin.");
}
if (!empty($_GET['T8']['fkey'])) {
$key = $this->base64_to_a32(urldecode($_GET['T8']['fkey']));
} elseif (preg_match('@^(T8|N)?!([^!]{8})!([\\w\\-\\,]{43})@i', parse_url($_GET['referer'], PHP_URL_FRAGMENT), $dat)) {
$key = $this->base64_to_a32($dat[2]);
} else {
html_error("[CB] File's key not found.");
}
$iv = array_merge(array_slice($key, 4, 2), array(0, 0));
$key = array($key[0] ^ $key[4], $key[1] ^ $key[5], $key[2] ^ $key[6], $key[3] ^ $key[7]);
$opts = array('iv' => $this->a32_to_str($iv), 'key' => $this->a32_to_str($key), 'mode' => 'ctr');
if (!stream_filter_register('MegaDlDecrypt', 'Th3822_MegaDlDecrypt') && !in_array('MegaDlDecrypt', stream_get_filters())) {
html_error('Error: Cannot register "MegaDlDecrypt" filter.');
}
if (!isset($sFilters) || !is_array($sFilters)) {
$sFilters = array();
}
if (empty($sFilters['MegaDlDecrypt'])) {
$sFilters['MegaDlDecrypt'] = stream_filter_prepend($fp, 'MegaDlDecrypt', STREAM_FILTER_READ, $opts);
}
if (!$sFilters['MegaDlDecrypt']) {
html_error('Error: Unknown error while initializing MegaDlDecrypt filter, cannot continue download.');
}
}
开发者ID:Transcodes,项目名称:rapidleech,代码行数:44,代码来源:mega_co_nz.php
示例20: var_dump
<?php
var_dump(in_array('string.rot13', stream_get_filters()));
开发者ID:badlamer,项目名称:hhvm,代码行数:3,代码来源:stream_get_filters.php
注:本文中的stream_get_filters函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论