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


PHP RecursiveIteratorIterator::getPathName方法代码示例

本文整理汇总了PHP中RecursiveIteratorIterator::getPathName方法的典型用法代码示例。如果您正苦于以下问题:PHP RecursiveIteratorIterator::getPathName方法的具体用法?PHP RecursiveIteratorIterator::getPathName怎么用?PHP RecursiveIteratorIterator::getPathName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在RecursiveIteratorIterator的用法示例。


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

示例1: rmdir

 /**
  * Remove recursively the directory named by dirname.
  *
  * @param string $dirname       Path to the directory
  * @param boolean $followLinks  Removes symbolic links if set to true
  * @return boolean              True if success otherwise false
  * @throws Exception            When the directory does not exist or permission denied
  */
 public static function rmdir($dirname, $followLinks = false)
 {
     if (!is_dir($dirname) && !is_link($dirname)) {
         throw new Exception(sprintf('Directory %s does not exist', $dirname));
     }
     if (!is_writable($dirname)) {
         throw new Exception('You do not have renaming permissions');
     }
     $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dirname), RecursiveIteratorIterator::CHILD_FIRST);
     while ($iterator->valid()) {
         if (!$iterator->isDot()) {
             if (!$iterator->isWritable()) {
                 throw new Exception(sprintf('Permission denied for %s', $iterator->getPathName()));
             }
             if ($iterator->isLink() && false === (bool) $followLinks) {
                 $iterator->next();
                 continue;
             }
             if ($iterator->isFile()) {
                 unlink($iterator->getPathName());
             } else {
                 if ($iterator->isDir()) {
                     rmdir($iterator->getPathName());
                 }
             }
         }
         $iterator->next();
     }
     unset($iterator);
     return rmdir($dirname);
 }
开发者ID:rom1git,项目名称:Centurion,代码行数:39,代码来源:System.php

示例2: recursive_rmdir

 private function recursive_rmdir($dirname, $followLinks = false)
 {
     if (is_dir($dirname) && !is_link($dirname)) {
         if (!is_writable($dirname)) {
             throw new Exception('You do not have renaming permissions!');
         }
         $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dirname), RecursiveIteratorIterator::CHILD_FIRST);
         while ($iterator->valid()) {
             if (!$iterator->isDot()) {
                 if (!$iterator->isWritable()) {
                     throw new Exception(sprintf('Permission Denied: %s.', $iterator->getPathName()));
                 }
                 if ($iterator->isLink() && false === (bool) $followLinks) {
                     $iterator->next();
                 }
                 if ($iterator->isFile()) {
                     unlink($iterator->getPathName());
                 } else {
                     if ($iterator->isDir()) {
                         rmdir($iterator->getPathName());
                     }
                 }
             }
             $iterator->next();
         }
         unset($iterator);
         // Fix for Windows.
         return rmdir($dirname);
     } else {
         throw new Exception(sprintf('Directory %s does not exist!', $dirname));
     }
 }
开发者ID:jadnx,项目名称:VulnerabilityAssessmentWebTool,代码行数:32,代码来源:FileManagerModel.php

示例3: _recursive_rmdir

 /**
  * Attempts to remove recursively the directory named by dirname.
  *
  * @author Mehdi Kabab <http://pioupioum.fr>
  * @copyright Copyright (C) 2009 Mehdi Kabab
  * @license http://www.gnu.org/licenses/gpl.html  GNU GPL version 3 or later
  *
  * @param	string	$dirname		Path to the directory.
  * @return	null
  */
 private function _recursive_rmdir($dirname)
 {
     if (is_dir($dirname) && !is_link($dirname)) {
         $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($dirname), \RecursiveIteratorIterator::CHILD_FIRST);
         while ($iterator->valid()) {
             if (!$iterator->isDot()) {
                 if ($iterator->isFile()) {
                     unlink($iterator->getPathName());
                 } else {
                     if ($iterator->isDir()) {
                         rmdir($iterator->getPathName());
                     }
                 }
             }
             $iterator->next();
         }
         unset($iterator);
         // Fix for Windows.
         rmdir($dirname);
     }
 }
开发者ID:rmcgirr83,项目名称:ext-phpbb-directory,代码行数:31,代码来源:v1_0_0.php

