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


PHP FileUtils类代码示例

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


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

示例1: testRandomFromFolderWithFoldersNoMtime

 function testRandomFromFolderWithFoldersNoMtime()
 {
     $count = 0;
     $another_count = 0;
     $css_count = 0;
     $ext_count = 0;
     $test_count = 0;
     for ($i = 0; $i < 30; $i++) {
         $result = FileUtils::randomFromFolder("/" . FRAMEWORK_CORE_PATH . "tests/io/test_dir/content_dir/", false, true);
         $this->assertNotNull($result);
         if ($result == "/" . FRAMEWORK_CORE_PATH . "tests/io/test_dir/content_dir/another_dir/") {
             $another_count += 1;
         }
         if ($result == "/" . FRAMEWORK_CORE_PATH . "tests/io/test_dir/content_dir/css_test.css") {
             $css_count += 1;
         }
         if ($result == "/" . FRAMEWORK_CORE_PATH . "tests/io/test_dir/content_dir/ext_test.plug.txt") {
             $ext_count += 1;
         }
         if ($result == "/" . FRAMEWORK_CORE_PATH . "tests/io/test_dir/content_dir/test_file.txt") {
             $test_count += 1;
         }
         $sum = $another_count + $css_count + $ext_count + $test_count;
         $this->assertTrue($count == $sum - 1);
         $count += 1;
     }
 }
开发者ID:mbcraft,项目名称:frozen,代码行数:27,代码来源:file_utils_test.php

示例2: after_create

 public function after_create()
 {
     UserMailer::deliver_new_user($this->email, $this);
     $path = FileUtils::join(NIMBLE_ROOT, 'get', $this->username);
     FileUtils::mkdir_p($path);
     chmod($path, 0755);
 }
开发者ID:xetorthio,项目名称:pearfarm_channel_server,代码行数:7,代码来源:user.php

示例3: clearCacheDir

 protected static function clearCacheDir($path)
 {
     if (is_dir($path)) {
         return FileUtils::rrmdir($path);
     }
     return true;
 }
开发者ID:Athorcis,项目名称:athorrent-frontend,代码行数:7,代码来源:CacheUtils.php

示例4: loadDir

 public static function loadDir($path)
 {
     $files = FileUtils::getFilesForDirectory($path);
     foreach ($files as $file) {
         self::loadFile($path . DIRECTORY_SEPARATOR . $file);
     }
 }
开发者ID:amptools-net,项目名称:midori-php,代码行数:7,代码来源:Tab.php

示例5: __construct

 protected function __construct()
 {
     $this->array = ArrayUtils::instance();
     $this->file = FileUtils::instance();
     $this->object = ObjectUtils::instance();
     $this->string = StringUtils::instance();
 }
开发者ID:patxi1980,项目名称:utilities,代码行数:7,代码来源:Utils.php

示例6: uploadWare

 function uploadWare($file, $fields)
 {
     $rs = FileUtils::UpWare($file, true);
     if ($rs != false) {
         $fields['title'] = $rs;
     }
     $this->_dbmaterials->create($fields);
 }
开发者ID:ChenXL581X,项目名称:distributedcourse,代码行数:8,代码来源:MaterialsOperation.php

示例7: _deleteTempAvatarFiles

 private function _deleteTempAvatarFiles($uid)
 {
     $files = $this->_getTempAvatarFiles($uid);
     $path = UploadUtils::getTempAvatarPath();
     foreach ($files as $fileName) {
         FileUtils::safeDeleteFile($path . '/' . $fileName);
     }
 }
开发者ID:frogoscar,项目名称:mobcent-discuz,代码行数:8,代码来源:SaveAvatarAction.php

示例8: __destruct

 public function __destruct()
 {
     try {
         FileUtils::removeDirectory($this->path, true);
     } catch (BaseException $e) {
         // boo! deal with garbage yourself.
     }
 }
开发者ID:onphp-framework,项目名称:onphp-framework,代码行数:8,代码来源:TempDirectory.class.php

