if ($meta === null) { $meta = MetaManager::getInstance()->getNewMetaDataInstance($this); } if ($meta === null) { throw new EyeNullPointerException('Unable to save listeners: no metadata support has been found for file ' . $file->getPath() . '.'); } $meta->set(self::METADATA_KEY_LISTENERS, $listeners); $this->setMeta($meta); } /** * @param VirtualFileMetaData $metaData The metadata to be associated * to the current object. */ public function setMeta(IMetaData $metaData = null) { if (!$metaData instanceof VirtualFileMetaData) { throw new EyeInvalidArgumentException('$metaData must be a VirtualFileMetaData.'); } if (!$this->exists()) { throw new EyeFileNotFoundException('Cannot set meta on the non-existing file ' . $this->path . '.'); } MetaManager::getInstance()->storeMeta($this, $metaData); } protected function setURLComponents(array $urlParts) { $this->urlParts = $urlParts; } } //we need to place this line here because the class EyeosAbstractVirtualFile must be defined before AdvancedPathLib::parse_url_registerFragment2PathProtocol(EyeosAbstractVirtualFile::$VirtualFileSchemes);
* version 3 along with this program in the file "LICENSE". If not, see * <http://www.gnu.org/licenses/agpl-3.0.txt>. * * See www.eyeos.org for more details. All requests should be sent to licensing@eyeos.org * * The interactive user interfaces in modified source and object code versions * of this program must display Appropriate Legal Notices, as required under * Section 5 of the GNU Affero General Public License version 3. * * In accordance with Section 7(b) of the GNU Affero General Public License version 3, * these Appropriate Legal Notices must retain the display of the "Powered by * eyeos" logo and retain the original copyright notice. If the display of the * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices * must display the words "Powered by eyeos" and retain the original copyright notice. */ AdvancedPathLib::parse_url_registerFragment2PathProtocol(array(EyeosAbstractVirtualFile::URL_SCHEME_SYSTEM)); /** * This class ... * * @package kernel-services * @subpackage FileSystem */ class EyeSysFile extends EyeosAbstractVirtualFile { /** * @param string $path The path to the file (MUST BE A VALID URL) * @param mixed $params Additional arguments (could be useful for derivated classes) * @throws EyeInvalidArgumentException * @throws EyeMissingArgumentException * @throws EyeNullPointerException */
* version 3 along with this program in the file "LICENSE". If not, see * <http://www.gnu.org/licenses/agpl-3.0.txt>. * * See www.eyeos.org for more details. All requests should be sent to licensing@eyeos.org * * The interactive user interfaces in modified source and object code versions * of this program must display Appropriate Legal Notices, as required under * Section 5 of the GNU Affero General Public License version 3. * * In accordance with Section 7(b) of the GNU Affero General Public License version 3, * these Appropriate Legal Notices must retain the display of the "Powered by * eyeos" logo and retain the original copyright notice. If the display of the * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices * must display the words "Powered by eyeos" and retain the original copyright notice. */ AdvancedPathLib::parse_url_registerFragment2PathProtocol(array('ftp', 'ftps')); /** * This class extends the GenericFile class to handle remote FTP files management. * * @package kernel-services * @subpackage FileSystem */ class FTPFile extends GenericFile { const CONNECTION_TIMEOUT = 90; const ANONYMOUS_USERNAME = '******'; const ANONYMOUS_PASSWORD = '******'; const DEFAULT_PORT = 21; /** * Connections pool for current HTTP request. * @var array(user:pass@IP_addr:port => resource)
public function testParse_url() { AdvancedPathLib::parse_url_registerFragment2PathProtocol(array('file', 'ftp', 'ftps')); $url = '/unix/like/path'; $this->assertEquals(array('scheme' => 'file', 'path' => '/unix/like/path'), AdvancedPathLib::parse_url($url, AdvancedPathLib::OS_UNIX)); $url = 'C:/windows/like/path'; $this->assertEquals(array('scheme' => 'file', 'path' => 'C:/windows/like/path'), AdvancedPathLib::parse_url($url, AdvancedPathLib::OS_WINDOWS)); $url = 'D:\\another\\windows\\like\\path'; $this->assertEquals(array('scheme' => 'file', 'path' => 'D:/another/windows/like/path'), AdvancedPathLib::parse_url($url, AdvancedPathLib::OS_WINDOWS)); $url = 'D:\\another\\windows\\like\\path\\myFile #2.ext'; $this->assertEquals(array('scheme' => 'file', 'path' => 'D:/another/windows/like/path/myFile #2.ext'), AdvancedPathLib::parse_url($url, AdvancedPathLib::OS_WINDOWS)); $url = 'ftp://eyeos.org/path/to/myFile.ext'; $this->assertEquals(array('scheme' => 'ftp', 'host' => 'eyeos.org', 'path' => '/path/to/myFile.ext'), AdvancedPathLib::parse_url($url)); $url = 'ftp://eyeos.org/path/to/myFile #1.ext'; $this->assertEquals(array('scheme' => 'ftp', 'host' => 'eyeos.org', 'path' => '/path/to/myFile #1.ext'), AdvancedPathLib::parse_url($url)); $url = 'home://eyeos.org/unknown/scheme/url'; $this->assertEquals(array('scheme' => 'home', 'host' => 'eyeos.org', 'path' => '/unknown/scheme/url'), AdvancedPathLib::parse_url($url)); $url = 'p34f://eyeos.org:34/another/unknown/../scheme/url/../'; $this->assertEquals(array('scheme' => 'p34f', 'host' => 'eyeos.org', 'port' => 34, 'path' => '/another/scheme'), AdvancedPathLib::parse_url($url)); $url = '/unix/like/path?with=query'; $this->assertEquals(array('scheme' => 'file', 'path' => '/unix/like/path', 'query' => 'with=query'), AdvancedPathLib::parse_url($url, AdvancedPathLib::OS_UNIX)); $url = 'http://eyeos.org/http/like/path?with=query#and-fragment'; $this->assertEquals(array('scheme' => 'http', 'host' => 'eyeos.org', 'path' => '/http/like/path', 'query' => 'with=query', 'fragment' => 'and-fragment'), AdvancedPathLib::parse_url($url)); $url = 'file://C:\\path'; $this->assertEquals(array('scheme' => 'file', 'path' => 'C:/path'), AdvancedPathLib::parse_url($url, AdvancedPathLib::OS_WINDOWS)); }