当前位置: 首页>>代码示例>>PHP>>正文


PHP stream_get_wrappers函数代码示例

本文整理汇总了PHP中stream_get_wrappers函数的典型用法代码示例。如果您正苦于以下问题:PHP stream_get_wrappers函数的具体用法?PHP stream_get_wrappers怎么用?PHP stream_get_wrappers使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了stream_get_wrappers函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setUp

 protected function setUp()
 {
     if (in_array('sfImageSource', stream_get_wrappers())) {
         stream_wrapper_unregister('sfImageSource');
     }
     stream_wrapper_register('sfImageSource', 'sfImageSourceMock') or die('Failed to register protocol..');
 }
开发者ID:robo47,项目名称:sfImageTransformExtraPlugin,代码行数:7,代码来源:sfImageSourceMockTest.php

示例2: writeFile

 /**
  * Write content to file
  * @param string $path
  * @param string $content
  */
 protected function writeFile($path, $content)
 {
     if (!in_array(SafeStream::PROTOCOL, stream_get_wrappers())) {
         SafeStream::register();
     }
     file_put_contents("safe://" . $path, $content);
 }
开发者ID:janmarek,项目名称:Neuron,代码行数:12,代码来源:Feed.php

示例3: __construct

 /**
  * Creates an ImportXMLReader drawing from the source provided
  * @param ImportSource $source
  * @param Config $config
  */
 function __construct(ImportSource $source, Config $config = null)
 {
     $this->reader = new XMLReader();
     if (!$config) {
         wfDeprecated(__METHOD__ . ' without a Config instance', '1.25');
         $config = ConfigFactory::getDefaultInstance()->makeConfig('main');
     }
     $this->config = $config;
     if (!in_array('uploadsource', stream_get_wrappers())) {
         stream_wrapper_register('uploadsource', 'UploadSourceAdapter');
     }
     $id = UploadSourceAdapter::registerSource($source);
     if (defined('LIBXML_PARSEHUGE')) {
         $this->reader->open("uploadsource://{$id}", null, LIBXML_PARSEHUGE);
     } else {
         $this->reader->open("uploadsource://{$id}");
     }
     // Default callbacks
     $this->setPageCallback(array($this, 'beforeImportPage'));
     $this->setRevisionCallback(array($this, "importRevision"));
     $this->setUploadCallback(array($this, 'importUpload'));
     $this->setLogItemCallback(array($this, 'importLogItem'));
     $this->setPageOutCallback(array($this, 'finishImportPage'));
     $this->importTitleFactory = new NaiveImportTitleFactory();
 }
开发者ID:eliagbayani,项目名称:LiteratureEditor,代码行数:30,代码来源:Import.php

示例4: __construct

 /**
  * Constructor
  *
  * @param string $streamWrapperClassName
  */
 public function __construct($streamWrapperClassName)
 {
     $registered = in_array(self::WRAPPER, stream_get_wrappers());
     if (!$registered) {
         stream_wrapper_register(self::WRAPPER, $streamWrapperClassName);
     }
 }
开发者ID:fracasula,项目名称:phpsandboxbundle,代码行数:12,代码来源:PhpSandbox.php

