本文整理汇总了PHP中Folder::isWindowsPath方法的典型用法代码示例。如果您正苦于以下问题:PHP Folder::isWindowsPath方法的具体用法?PHP Folder::isWindowsPath怎么用?PHP Folder::isWindowsPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Folder
的用法示例。
在下文中一共展示了Folder::isWindowsPath方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dir
/**
* Directory Setter/Getter
*
* @param string $dir
* @throws Exception
* @return string|FileExplorer
*/
public function dir($dir = null)
{
if ($dir === null) {
return $this->_dir;
}
if (!is_string($dir)) {
throw new Exception('Invalid Argument');
}
//sanitize dir input
$dir = self::cleanDirname($dir);
$dir = self::slashTerm($dir);
if (Folder::isAbsolute($dir)) {
if (Folder::isWindowsPath($dir)) {
throw new Exception(__('Cannot use absolute windows path as directory'));
}
} else {
$dir = $this->_dir . $dir;
}
$this->_dir = $dir;
//TODO check if path has changed
$this->_Folder = $this->getFolder();
if (!$this->_Folder->pwd()) {
throw new Exception(__("Folder %s not found", $dir));
}
// reset contents
$this->_contents = null;
if ($this->autoLoadContents) {
$this->readContents();
}
return $this;
}
示例2: correctSlashFor
/**
* Returns a correct set of slashes for given $path. (\\ for Windows paths and / for other paths.)
*
* @param string $path Path to check
* @return string Set of slashes ("\\" or "/")
* @link http://book.cakephp.org/2.0/en/core-utility-libraries/file-folder.html#Folder::correctSlashFor
*/
public static function correctSlashFor($path)
{
return Folder::isWindowsPath($path) ? '\\' : '/';
}
示例3: __advancedFolderFind
private function __advancedFolderFind($conditions)
{
if (empty($this->fileList[0])) {
$this->return = array();
return true;
}
$i = 0;
foreach ($this->fileList[0] as $folder) {
if (in_array($folder, $this->ignore)) {
continue;
}
if ($this->recursive > -2) {
$Folder = new Folder($this->path . DS . $folder);
$this->return[$i]['Folder']['path'] = $Folder->path;
$this->return[$i]['Folder']['name'] = basename($this->return[$i]['Folder']['path']);
$this->return[$i]['Folder']['parent'] = dirname($this->return[$i]['Folder']['path']);
$this->return[$i]['Folder']['relative'] = $this->__relativePath($this->return[$i]['Folder']['path']);
$stat = stat($this->return[$i]['Folder']['path']);
$this->__fileStatus($i, $stat);
if ($this->recursive > -1) {
$this->return[$i]['Folder']['accessed'] = date('Y-m-d H:i:s', $stat['atime']);
$this->return[$i]['Folder']['modified'] = date('Y-m-d H:i:s', $stat['mtime']);
$this->return[$i]['Folder']['created'] = date('Y-m-d H:i:s', $stat['ctime']);
if ($this->recursive > 0) {
$this->return[$i]['Folder']['size'] = $Folder->dirsize();
$this->return[$i]['Folder']['absolute'] = $Folder->isAbsolute($this->return[$i]['Folder']['path']);
$children = $Folder->tree($this->return[$i]['Folder']['path']);
$this->return[$i]['Folder']['sub_folders'] = count($children[0]) - 1;
$this->return[$i]['Folder']['sub_files'] = count($children[1]);
if ($this->recursive > 1) {
$this->return[$i]['Folder']['realpath'] = $Folder->realpath($this->return[$i]['Folder']['path']);
$this->return[$i]['Folder']['windows'] = $Folder->isWindowsPath($this->return[$i]['Folder']['path']);
$this->return[$i]['Folder']['Children'] = $children;
$this->return[$i]['Folder']['Extended'] = $stat;
$i++;
continue;
}
$i++;
}
$i++;
}
$i++;
}
$i++;
}
return true;
}
示例4: testWindowsPath
/**
* testWindowsPath method
*
* @return void
*/
public function testWindowsPath()
{
$this->assertFalse(Folder::isWindowsPath('0:\\cake\\is\\awesome'));
$this->assertTrue(Folder::isWindowsPath('C:\\cake\\is\\awesome'));
$this->assertTrue(Folder::isWindowsPath('d:\\cake\\is\\awesome'));
$this->assertTrue(Folder::isWindowsPath('\\\\vmware-host\\Shared Folders\\file'));
}
示例5: correctSlashFor
/**
* Returns a correct set of slashes for given $path. (\\ for Windows paths and / for other paths.)
*
* @param string $path Path to check
* @return string Set of slashes ("\\" or "/")
* @access public
* @static
*/
function correctSlashFor($path) {
return (Folder::isWindowsPath($path)) ? '\\' : '/';
}
示例6: correctSlashFor
/**
* Returns a correct set of slashes for given $path. (\\ for Windows paths and / for other paths.)
*
* @param string $path Path to check
* @return string Set of slashes ("\\" or "/")
* @access public
* @static
*/
function correctSlashFor($path)
{
if (Folder::isWindowsPath($path)) {
return '\\';
}
return '/';
}
示例7: normalizePath
/**
* Returns a correct set of slashes for given $path. (\\ for Windows paths and / for other paths.)
*
* @param string $path Path to check
* @return string Set of slashes ("\\" or "/")
* @access public
* @static
*/
function normalizePath($path)
{
if (Folder::isWindowsPath($path)) {
return '\\';
}
return '/';
}
示例8: testWindowsPath
/**
* testWindowsPath method
*
* @access public
* @return void
*/
function testWindowsPath()
{
$this->assertFalse(Folder::isWindowsPath('0:\\cake\\is\\awesome'));
$this->assertTrue(Folder::isWindowsPath('C:\\cake\\is\\awesome'));
$this->assertTrue(Folder::isWindowsPath('d:\\cake\\is\\awesome'));
}
示例9: make
/**
* Parses instruction sets and invokes `Medium::make()` for a file
*
* @param Model $Model
* @param string $file Path to a file relative to `baseDirectory` or an absolute path to a file
* @return boolean
*/
function make(&$Model, $file, $overwrite = false)
{
extract($this->settings[$Model->alias]);
list($file, $relativeFile) = $this->_file($Model, $file);
$relativeDirectory = DS . rtrim(dirname($relativeFile), '.');
//small patch for windows..
if (Folder::isWindowsPath($filterDirectory)) {
$relativeDirectory = str_replace('/', '\\', $relativeDirectory);
}
$name = Medium::name($file);
$filter = Configure::read('Media.filter.' . strtolower($name));
$hasCallback = method_exists($Model, 'beforeMake');
foreach ($filter as $version => $instructions) {
$directory = Folder::slashTerm($filterDirectory . $version . $relativeDirectory);
$Folder = new Folder($directory, $createDirectory);
if (!$Folder->pwd()) {
$message = "MediaBehavior::make - Directory `{$directory}` ";
$message .= "could not be created or is not writable. ";
$message .= "Please check the permissions.";
trigger_error($message, E_USER_WARNING);
continue;
}
if ($hasCallback) {
$process = compact('overwrite', 'directory', 'name', 'version', 'instructions');
if ($Model->beforeMake($file, $process)) {
continue;
}
}
if (!($Medium = Medium::make($file, $instructions))) {
$message = "MediaBehavior::make - Failed to make version `{$version}` ";
$message .= "of file `{$file}`. ";
trigger_error($message, E_USER_WARNING);
continue;
}
$Medium->store($directory . basename($file), $overwrite);
}
return true;
}