/** * Test... * * @covers Joomla\Filesystem\Helper::isJoomlaStream * * @return void */ public function testIsJoomlaStream() { $this->assertTrue(Helper::isJoomlaStream('String')); $this->assertFalse(Helper::isJoomlaStream('unknown')); }
/** * Determine the appropriate 'filename' of a file * * @param string $filename Original filename of the file * @param string $mode Mode string to retrieve the filename * @param boolean $use_prefix Controls the use of a prefix * @param boolean $relative Determines if the filename given is relative. Relative paths do not have JPATH_ROOT stripped. * * @return string * * @since 11.1 */ public function _getFilename($filename, $mode, $use_prefix, $relative) { if ($use_prefix) { // Get rid of binary or t, should be at the end of the string $tmode = trim($mode, 'btf123456789'); // Check if it's a write mode then add the appropriate prefix // Get rid of JPATH_ROOT (legacy compat) along the way if (in_array($tmode, Helper::getWriteModes())) { if (!$relative && $this->writeprefix) { $filename = str_replace(JPATH_ROOT, '', $filename); } $filename = $this->writeprefix . $filename; } else { if (!$relative && $this->readprefix) { $filename = str_replace(JPATH_ROOT, '', $filename); } $filename = $this->readprefix . $filename; } } return $filename; }