示例9: getItemsTable

 public function getItemsTable($pageNumber, $num, $response, $key, $valueToSearch)
 {
     $mainTag = new Div();
     $tdNum = 3;
     $tdNumTotal = $tdNum * 2 - 1;
     $indOnPage = 0;
     $items = 0;
     $td = 0;
     $item = new Item();
     $rowIndex = 1;
     $tdHeight = Utils::isSquareViewMode() ? 300 : 30;
     $highLightId = Utils::getFromGET(UrlParameters::HIGH_LIGHT_ELEMENT);
     $isMetro = array_key_exists(UrlParameters::VIEW_MODE, $_GET) && Utils::getFromGET(UrlParameters::VIEW_MODE) == "metro" || !array_key_exists(UrlParameters::VIEW_MODE, $_GET);
     $isCompact = array_key_exists(UrlParameters::VIEW_MODE, $_GET) && Utils::getFromGET(UrlParameters::VIEW_MODE) == "compact";
     $isExtend = array_key_exists(UrlParameters::VIEW_MODE, $_GET) && Utils::getFromGET(UrlParameters::VIEW_MODE) == "extend";
     $isList = array_key_exists(UrlParameters::VIEW_MODE, $_GET) && Utils::getFromGET(UrlParameters::VIEW_MODE) == "list";
     $rowViewClass = $isCompact ? 'compact' : ($isMetro ? "metro" : ($isExtend ? "extend" : ($isList ? "list" : "list")));
     if ($response != 0) {
         $mainTag->addStyleClass("items_table");
         $rowView = new Div();
         $mainTag->addChild($rowView);
         while ($row = mysql_fetch_array($response)) {
             $items++;
             $indOnPage++;
             $td++;
             if (ceil(fmod($indOnPage, $tdNum)) == 1) {
                 $rowIndex++;
                 $indOnPage = 1;
                 $td = 1;
             } elseif (Utils::isEven($td)) {
                 $td++;
             }
             $rowView->addStyleClass($rowViewClass);
             $cellView = new Div();
             $rowView->addChild($cellView);
             $keyItem = $row["key_item"];
             $images = FileUtils::getFilesByPrefixByDescription(Constants::DEFAULT_ROOT_CATALOG_PATH . DIRECTORY_SEPARATOR . $keyItem . DIRECTORY_SEPARATOR, Constants::MEDIUM_IMAGE, 'jpg');
             if (count($images) == 0) {
                 $capImage = FileUtils::getCapImage(Labels::CAP_IMAGE_FOR_CLOTHING);
                 $images = [$capImage];
             }
             $item = null;
             if ($isMetro) {
                 $item = Item::getMetroItemView($row["name"], $images, $row["key_item"], $pageNumber, $num, $key, $valueToSearch, $row['god_type'], Utils::formatClotheTitle($row["name"]), $highLightId == $row["key_item"]);
             } elseif ($isCompact) {
                 //$name, $images, $itemId, $pageNumber, $num, $key, $valueToSearch, $type, $trimName, $isHighLightElement
                 $item = Item::getCompactItemView($row["name"], $images, $row["key_item"], $pageNumber, $num, $key, $valueToSearch, $row['god_type'], Utils::formatClotheTitle($row["name"]), $highLightId == $row["key_item"]);
             } elseif ($isExtend) {
                 $item = Item::getSquareItemView($row["name"], $images, $row["key_item"], $pageNumber, $num, $key, $valueToSearch, $row['god_type'], Utils::formatClotheTitle($row["name"]));
             } elseif ($isList) {
                 $item = Item::getLineItemView($row["name"], $images, $row["key_item"], $pageNumber, $num, $key, $valueToSearch, $row['god_type'], Utils::trimFormatClotheTitle($row["name"]), $highLightId == $row["key_item"]);
             }
             $cellView->addChild($item);
             $cellView->addStyleClass("catalog_good_item");
         }
     }
     return $mainTag;
 }
