本文整理汇总了PHP中FileUtil类的典型用法代码示例。如果您正苦于以下问题:PHP FileUtil类的具体用法?PHP FileUtil怎么用?PHP FileUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FileUtil类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: createFile
function createFile($title, $type, $content)
{
//生成文件
$File = new FileUtil();
$File->writetofile(BASE_PATH . 'upload/webstyle/public/' . $type . '/' . $title . '.' . $type, $content);
return $codeFilePath = '/manage/upload/webstyle/public/' . $type . '/' . $title . '.' . $type;
}
开发者ID:ahmatjan,项目名称:manage,代码行数:7,代码来源:add.php
示例2: getFolderInfo
/**
* 获取
* @Title: getFolderInfo
* @Description: todo(这里用一句话描述这个方法的作用)
*
* @param unknown $path
* @author quqiang
* @date 2015年5月18日 下午4:15:29
* @throws
*
*/
function getFolderInfo($path)
{
// 是否直接返回。true:内部调用,false:URL地址访问
$realyReturn = true;
if (!$path) {
$path = $_POST['path'];
$realyReturn = false;
}
// 得到所有能够编辑的文件列表
// 先读缴存,没有就直接遍历然后存入缓存
// 处理编辑文件初始目录
// 所有可以有编辑的文件夹
$fileData = '';
// 先找缓存
$catchdata = F('file_edit_root_dir');
if (is_array($fileData[$path])) {
$fileData = $fileData[$path];
} else {
import('@.ORG.FileUtil');
$fileObj = new FileUtil();
$ret = $fileObj->getOneDir($path);
if (is_array($ret) && $path) {
if (is_array($catchdata)) {
$catchdataTemp = array_merge($catchdata, array($path => $ret['dir']));
} else {
$catchdataTemp = array($path => $ret['dir']);
}
F('file_edit_root_dir', $catchdataTemp);
}
$fileData = $ret;
//['dir'];
}
$temp = reset($fileData);
$dir = '';
$file = '';
if ($temp['dir']) {
$dir = $temp['dir'];
}
if ($temp['file']) {
$file = $temp['file'];
}
if (is_array($dir) && is_array($file)) {
$fileList = array_merge($dir, $file);
} elseif (!is_array($dir) && is_array($file)) {
$fileList = $file;
} elseif (is_array($dir) && !is_array($file)) {
$fileList = $dir;
} else {
$fileList = '';
}
// print_r($fileList);
if ($realyReturn) {
return $fileList;
} else {
//echo json_encode ( $fileList );
$this->assign('vo', $fileList);
$this->display('FieldEdit:index');
}
}
开发者ID:tmlsoft,项目名称:main,代码行数:70,代码来源:FieldEditAction.class.php
示例3: checkFile
protected function checkFile()
{
import('@.ORG.FileUtil');
$dir = DConfig_PATH . '/Models';
$obj = new FileUtil();
$chekDir = ROOT . '/nbm';
$obj->checkFileAndCreateAppend($dir, 'listExtend.inc.php', $dir . '/listExtend.inc.php', '');
var_dump($fileArr);
}
开发者ID:tmlsoft,项目名称:main,代码行数:9,代码来源:CheckListExtendAction.class.php
示例4: __construct
/**
* @param string $name lock name
* @throws LockException
*/
public function __construct($name)
{
$this->name = $name;
$fileUtil = new FileUtil();
$lockFile = $fileUtil->getTempDirectory() . DIRECTORY_SEPARATOR . $name;
$this->handle = fopen($lockFile, "w");
if (!is_resource($this->handle)) {
throw new LockException("Could not open lock file {$lockFile}.");
}
}
开发者ID:bmdevel,项目名称:bav,代码行数:14,代码来源:Lock.php
示例5: actionDelTemplate
public function actionDelTemplate($template)
{
$fileutil = new FileUtil();
$fileutil->deldir("themes/" . $template);
$defTheme = $this->connection->createCommand("select content from xm_config where syskey = 'theme'")->queryScalar();
if ($defTheme == $template) {
$templates = $fileutil->getFileList('themes');
$this->actionSetDefault($templates[0]);
}
echo 1;
}
开发者ID:Toney,项目名称:xmcms,代码行数:11,代码来源:TemplateController.php
示例6: testAutomaticUpdatePlan
/**
* @expectedException \PHPUnit_Framework_Error_Notice
* @medium
*/
public function testAutomaticUpdatePlan()
{
$fileUtil = new FileUtil();
$file = tempnam($fileUtil->getTempDirectory(), 'bavtest');
touch($file, strtotime("-1 year"));
$backend = new FileDataBackend($file);
$updatePlan = new AutomaticUpdatePlan();
$this->assertTrue($updatePlan->isOutdated($backend));
$updatePlan->perform($backend);
$this->assertFalse($updatePlan->isOutdated($backend));
}
开发者ID:bmdevel,项目名称:bav,代码行数:15,代码来源:00UpdatePlanTest.php
示例7: setexecutingfile
/**
* @Title: setexecutingfile
* @Description: todo(生成处理页面)
* @author libo
* @date 2014-7-7 上午9:49:40
* @throws
*/
public function setexecutingfile()
{
import('@.ORG.FileUtil');
//引入文件
$obj = new FileUtil();
//实例化对象
$chekDir = ROOT . '/Tpl/default/' . $_REQUEST['name'];
//设置找查目录
$createDir = ROOT . '/Tpl/default/MisWorkExecuting';
//返回日志记录位置
$a = $obj->checkFile($chekDir, $_REQUEST['name'] . '.html', array('auditview.html', 'view.html', 'edit.html'), $createDir, false, true);
}
开发者ID:tmlsoft,项目名称:main,代码行数:19,代码来源:MisWorkExecutingSetAction.class.php
示例8: step_one
/**
* @Title: step_one
* @Description: todo(第一版执行文件检查)
* @author laicaixia
* @date 2013-6-2 上午10:35:32
* @throws
*/
public function step_one()
{
$fileutil = new FileUtil();
$filedir = $fileutil->file_list_all(APP_PATH);
//print_r($a);
$filedirlist = $this->getResult($filedir);
foreach ($filedirlist as $key => $val) {
$arr[] = explode("|", $val);
}
$this->assign("filedir", $arr);
$this->display();
}
开发者ID:tmlsoft,项目名称:main,代码行数:19,代码来源:UpgradeLocalAction.class.php
示例9: testAutomaticUpdate
/**
* Tests automatic installation.
*/
public function testAutomaticUpdate()
{
$updatePlan = new AutomaticUpdatePlan();
$updatePlan->setNotice(false);
ConfigurationRegistry::getConfiguration()->setUpdatePlan($updatePlan);
$fileUtil = new FileUtil();
$container = new FileDataBackendContainer(tempnam($fileUtil->getTempDirectory(), 'bavtest'));
$backend = $container->getDataBackend();
touch($backend->getFile(), strtotime("-1 year"));
$this->assertTrue($updatePlan->isOutdated($backend));
$container->applyUpdatePlan($backend);
$this->assertFalse($updatePlan->isOutdated($backend));
$backend->uninstall();
ConfigurationRegistry::getConfiguration()->setUpdatePlan(null);
}
开发者ID:bmdevel,项目名称:bav,代码行数:18,代码来源:BackendContainerTest.php
示例10: parseMenuItems
/**
* Parses the menu items.
*/
protected function parseMenuItems()
{
foreach ($this->menuItems as $parentMenuItem => $items) {
foreach ($items as $key => $item) {
if (!empty($item['menuItemLink']) || !empty($item['menuItemIcon'])) {
// get relative path
$path = '';
if (empty($item['packageDir'])) {
$path = RELATIVE_WCF_DIR;
} else {
$path = FileUtil::getRealPath(RELATIVE_WCF_DIR . $item['packageDir']);
}
// add package id and session id to link
if (!empty($item['menuItemLink'])) {
$item['menuItemLink'] = $this->parseMenuItemLink($item['menuItemLink'], $path);
}
if (!empty($item['menuItemIcon'])) {
$item['menuItemIcon'] = $this->parseMenuItemIcon($item['menuItemIcon'], $path);
}
$this->menuItems[$parentMenuItem][$key] = $item;
}
$this->menuItemList[$item['menuItem']] =& $this->menuItems[$parentMenuItem][$key];
}
}
}
开发者ID:CaribeSoy,项目名称:contest-wcf,代码行数:28,代码来源:TreeMenu.class.php
示例11: loadTaggables
/**
* Loads the taggable objects.
*/
protected function loadTaggables()
{
if ($this->taggables !== null) {
return;
}
// get cache
WCF::getCache()->addResource('taggables-' . PACKAGE_ID, WCF_DIR . 'cache/cache.taggables-' . PACKAGE_ID . '.php', WCF_DIR . 'lib/system/cache/CacheBuilderTaggable.class.php');
$this->taggablesData = WCF::getCache()->get('taggables-' . PACKAGE_ID);
// get objects
$this->taggables = array();
foreach ($this->taggablesData as $type) {
// calculate class path
$path = '';
if (empty($type['packageDir'])) {
$path = WCF_DIR;
} else {
$path = FileUtil::getRealPath(WCF_DIR . $type['packageDir']);
}
// include class file
if (!file_exists($path . $type['classPath'])) {
throw new SystemException("unable to find class file '" . $path . $type['classPath'] . "'", 11000);
}
require_once $path . $type['classPath'];
// create instance
$className = StringUtil::getClassName($type['classPath']);
if (!class_exists($className)) {
throw new SystemException("unable to find class '" . $className . "'", 11001);
}
$this->taggables[$type['taggableID']] = new $className($type['taggableID'], $type['name']);
}
}
开发者ID:joaocustodio,项目名称:EmuDevstore-1,代码行数:34,代码来源:TagEngine.class.php
示例12: getOptionTree
/**
* Returns the tree of options.
*
* @return array
*/
public function getOptionTree($parentCategoryName = '', User $user)
{
$options = array();
if (isset($this->categoryStructure[$parentCategoryName])) {
// get super categories
foreach ($this->categoryStructure[$parentCategoryName] as $superCategoryName) {
$superCategory = $this->categories[$superCategoryName];
// add icon path
if (!empty($superCategory['categoryIconM'])) {
// get relative path
$path = '';
if (empty($superCategory['packageDir'])) {
$path = RELATIVE_WCF_DIR;
} else {
$path = FileUtil::getRealPath(RELATIVE_WCF_DIR . $superCategory['packageDir']);
}
$superCategory['categoryIconM'] = $path . $superCategory['categoryIconM'];
}
$superCategory['options'] = $this->getCategoryOptions($superCategoryName, $user);
if (count($superCategory['options']) > 0) {
$options[$superCategoryName] = $superCategory;
}
}
}
return $options;
}
开发者ID:joaocustodio,项目名称:EmuDevstore-1,代码行数:31,代码来源:UserOptions.class.php
示例13: SaveJsonData
function SaveJsonData($category, $start, $end, $file_Path)
{
$rows = array();
$query2 = " select pro_id ,title ,img_url ,detail_url ,shop_name ,price ,month_sold ,comm_percent ,seller_ww ,back_BB ,";
$query2 .= " short_tbk_url ,tbk_url ,commission ,earn ,img_list ,show_order ,P.cat_id ,entrydate ,disabled ";
$query2 .= " from BS_ProInfo AS P";
$query2 .= " join BS_Category as C on P.cat_id=C.cat_id";
$query2 .= " where P.disabled=0 and C.category ='{$category}'";
$query2 .= " limit {$start}, {$end}";
// echo $query2;
// exit();
$result2 = mysqli_query(connect(), $query2);
while (@($row = mysqli_fetch_assoc($result2))) {
$rows[] = $row;
}
//random order
shuffle($rows);
// echo $filename;
// echo $query2;
// echo "<br>";
if (!file_exists($file_Path)) {
// 文件所在目录
// echo dirname($json_path);
// mkdir($json_path, 0777);
FileUtil::createFile($file_Path);
}
// 修改文件权限为读写可执行
// Read 4 - 允许读文件
// Write 2 - 允许写/修改文件
// eXecute1 - 读/写/删除/修改/目录
chmod($file_Path, 0777);
file_put_contents($file_Path, json_encode($rows));
}
开发者ID:wancy86,项目名称:BS_PHP,代码行数:33,代码来源:admin_gen_json.php
示例14: mediashare_sourcesapi_scanSources
function mediashare_sourcesapi_scanSources()
{
// Check access
if (!SecurityUtil::checkPermission('mediashare::', '::', ACCESS_ADMIN)) {
return LogUtil::registerPermissionError();
}
$dom = ZLanguage::getModuleDomain('mediashare');
// Clear existing sources table
if (!DBUtil::truncateTable('mediashare_sources')) {
return LogUtil::registerError(__f('Error in %1$s: %2$s.', array('sourcesapi.scanSources', __f("Could not clear the '%s' table.", 'sources', $dom)), $dom));
}
// Scan for sources APIs
$files = FileUtil::getFiles('modules/mediashare', false, true, 'php', 'f');
foreach ($files as $file) {
if (preg_match('/^pnsource_([-a-zA-Z0-9_]+)api.php$/', $file, $matches)) {
$sourceName = $matches[1];
$sourceApi = "source_{$sourceName}";
// Force load - it is used during pninit
pnModAPILoad('mediashare', $sourceApi, true);
if (!($title = pnModAPIFunc('mediashare', $sourceApi, 'getTitle'))) {
return false;
}
if (!pnModAPIFunc('mediashare', 'sources', 'addSource', array('title' => $title, 'name' => $sourceName))) {
return false;
}
}
}
return true;
}
开发者ID:ro0f,项目名称:Mediashare,代码行数:29,代码来源:pnsourcesapi.php
示例15: createCategoryCacheFile
public function createCategoryCacheFile()
{
$this->dbGetAllCategory();
$categoryList = $this->categoryList['resultList'];
$category = $firstCategory = null;
if ($categoryList) {
foreach ($categoryList as $val) {
$category[$val['id']] = $val;
$childCategory = $this->getChildCategoryById($val['id'], $categoryList);
if ($childCategory) {
$category[$val['id']]['child'] = $childCategory;
}
if ($val['parentid'] == 0) {
$val['child'] = $childCategory;
$firstCategory[$val['id']] = $val;
}
}
$category[0]['child'] = $firstCategory;
}
$string_start = "<?php\n \$showcategory=";
$string_process = var_export($category, TRUE);
$string_end = ";\n?>";
$string = $string_start . $string_process . $string_end;
FileUtil::writeFileContent($this->cacheFile, $string);
}
开发者ID:lzmyoyo,项目名称:ninxingfu,代码行数:25,代码来源:showCategoryModel.php
示例16: readDiskInfo
/**
* Reads the disk quota info
*
* @param integer $pow
* @param integer $dec
* @return array
*/
public static function readDiskInfo($pow = 2, $dec = 2)
{
$diskInformation = array();
if (function_exists('disk_free_space') && function_exists('disk_total_space')) {
$root = '';
if ($tmp = @disk_total_space($_SERVER["DOCUMENT_ROOT"])) {
$root = $_SERVER["DOCUMENT_ROOT"];
} else {
$sql = "SELECT packageDir FROM wcf" . WCF_N . "_package\n \t\t\tWHERE packageID = " . PACKAGE_ID;
$row = WCF::getDB()->getFirstRow($sql);
$root = FileUtil::getRealPath(WCF_DIR . $row['packageDir']);
}
if (!empty($root)) {
$diskInformation['totalSpace'] = round(disk_total_space($root) / pow(1024, $pow), $dec);
$diskInformation['freeSpace'] = round(disk_free_space($root) / pow(1024, $pow), $dec);
$diskInformation['usedSpace'] = round($diskInformation['totalSpace'] - $diskInformation['freeSpace'], $dec);
if ($diskInformation['totalSpace'] > 0) {
$diskInformation['freeQuota'] = round($diskInformation['freeSpace'] * 100 / $diskInformation['totalSpace'], $dec);
$diskInformation['usedQuota'] = round($diskInformation['usedSpace'] * 100 / $diskInformation['totalSpace'], $dec);
} else {
$diskInformation['freeQuota'] = $diskInformation['usedQuota'] = 0;
}
}
}
return $diskInformation;
}
开发者ID:Maggan22,项目名称:wbb3addons,代码行数:33,代码来源:AdminToolsUtil.class.php
示例17: appending
public function appending()
{
with($stream = new FileOutputStream($this->file, true));
$stream->write('!');
$this->file->close();
$this->assertEquals('Created by FileOutputStreamTest!', FileUtil::getContents($this->file));
}
开发者ID:xp-framework,项目名称:core,代码行数:7,代码来源:FileOutputStreamTest.class.php
示例18: createAdressCacheFile
public function createAdressCacheFile()
{
$addressList = $this->dbGetAllAddress();
$addressList = $addressList['resultList'];
$address = $firstAddress = null;
if ($addressList) {
foreach ($addressList as $val) {
$address[$val['id']] = $val;
$childAddress = $this->getChildAddressById($val['id'], $addressList);
if ($childAddress) {
$address[$val['id']]['child'] = $childAddress;
}
if ($val['parentid'] == 0) {
$val['child'] = $childAddress;
$firstAddress[$val['id']] = $val;
}
}
$address[0]['child'] = $firstAddress;
}
$string_start = "<?php\n \$mobileaddress=";
$string_process = var_export($address, TRUE);
$string_end = ";\n?>";
$string = $string_start . $string_process . $string_end;
FileUtil::writeFileContent($this->cacheFile, $string);
}
开发者ID:lzmyoyo,项目名称:ninxingfu,代码行数:25,代码来源:addressModel.php
示例19: newAction
/**
* 新增校友
*/
public function newAction($col_id)
{
//判断是否ajax
if ($this->request->isAjax()) {
$validate = new \Validate();
$data['col_id'] = $validate->getPost('col_id', \Validate::int());
//学校id
$data['alu_head'] = $validate->getPost('alu_head', \Validate::base64());
//校友头像
$data['alu_name'] = $validate->getPost('alu_name', \Validate::length(15, 2));
//校友名称
$data['alu_desc'] = $validate->getPost('alu_desc', \Validate::length(255, 2));
//校友简介
$data['alu_src'] = $validate->getPost('alu_src', \Validate::length(255, 2));
//资料来源
//验证参数
if ($validate->getMessage()) {
$this->end(400);
}
//生成校友头像
$data['alu_head'] = \Func::touchImg($data['alu_head'], 'alu_head');
//监测图片是否生成成功
if (!$data['alu_head']) {
\FileUtil::getInstance()->unlink(UPLOAD_PATH . $data['alu_head']);
$this->end(400);
}
//新增动态
$this->end((new \CollegeAlumnus())->addAlumnus($this->session->get('id'), $data));
}
$this->view->setVars(['col_id' => $col_id]);
}
开发者ID:xw716825,项目名称:git_back,代码行数:34,代码来源:ColalumnusController.php
示例20: getEditors
/**
* read editors folder and load names into array
*
* @param array $args
* @return type
*/
public function getEditors($args)
{
$path = 'modules/Scribite/plugins';
$plugins = FileUtil::getFiles($path, false, true, null, 'd');
$editors = array();
foreach ($plugins as $pluginName) {
$className = 'ModulePlugin_Scribite_' . $pluginName . '_Plugin';
$instance = PluginUtil::loadPlugin($className);
$pluginstate = PluginUtil::getState($instance->getServiceId(), PluginUtil::getDefaultState());
if ($pluginstate['state'] == PluginUtil::ENABLED) {
if (isset($args['format']) && $args['format'] == 'formdropdownlist') {
$editors[] = array(
'text' => $instance->getMetaDisplayName(),
'value' => $pluginName
);
} else {
$editors[$pluginName] = $instance->getMetaDisplayName();
}
}
}
return $editors;
}
开发者ID:projectesIF,项目名称:Sirius,代码行数:32,代码来源:Admin.php
注:本文中的FileUtil类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论