示例5: __construct

    function __construct()
    {
        parent::__construct();
        $gz = in_array('compress.zlib', stream_get_wrappers()) ? 'ok' : '(disabled; requires PHP zlib module)';
        $bz2 = in_array('compress.bzip2', stream_get_wrappers()) ? 'ok' : '(disabled; requires PHP bzip2 module)';
        $this->mDescription = <<<TEXT
This script reads pages from an XML file as produced from Special:Export or
dumpBackup.php, and saves them into the current wiki.

Compressed XML files may be read directly:
  .gz {$gz}
  .bz2 {$bz2}
  .7z (if 7za executable is in PATH)

Note that for very large data sets, importDump.php may be slow; there are
alternate methods which can be much faster for full site restoration:
<https://www.mediawiki.org/wiki/Manual:Importing_XML_dumps>
TEXT;
        $this->stderr = fopen("php://stderr", "wt");
        $this->addOption('report', 'Report position and speed after every n pages processed', false, true);
        $this->addOption('namespaces', 'Import only the pages from namespaces belonging to the list of ' . 'pipe-separated namespace names or namespace indexes', false, true);
        $this->addOption('dry-run', 'Parse dump without actually importing pages');
        $this->addOption('debug', 'Output extra verbose debug information');
        $this->addOption('uploads', 'Process file upload data if included (experimental)');
        $this->addOption('no-updates', 'Disable link table updates. Is faster but leaves the wiki in an inconsistent state');
        $this->addOption('image-base-path', 'Import files from a specified path', false, true);
        $this->addArg('file', 'Dump file to import [else use stdin]', false);
    }
开发者ID:xfstudio,项目名称:mediawiki,代码行数:28,代码来源:importDump.php

示例6: unregisterWrapper

 public static function unregisterWrapper()
 {
     $existed = in_array('stack', stream_get_wrappers());
     if ($existed) {
         stream_wrapper_unregister('stack');
     }
 }
开发者ID:febryantosulistyo,项目名称:ClassicSocial,代码行数:7,代码来源:Stack.php

示例7: unregister

 /**
  * unregisters vfsStreamWrapper
  */
 public static function unregister()
 {
     if (in_array(vfsStream::SCHEME, stream_get_wrappers()) === true) {
         stream_wrapper_unregister(vfsStream::SCHEME);
     }
     self::$registered = false;
 }
开发者ID:oalkhanishvili,项目名称:track2,代码行数:10,代码来源:vfsStreamWrapperAlreadyRegisteredTestCase.php

示例8: register

 public static function register()
 {
     if (in_array('phpspec', stream_get_wrappers())) {
         stream_wrapper_unregister('phpspec');
     }
     stream_wrapper_register('phpspec', 'PhpSpec\\Loader\\StreamWrapper');
 }
开发者ID:focuslife,项目名称:v0.1,代码行数:7,代码来源:StreamWrapper.php

示例9: __construct

 /**
  * HubUpdater constructor.
  * @param array|string $option
  * @throws \Exception
  */
 public function __construct($option)
 {
     if (!in_array('https', stream_get_wrappers())) {
         throw new \Exception("No HTTPS Wrapper Exception");
     }
     $this->setOptions($option);
     $this->options['save'] = rtrim($this->options['save'], '/');
     if ($this->options['save'] !== '') {
         $this->options['save'] .= '/';
         if (!file_exists($this->options['save'])) {
             mkdir($this->options['save']);
         }
     }
     $this->options['cache'] = $this->options['save'] . rtrim($this->options['cache'], '/');
     if ($this->options['cache'] !== '') {
         $this->options['cache'] .= '/';
         if (!file_exists($this->options['cache'])) {
             mkdir($this->options['cache']);
         }
     }
     $this->cachedInfo = new CacheOneFile($this->options['cache'] . $this->options['cacheFile'], $this->options['holdTime']);
     $additionalHeader = '';
     if ($this->options['auth']) {
         $additionalHeader .= "Authorization: Basic " . base64_encode($this->options['auth']) . "\r\n";
     }
     $caFilePath = CaBundle::getSystemCaRootBundlePath();
     $this->streamContext = stream_context_create(array('http' => array('header' => "User-Agent: Awesome-Update-My-Self-" . $this->options['name'] . "\r\n" . "Accept: application/vnd.github.v3+json\r\n" . $additionalHeader), 'ssl' => array('cafile' => $caFilePath, 'verify_peer' => true)));
     $this->streamContext2 = stream_context_create(array('http' => array('header' => "User-Agent: Awesome-Update-My-Self-" . $this->options['name'] . "\r\n" . $additionalHeader), 'ssl' => array('cafile' => $caFilePath, 'verify_peer' => true)));
     $this->allRelease = $this->getRemoteInfo();
 }
