Server IP : 184.154.167.98 / Your IP : 3.142.199.54 Web Server : Apache System : Linux pink.dnsnetservice.com 4.18.0-553.22.1.lve.1.el8.x86_64 #1 SMP Tue Oct 8 15:52:54 UTC 2024 x86_64 User : puertode ( 1767) PHP Version : 7.2.34 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/puertode/public_html/contratos/3rdparty/icewind/streams/src/ |
Upload File : |
<?php /** * Copyright (c) 2015 Robin Appelman <icewind@owncloud.com> * This file is licensed under the Licensed under the MIT license: * http://opensource.org/licenses/MIT */ namespace Icewind\Streams; /** * Wrapper allows filtering of directories * * The filter callback will be called for each entry in the folder * when the callback return false the entry will be filtered out */ class DirectoryFilter extends DirectoryWrapper { /** * @var callable */ private $filter; /** * @param string $path * @param array $options * @return bool */ public function dir_opendir($path, $options) { $context = $this->loadContext('filter'); $this->filter = $context['filter']; return true; } /** * @return string */ public function dir_readdir() { $file = readdir($this->source); $filter = $this->filter; // keep reading untill we have an accepted entry or we're at the end of the folder while ($file !== false && $filter($file) === false) { $file = readdir($this->source); } return $file; } /** * @param resource $source * @param callable $filter * @return resource */ public static function wrap($source, callable $filter) { $options = array( 'filter' => array( 'source' => $source, 'filter' => $filter ) ); return self::wrapWithOptions($options, '\Icewind\Streams\DirectoryFilter'); } }