示例4: UnlinkDPL

function UnlinkDPL()
{
    global $TopDirectory;
    try {
        $TopDirectoryCnt = count($TopDirectory);
        //print "TopDirectoryCnt: " . $TopDirectoryCnt . $NL;
        foreach ($TopDirectory as $Dir => $RM) {
            $it = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($Dir));
            while ($it->valid()) {
                if ($it->isFile()) {
                    $ext = pathinfo($it->current(), PATHINFO_EXTENSION);
                    if ($ext == "dpl") {
                        unlink($it->getPathName());
                    }
                }
                $it->next();
            }
        }
    } catch (Exception $e) {
        echo $e->getMessage();
    }
}
开发者ID:HenrikTolboel,项目名称:LinnDS-jukebox,代码行数:22,代码来源:FileUtils.php

示例5: RecursiveRmdir

 /**
  * Recursively remove a directory
  *
  * @param string $dirname
  * @param boolean $followSymlinks
  * @return boolean
  */
 function RecursiveRmdir($dirname, $followSymlinks = false)
 {
     if (is_dir($dirname) && !is_link($dirname)) {
         if (!is_writable($dirname)) {
             throw new \Exception(sprintf('%s is not writable!', $dirname));
         }
         $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($dirname), \RecursiveIteratorIterator::CHILD_FIRST);
         while ($iterator->valid()) {
             if (!$iterator->isDot()) {
                 if (!$iterator->isWritable()) {
                     throw new \Exception(sprintf('%s is not writable!', $iterator->getPathName()));
                 }
                 if ($iterator->isLink() && $followLinks === false) {
                     $iterator->next();
                 }
                 if ($iterator->isFile()) {
                     @unlink($iterator->getPathName());
                 } elseif ($iterator->isDir()) {
                     @rmdir($iterator->getPathName());
                 }
             }
             $iterator->next();
         }
         unset($iterator);
         return @rmdir($dirname);
     } else {
         throw new \Exception(sprintf('%s does not exist!', $dirname));
     }
 }
开发者ID:BionicClick,项目名称:PHPoole,代码行数:36,代码来源:phpoole.php

示例6: Phar

$pharFilename = "bin/{$binary}.phar";
$binaryFilename = "bin/{$binary}";
if (file_exists($pharFilename)) {
    Phar::unlinkArchive($pharFilename);
}
if (file_exists($binaryFilename)) {
    Phar::unlinkArchive($binaryFilename);
}
$phar = new Phar($pharFilename, FilesystemIterator::KEY_AS_PATHNAME | FilesystemIterator::CURRENT_AS_FILEINFO, $binary);
$phar->startBuffering();
$directories = array('src', 'vendor', 'scripts');
foreach ($directories as $dirname) {
    $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dirname));
    while ($iterator->valid()) {
        if ($iterator->isFile()) {
            $path = $iterator->getPathName();
            if ('php' == strtolower($iterator->getExtension())) {
                $contents = php_strip_whitespace($path);
                $phar->addFromString($path, $contents);
            } else {
                $phar->addFile($path);
            }
        }
        $iterator->next();
    }
}
$stub = "#!/usr/bin/env php\n" . $phar->createDefaultStub($scriptFilename);
$phar->setStub($stub);
$phar->compressFiles(Phar::GZ);
$phar->stopBuffering();
rename($pharFilename, $binaryFilename);
开发者ID:gamegos,项目名称:php-code-sniffer,代码行数:31,代码来源:create-phar.php

示例7: MakePlaylists

function MakePlaylists($TopDirectory)
{
    global $NL;
    $Cnt = 0;
    $DirPlaylist = new Playlist();
    try {
        foreach ($TopDirectory as $Dir => $RootMenuNo) {
            $it = new RecursiveIteratorIterator(new RecursiveDirectoryReader($Dir), RecursiveIteratorIterator::SELF_FIRST);
            while ($it->valid()) {
                //echo $it->getPathName().$NL;
                if ($DirPlaylist->PlaylistDir($it->getPathName())) {
                    $Cnt++;
                }
                $it->next();
            }
        }
    } catch (Exception $e) {
        echo 'No files Found!' . $NL;
    }
    return $Cnt;
}
开发者ID:HenrikTolboel,项目名称:LinnDS-jukebox,代码行数:21,代码来源:MakePlaylists.php