开发者ID:kanti,项目名称:hub-updater,代码行数:35,代码来源:HubUpdater.php

示例10: __construct

 /**
  * TODO don't hardcode pool, use params
  * TODO check rados extensions are available
  * @param $params
  */
 public function __construct($params)
 {
     $this->pool = 'owncloud';
     if (!in_array("rados", stream_get_wrappers())) {
         stream_wrapper_register("rados", '\\OCA\\Rados\\RadosStream');
     }
 }
开发者ID:MrRagga-,项目名称:rados,代码行数:12,代码来源:radosstore.php

示例11: register

 /**
  * Register the GridFS stream wrapper.
  */
 public static function register()
 {
     if (in_array('gridfs', stream_get_wrappers())) {
         stream_wrapper_unregister('gridfs');
     }
     stream_wrapper_register('gridfs', get_called_class(), \STREAM_IS_URL);
 }
开发者ID:researchgate,项目名称:mongo-php-library,代码行数:10,代码来源:StreamWrapper.php

示例12: __construct

 /**
  * Constructs CustomURIResolver from scheme prefix string (e.g. "arg" or "http").
  * @param string $scheme Scheme prefix string
  */
 function __construct($scheme)
 {
     $this->scheme = $scheme;
     if (!in_array($scheme, stream_get_wrappers())) {
         stream_wrapper_register($scheme, "StringStream") or die("Failed to register '" . $scheme . "'");
     }
 }
开发者ID:tejdeeps,项目名称:tejcs.com,代码行数:11,代码来源:URIResolver.class.php

示例13: get_last_log

function get_last_log($path = '')
{
    global $config_logfile_maxsize, $neue_datei, $log_file_number, $config_log_zlib;
    $name = split_log_name();
    $ext = $name['ext'];
    $name = $name['name'];
    $i = 0;
    $neue_datei = false;
    while (is_file($path . $name . $i . $ext) || is_file($path . $name . $i . $ext . '.gz')) {
        $i++;
    }
    $i--;
    @($log_size = filesize($path . $name . $i . $ext) / 1000);
    if (!is_dir(dirname($path . $name))) {
        return false;
    }
    if ($i == -1 || $config_logfile_maxsize !== false && $log_size >= $config_logfile_maxsize) {
        if ($config_log_zlib && in_array('compress.zlib', stream_get_wrappers())) {
            // compress old file
            $fh_compressed = fopen('compress.zlib://' . $path . $name . $i . $ext . '.gz', 'w');
            fwrite($fh_compressed, file_get_contents($path . $name . $i . $ext));
            fclose($fh_compressed);
            unlink($path . $name . $i . $ext);
        }
        $i++;
        $neue_log = fopen($path . $name . $i . $ext, 'w');
        fclose($neue_log);
        $neue_datei = true;
    }
    $log_file_number = $i;
    return $path . $name . $i . $ext;
}
开发者ID:ninux-fi,项目名称:monitoring_scripts,代码行数:32,代码来源:log_funcs.php

示例14: 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());
 }
开发者ID:mheydt,项目名称:scalr,代码行数:11,代码来源:StreamAdapter.php

示例15: unregisterWhenNotRegistered

 /**
  * Unregistering while not registers won't fail.
  *
  * @test
  */
 public function unregisterWhenNotRegistered()
 {
     // Unregister possible registered URL wrapper.
     vfsStreamWrapper::unregister();
     $this->assertNotContains(vfsStream::SCHEME, stream_get_wrappers());
     vfsStreamWrapper::unregister();
 }
开发者ID:kdambekalns,项目名称:vfsStream,代码行数:12,代码来源:vfsStreamWrapperUnregisterTestCase.php


注:本文中的stream_get_wrappers函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。