开发者ID:gingerP,项目名称:shop,代码行数:58,代码来源:Items.php

示例10: clearOldFiles

function clearOldFiles()
{
    $files = FileUtils::getFiles("../tmpworksheets");
    foreach ($files as $fName) {
        if (filectime($fName) < time() - 1 * 60 * 60) {
            unlink($fName);
        }
    }
}
开发者ID:rivetweb,项目名称:old-yellowpages-grabber,代码行数:9,代码来源:HandleExportData.php

示例11: setUp

 public function setUp()
 {
     $dir = dirname(__FILE__);
     $this->nimble = Nimble::getINstance();
     Nimble::set_config('stylesheet_folder', FileUtils::join($dir, 'assets', 'stylesheets'));
     Nimble::set_config('stylesheet_folder_url', '/stylesheet');
     Nimble::set_config('javascript_folder', FileUtils::join($dir, 'assets', 'javascript'));
     Nimble::set_config('javascript_folder_url', '/javascript');
 }
开发者ID:scottdavis,项目名称:nimblize,代码行数:9,代码来源:TagHelperTest.php

示例12: about

 public function about()
 {
     $this->set_default_side_bar();
     require_once FileUtils::join(NIMBLE_ROOT, 'lib', 'markdown.php');
     $template = FileUtils::join(NIMBLE_ROOT, 'app', 'view', 'help', 'about.markdown');
     $this->about = file_get_contents($template);
     $this->title = 'About Pearfarm';
     Nimble::set_title($this->title);
 }
开发者ID:xetorthio,项目名称:pearfarm_channel_server,代码行数:9,代码来源:help_controller.php

示例13: saveBookletImage

 private static function saveBookletImage($bookletCode, $imageName, $base64Image)
 {
     $bookletImagesRoot = DBPreferencesType::getPreferenceS(Constants::BOOKLET_IMAGE_PATH);
     $bookletImageDirectory = FileUtils::buildPath($bookletImagesRoot, $bookletCode);
     FileUtils::createDir($bookletImageDirectory);
     $imageEditor = ImageEditor::newImageBase64($base64Image);
     $bookletImagePath = FileUtils::buildPath($bookletImagesRoot, $bookletCode, $imageName);
     $imageEditor->saveImage($bookletImagePath);
     return FileUtils::buildPath($bookletCode, $imageName);
 }
开发者ID:gingerP,项目名称:shop,代码行数:10,代码来源:BookletService.php

示例14: parse

 public static function parse(DOMNode $node)
 {
     if ($node->nodeName == self::getNodeName()) {
         if (($code = HTTPCode::getByCode(XMLUtils::getChildByName($node, "code")->nodeValue)) != null) {
             return new Error(FileUtils::getAbsolutePath(XMLUtils::getChildByName($node, "file")->nodeValue, VIEWS_FOLDER), $code);
         }
         throw new Exception("Unknown HTTP Code '" . XMLUtils::getChildByName($node, "code")->nodeValue . "'");
     }
     throw new Exception("Unexpected node '" . $node->nodeName . "', expected '" . self::getNodeName() . "'");
 }
开发者ID:pierrelemee,项目名称:star,代码行数:10,代码来源:Error.php

示例15: testUniqueNames

 public function testUniqueNames()
 {
     $uniqueName = FileUtils::makeUniqueName('Chasey Lain.jpeg');
     $this->assertEquals(substr($uniqueName, strpos($uniqueName, '.')), '.jpeg');
     $uniqueName = FileUtils::makeUniqueName('Елена Беркова.jpeg');
     $this->assertEquals(substr($uniqueName, strpos($uniqueName, '.')), '.jpeg');
     $uniqueName = FileUtils::makeUniqueLatinName('Елена Беркова.gif');
     //animated gif ;)
     $this->assertEquals(substr($uniqueName, strpos($uniqueName, '.')), '.gif');
 }
开发者ID:onphp-framework,项目名称:onphp-framework,代码行数:10,代码来源:FileUtilsTest.class.php


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