示例8: Main

function Main($DoLevel)
{
    global $NL;
    global $RootMenu;
    global $SubMenuType;
    global $TopDirectory;
    global $AppDir;
    global $DATABASE_FILENAME;
    $AppDir = "site/";
    if (!file_exists($AppDir . "folder")) {
        mkdir($AppDir . "folder");
    }
    if (!file_exists($AppDir . "sprites")) {
        mkdir($AppDir . "sprites");
    }
    $NumNewPlaylists = 0;
    //Create a didl file in each directory containing music
    if ($DoLevel > 3) {
        echo "Removing old .dpl files" . $NL;
        UnlinkDPL();
    }
    echo "Making a didl file in each directory..." . $NL;
    $NumNewPlaylists = MakePlaylists($TopDirectory);
    echo " - found {$NumNewPlaylists} new playlists" . $NL;
    unlink($DATABASE_FILENAME);
    $musicDB = new MusicDB();
    echo "Find all didl files and add to Menu tree..." . $NL;
    // Find all didl files and add it to the menus
    try {
        CreateAllGreyImgs($musicDB->MaxPreset());
        foreach ($TopDirectory as $Dir => $RootMenuNo) {
            $it = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($Dir));
            while ($it->valid()) {
                if ($it->isFile()) {
                    $ext = pathinfo($it->current(), PATHINFO_EXTENSION);
                    if ($ext == "xml") {
                        $didl = new DIDL_Album($it->getPathName(), $RootMenuNo);
                        $rowid = $musicDB->CheckURLExist($didl->URI());
                        if ($rowid === false) {
                            $rowid = Make_Album($didl, $musicDB);
                            Make_Tracks($didl, $musicDB);
                            //$didl->dump();
                        } else {
                            $didl->SetSequenceNo($rowid);
                        }
                        CollectFolderImgs($didl);
                        echo ".";
                    }
                }
                $it->next();
            }
        }
    } catch (Exception $e) {
        echo $e->getMessage();
    }
    copy("index.php", $AppDir . "index.php");
    copy("html_parts.php", $AppDir . "html_parts.php");
    copy("actions.js", $AppDir . "actions.js");
    copy("musik.css", $AppDir . "musik.css");
    copy("LinnDS-jukebox-daemon.php", $AppDir . "LinnDS-jukebox-daemon.php");
    copy("ServerState.php", $AppDir . "ServerState.php");
    copy("LPECClientSocket.php", $AppDir . "LPECClientSocket.php");
    copy("LinnDSClientSocket.php", $AppDir . "LinnDSClientSocket.php");
    copy("StringUtils.php", $AppDir . "StringUtils.php");
    copy("SocketServer.php", $AppDir . "SocketServer.php");
    copy("LinnDS-jukebox-daemon-old.php", $AppDir . "LinnDS-jukebox-daemon-old.php");
    copy("S98linn_lpec", $AppDir . "S98linn_lpec");
    copy("Transparent.gif", $AppDir . "Transparent.gif");
    copy("setup.php", $AppDir . "setup.php");
    copy("Send.php", $AppDir . "Send.php");
    copy("MusicDB.php", $AppDir . "MusicDB.php");
    copy("QueryAlbum.php", $AppDir . "QueryAlbum.php");
    copy("QueryAlbumList.php", $AppDir . "QueryAlbumList.php");
    copy("QueryAlphabetPresent.php", $AppDir . "QueryAlphabetPresent.php");
    copy("QueryDB.php", $AppDir . "QueryDB.php");
    copy("QueryPlayingNowDB.php", $AppDir . "QueryPlayingNowDB.php");
    echo "Making sprites and css file in " . $AppDir . $NL;
    Make_CSS($musicDB->MaxPreset(), $AppDir . "sprites/sprites.css", $AppDir . "sprites/sprites@2x.css");
    $musicDB->close();
    copy($DATABASE_FILENAME, $AppDir . $DATABASE_FILENAME);
    echo "Finished..." . $NL;
}
开发者ID:HenrikTolboel,项目名称:LinnDS-jukebox,代码行数:82,代码来源:Build.php


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