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


PHP WindFile::write方法代码示例

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


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

示例1: postUpload

 protected function postUpload($tmp_name, $filename)
 {
     if (strpos($filename, '..') !== false || strpos($filename, '.php.') !== false || preg_match('/\\.php$/', $filename)) {
         exit('illegal file type!');
     }
     WindFolder::mkRecur(dirname($filename));
     if (function_exists("move_uploaded_file") && @move_uploaded_file($tmp_name, $filename)) {
         @unlink($tmp_name);
         @chmod($filename, 0777);
         return filesize($filename);
     } elseif (@copy($tmp_name, $filename)) {
         @unlink($tmp_name);
         @chmod($filename, 0777);
         return filesize($filename);
     } elseif (is_readable($tmp_name)) {
         Wind::import('WIND:utility.WindFile');
         WindFile::write($filename, WindFile::read($tmp_name));
         @unlink($tmp_name);
         if (file_exists($filename)) {
             @chmod($filename, 0777);
             return filesize($filename);
         }
     }
     return false;
 }
开发者ID:ccq18,项目名称:EduSoho,代码行数:25,代码来源:WindFormUpload.php

示例2: packFromFileList

 /**
  * 将给出的文件列表进行打包
  * 
  * @param mixed $fileList 文件列表
  * @param string $dst  打包文件的存放位置
  * @param method $packMethod 打包的方式,默认为stripWhiteSpaceByPhp
  * @param boolean $compress 打包是否采用压缩的方式,默认为true
  * @return boolean
  */
 public function packFromFileList($fileList, $dst, $packMethod = WindPack::STRIP_PHP, $compress = true)
 {
     if (empty($dst) || empty($fileList)) {
         return false;
     }
     $content = array();
     $this->readContentFromFileList($fileList, $packMethod, $content);
     $replace = $compress ? ' ' : "\n";
     $content = implode($replace, $content);
     $content = $this->callBack($content, $replace);
     $content = $this->stripNR($content, $replace);
     $content = $this->stripPhpIdentify($content, '');
     return WindFile::write($dst, '<?php' . $replace . $content . '?>');
 }
开发者ID:ccq18,项目名称:EduSoho,代码行数:23,代码来源:WindPack.php

示例3: compile

 /**
  * 编译模板并返回编译后模板地址及内容
  * 
  * <pre>
  * <i>$output==true</i>返回编译文件绝对路径地址和内容,不生成编译文件;
  * <i>$output==false</i>返回编译文件绝对路径地址和内容,生成编译文件
  * </pre>
  * 
  * @param string $template 模板名称 必填
  * @param string $suffix 模板后缀 默认为空 
  * @param boolean $readOnly 是否直接输出模板内容,接受两个值true,false 默认值为false
  * @param boolean $forceOutput 是否强制返回模板内容,默认为不强制
  * @return array(compileFile,content) <pre>
  * <i>compileFile</i>模板编译文件绝对地址,
  * <i>content</i>编译后模板输出内容,当<i>$output</i>
  * 为false时将content写入compileFile</pre>
  */
 public function compile($template, $suffix = '', $readOnly = false, $forceOutput = false)
 {
     $templateFile = $this->windView->getViewTemplate($template, $suffix);
     if (!is_file($templateFile)) {
         throw new WindViewException('[component.viewer.WindViewerResolver.compile] ' . $templateFile, WindViewException::VIEW_NOT_EXIST);
     }
     $compileFile = $this->windView->getCompileFile($template);
     if (!$this->checkReCompile($templateFile, $compileFile)) {
         return array($compileFile, $forceOutput ? WindFile::read($compileFile) : '');
     }
     /* @var $_windTemplate WindViewTemplate */
     $_windTemplate = Wind::getApp()->getComponent('template');
     $_output = $_windTemplate->compile($templateFile, $this);
     $readOnly === false && WindFile::write($compileFile, $_output);
     return array($compileFile, $_output);
 }
开发者ID:jellycheng,项目名称:windframework,代码行数:33,代码来源:WindViewerResolver.php

示例4: compile

 /**
  * 编译模板并返回编译后模板地址及内容
  * <pre>
  * <i>$output==true</i>返回编译文件绝对路径地址和内容,不生成编译文件;
  * <i>$output==false</i>返回编译文件绝对路径地址和内容,生成编译文件
  * </pre>
  * 
  * @param string $template 模板名称 必填
  * @param string $suffix 模板后缀 默认为空
  * @param boolean $readOnly 是否直接输出模板内容,接受两个值true,false 默认值为false
  * @param boolean $forceOutput 是否强制返回模板内容,默认为不强制
  * @return array(compileFile,content) <pre>
  *         <i>compileFile</i>模板编译文件绝对地址,
  *         <i>content</i>编译后模板输出内容,当<i>$output</i>
  *         为false时将content写入compileFile</pre>
  */
 public function compile($template, $suffix = '', $readOnly = false, $forceOutput = false)
 {
     list($templateFile, $compileFile, $this->currentThemeKey) = $this->windView->getViewTemplate($template, $suffix);
     if (!is_file($templateFile)) {
         throw new WindViewException('[viewer.resolver.WindViewerResolver.compile] ' . $templateFile, WindViewException::VIEW_NOT_EXIST);
     }
     if (!$this->checkReCompile($templateFile, $compileFile)) {
         return array($compileFile, $forceOutput || $readOnly ? WindFile::read($compileFile) : '');
     }
     /* @var $_windTemplate WindViewTemplate */
     $_windTemplate = Wind::getComponent('template');
     $_output = $_windTemplate->compile($templateFile, $this);
     if (false === $readOnly) {
         WindFolder::mkRecur(dirname($compileFile));
         WindFile::write($compileFile, $_output);
     }
     return array($compileFile, $_output);
 }
开发者ID:fanqimeng,项目名称:4tweb,代码行数:34,代码来源:WindViewerResolver.php

示例5: _doCss

 /**
  * @param string $stylePackage
  * @param booelan $isManifestChanged
  * @return boolean
  */
 private function _doCss($stylePackage)
 {
     $file = $stylePackage . '/' . $this->manifest;
     $dir = $stylePackage . '/' . $this->cssDevDir;
     $_dir = $stylePackage . '/' . $this->cssDir;
     WindFolder::mkRecur($_dir);
     $files = WindFolder::read($dir, WindFolder::READ_FILE);
     foreach ($files as $v) {
         if (WindFile::getSuffix($v) === 'css') {
             $dev_css = $dir . '/' . $v;
             //待编译文件
             $css = $_dir . '/' . $v;
             //编译后文件
             $data = WindFile::read($dir . '/' . $v);
             $_data = $this->_compress($data);
             if (WindFile::write($css, $_data) === false) {
                 return new PwError('STYLE:style.css.write.fail');
             }
         }
     }
     return true;
 }
开发者ID:latticet,项目名称:EduSoho_jb51,代码行数:27,代码来源:PwCssCompress.php

示例6: doCompile

 public function doCompile()
 {
     $JS_DEV_PATH = Wind::getRealDir('PUBLIC:res.js.dev');
     $JS_BUILD_PATH = Wind::getRealDir('PUBLIC:res.js.build');
     Wind::import('Wind:utility.WindFolder');
     $files = $this->_getFiles($JS_DEV_PATH);
     foreach ($files as $file) {
         $newfile = $JS_BUILD_PATH . substr($file, strlen($JS_DEV_PATH));
         WindFolder::mkRecur(dirname($newfile));
         if (substr($file, -3) != '.js') {
             if (!copy($file, $newfile)) {
                 return new PwError('copy failed');
             }
             continue;
         }
         $content = WindFile::read($file);
         $compress = jscompress::pack($content);
         if (!WindFile::write($newfile, $compress)) {
             return new PwError('write failed');
         }
     }
 }
开发者ID:ccq18,项目名称:EduSoho,代码行数:22,代码来源:PwJsCompress.php

示例7: dobackAction

 /**
  * 备份
  * 
  * @return void
  */
 public function dobackAction()
 {
     $siteState = Wekit::C('site', 'visit.state');
     if ($siteState != 2) {
         $this->showError('BACKUP:site.isopen');
     }
     @set_time_limit(500);
     list($sizelimit, $compress, $start, $tableid, $step, $dirname) = $this->getInput(array('sizelimit', 'compress', 'start', 'tableid', 'step', 'dirname'));
     list($tabledb, $insertmethod, $tabledbname) = $this->getInput(array('tabledb', 'insertmethod', 'tabledbname'));
     $backupService = $this->_getBackupService();
     $tabledbTmpSaveDir = $backupService->getDataDir() . 'tmp/';
     $backupService->createFolder($tabledbTmpSaveDir);
     $tableid = intval($tableid);
     $tableid = $tableid ? $tableid : 0;
     $insertmethod = $insertmethod == 'extend' ? 'extend' : 'common';
     $sizelimit = $sizelimit ? $sizelimit : 2048;
     (!is_array($tabledb) || !$tabledb) && !$step && $this->showError('BACKUP:name.empty');
     // 读取保存的需要操作的表
     if (!$tabledb && $step) {
         $cachedTable = WindFile::read(WindSecurity::escapePath($tabledbTmpSaveDir . $tabledbname . '.tmp'));
         $tabledb = explode("|", $cachedTable);
     }
     !$dirname && ($dirname = $backupService->getDirectoryName());
     // 第一次临时保存需要操作的表
     if (!$step) {
         $specialTables = array_intersect($backupService->getSpecialTables(), $tabledb);
         $tabledb = array_values(array_diff($tabledb, $backupService->getSpecialTables()));
         if ($tabledb) {
             $backupService->backupTable($tabledb, $dirname, $compress);
             $tabledbname = 'cached_table_buckup';
             WindFile::write(WindSecurity::escapePath($tabledbTmpSaveDir . $tabledbname . '.tmp'), implode("|", $tabledb), 'wb');
         }
         // 备份数据表结构
         // 备份特殊表结构和数据
         if ($specialTables) {
             $backupService->backupSpecialTable($specialTables, $dirname, $compress, $insertmethod);
             $referer = 'admin/backup/backup/doback?' . "start=0&tableid={$tableid}&sizelimit={$sizelimit}&step=1&insertmethod={$insertmethod}&compress={$compress}&tabledbname={$tabledbname}&dirname={$dirname}";
             $this->showMessage('正在备份', $referer, true);
         }
     }
     if (!$tabledb) {
         $this->showMessage(array('BACKUP:bakup_success', array('{path}' => $backupService->getSavePath() . $dirname)), 'admin/backup/backup/run');
     }
     // 保存数据
     $step = (!$step ? 1 : $step) + 1;
     $filename = $dirname . '/' . $dirname . '_' . ($step - 1) . '.sql';
     list($backupData, $tableid, $start) = $backupService->backupData($tabledb, $tableid, $start, $sizelimit, $insertmethod, $filename);
     $continue = $tableid < count($tabledb) ? true : false;
     $backupService->saveData($filename, $backupData, $compress);
     // 循环执行
     if ($continue) {
         $currentTableName = $tabledb[$tableid];
         $currentPos = $start + 1;
         $createdFileNum = $step - 1;
         $referer = 'admin/backup/backup/doback?' . "start={$start}&tableid={$tableid}&sizelimit={$sizelimit}&step={$step}&insertmethod={$insertmethod}&compress={$compress}&tabledbname={$tabledbname}&dirname={$dirname}";
         $this->showMessage(array('BACKUP:bakup_step', array('{currentTableName}' => $currentTableName, '{currentPos}' => $currentPos, '{createdFileNum}' => $createdFileNum)), $referer, true);
     } else {
         unlink(WindSecurity::escapePath($tabledbTmpSaveDir . $tabledbname . '.tmp'));
         $this->showMessage(array('BACKUP:bakup_success', array('{path}' => $backupService->getSavePath() . $dirname)), 'admin/backup/backup/run');
     }
 }
开发者ID:chendong0444,项目名称:phpwind,代码行数:66,代码来源:BackupController.php

示例8: install

 public function install($patch)
 {
     $tmpfiles = $this->bakFiles = array();
     WindFolder::mkRecur($this->tmpPath);
     if ($this->ftp && !is_object($this->ftp)) {
         try {
             $this->ftp = $this->ftp['sftp'] ? new PwSftpSave($this->ftp) : new PwFtpSave($this->ftp);
         } catch (WindFtpException $e) {
             return false;
         }
     }
     foreach ($patch['rule'] as $rule) {
         $rule['filename'] = $this->sortFile($rule['filename']);
         $filename = ROOT_PATH . $rule['filename'];
         $search = base64_decode($rule['search']);
         $replace = base64_decode($rule['replace']);
         $count = $rule['count'];
         $nums = $rule['nums'];
         $str = WindFile::read($filename);
         $realCount = substr_count($str, $search);
         if ($realCount != $count) {
             return new PwError('APPCENTER:upgrade.patch.update.fail', array($patch['id']));
         }
         $bakfile = basename($rule['filename']) . '.' . Pw::time2str(WEKIT_TIMESTAMP, 'Ymd') . '.bak';
         $bakfile = $this->ftp ? dirname($rule['filename']) . '/' . $bakfile : dirname($filename) . '/' . $bakfile;
         $tmpfile = tempnam($this->tmpPath, 'patch');
         $replacestr = PwSystemHelper::replaceStr($str, $search, $replace, $count, $nums);
         WindFile::write($tmpfile, $replacestr);
         if ($this->ftp) {
             try {
                 $this->ftp->upload($filename, $bakfile);
                 $this->ftp->upload($tmpfile, $rule['filename']);
             } catch (WindFtpException $e) {
                 return false;
             }
         } else {
             if (!@copy($filename, $bakfile)) {
                 return new PwError('APPCENTER:upgrade.copy.fail', array($rule['filename']));
             }
             if (!@copy($tmpfile, $filename)) {
                 return new PwError('APPCENTER:upgrade.copy.fail', array($rule['filename']));
             }
         }
         $tmpfiles[] = $tmpfile;
         $this->bakFiles[] = $bakfile;
     }
     $this->_ds()->addLog($patch['id'], $patch, 2);
     return true;
 }
开发者ID:fanqimeng,项目名称:4tweb,代码行数:49,代码来源:PwPatchUpdate.php

示例9: log

 public static function log($msg, $version, $start = false)
 {
     static $log;
     if (!$log) {
         $log = Wind::getRealDir('DATA:upgrade.log', true) . '/' . $version . '.log';
         WindFolder::mkRecur(dirname($log));
     }
     $status = $start ? WindFile::READWRITE : WindFile::APPEND_WRITEREAD;
     WindFile::write($log, "\r\n" . date('Y-m-d H:i') . '   ' . $msg, $status);
 }
开发者ID:fanqimeng,项目名称:4tweb,代码行数:10,代码来源:PwSystemHelper.php

示例10: _recordTableSaveInfo

 /**
  * 记录表数据的保存文件跟位置
  * 
  * @param $tableSaveInfo
  * @param $filename
  * @return bool
  */
 public function _recordTableSaveInfo($tableSaveInfo, $filename)
 {
     if (!$filename || !is_array($tableSaveInfo) || !count($tableSaveInfo)) {
         return false;
     }
     $filePath = $this->getSavePath() . dirname($filename);
     $filename = basename($filename);
     $this->createFolder($filePath);
     $linesOfBackupTip = $this->getLinesOfBackupTip();
     foreach ($tableSaveInfo as $key => $value) {
         $value['start'] += $linesOfBackupTip;
         $value['end'] != -1 && ($value['end'] += $linesOfBackupTip);
         $record .= $key . ':' . $filename . ',' . $value['start'] . ',' . $value['end'] . "\n";
     }
     Wind::import('WIND:utility.WindFile');
     WindFile::write($filePath . '/table.index', $record, 'ab+');
     return true;
 }
开发者ID:chendong0444,项目名称:phpwind,代码行数:25,代码来源:PwBackupService.php

示例11: write

 protected function write($content, $file)
 {
     return WindFile::write($file, $content);
 }
开发者ID:fanqimeng,项目名称:4tweb,代码行数:4,代码来源:PwPortalCompile.php

示例12: extract2

 public function extract2($zipPack, $target)
 {
     if (!$zipPack || !is_file($zipPack)) {
         return false;
     }
     $extractedData = array();
     $target = rtrim($target, '/');
     WindFolder::mkRecur($target, 0777);
     $this->fileHandle = fopen($zipPack, 'rb');
     $filesize = sprintf('%u', filesize($zipPack));
     $EofCentralDirData = $this->_findEOFCentralDirectoryRecord($filesize);
     if (!is_array($EofCentralDirData)) {
         return false;
     }
     $centralDirectoryHeaderOffset = $EofCentralDirData['centraldiroffset'];
     for ($i = 0; $i < $EofCentralDirData['totalentries']; $i++) {
         rewind($this->fileHandle);
         fseek($this->fileHandle, $centralDirectoryHeaderOffset);
         $centralDirectoryData = $this->_readCentralDirectoryData();
         if (!is_array($centralDirectoryData)) {
             $centralDirectoryHeaderOffset += 46;
             continue;
         }
         $centralDirectoryHeaderOffset += 46 + $centralDirectoryData['filenamelength'] + $centralDirectoryData['extrafieldlength'] + $centralDirectoryData['commentlength'];
         if (substr($centralDirectoryData['filename'], -1) === '/') {
             WindFolder::mkRecur($target . '/' . $centralDirectoryData['filename'], 0777);
             $extractedData['folder'][$i] = $centralDirectoryData['filename'];
             continue;
         } else {
             $data = $this->_readLocalFileHeaderAndData($centralDirectoryData);
             if ($data === false) {
                 continue;
             }
             WindFile::write($target . '/' . $centralDirectoryData['filename'], $data);
             $extractedData['file'][$i] = $centralDirectoryData['filename'];
         }
     }
     fclose($this->fileHandle);
     return $extractedData;
 }
开发者ID:chendong0444,项目名称:phpwind,代码行数:40,代码来源:PwExtractZip.php

示例13: generateWww

    /**
     * 生成www目录及index.php
     *
     */
    protected function generateWww()
    {
        $content = <<<EOS
<?php
error_reporting(E_ALL & ~E_NOTICE & ~E_WARNING);
define('WIND_DEBUG', 1);
require_once '%s';
Wind::register(realpath('%s'), '%s');
Wind::application('%s', '%s')->run();
EOS;
        $dir = $this->dir . '/' . $this->wwwDir;
        WindFolder::mkRecur($dir);
        $content = sprintf($content, $this->_resolveRelativePath($dir, Wind::getRealPath('WIND:Wind.php', true)), $this->_resolveRelativePath($dir, $this->dir), strtoupper($this->name), $this->name, $this->_resolveRelativePath($dir, $this->confFile));
        if (!WindFile::write($dir . '/index.php', $content)) {
            return false;
        }
        return true;
    }
开发者ID:jellycheng,项目名称:windframework,代码行数:22,代码来源:WindGenerateProject.php

示例14: _generateService

 protected function _generateService()
 {
     if (!$this->need_service) {
         return true;
     }
     $prefix = 'app_' . $this->alias . '_table';
     $classFrefix = str_replace(' ', '', ucwords('app_ ' . $this->alias . '_ ' . $this->alias));
     WindFolder::mkRecur($this->baseDir . '/service/dao/');
     WindFolder::mkRecur($this->baseDir . '/service/dm/');
     $dao_file = $this->defaultDir . '/service/dao/defaultdao';
     $class_dao = $classFrefix . 'Dao';
     $dao = strtr(WindFile::read($dao_file), array('{{classname}}' => $class_dao, '{{prefix}}' => $prefix, '{{author}}' => $this->author, '{{email}}' => $this->email, '{{website}}' => $this->website));
     WindFile::write($this->baseDir . '/service/dao/' . $class_dao . '.php', $dao);
     $dm_file = $this->defaultDir . '/service/dm/defaultdm';
     $class_dm = $classFrefix . 'Dm';
     $dm = strtr(WindFile::read($dm_file), array('{{classname}}' => $class_dm, '{{author}}' => $this->author, '{{email}}' => $this->email, '{{website}}' => $this->website));
     WindFile::write($this->baseDir . '/service/dm/' . $class_dm . '.php', $dm);
     $ds_file = $this->defaultDir . '/service/defaultds';
     $class_ds = $classFrefix;
     $ds = strtr(WindFile::read($ds_file), array('{{classname}}' => $class_ds, '{{alias}}' => $this->alias, '{{class_dm}}' => $class_dm, '{{class_dao}}' => $class_dao, '{{author}}' => $this->author, '{{email}}' => $this->email, '{{website}}' => $this->website));
     WindFile::write($this->baseDir . '/service/' . $class_ds . '.php', $ds);
 }
开发者ID:chendong0444,项目名称:phpwind,代码行数:22,代码来源:PwGenerateApplication.php

示例15: finishAction

 /**
  * 安装完成
  */
 public function finishAction()
 {
     //Wekit::createapp('phpwind');
     Wekit::C()->reload('windid');
     WindidApi::api('user');
     $db = $this->_checkDatabase();
     //更新HOOK配置数据
     Wekit::load('hook.srv.PwHookRefresh')->refresh();
     //初始化站点config
     $site_hash = WindUtility::generateRandStr(8);
     $cookie_pre = WindUtility::generateRandStr(3);
     Wekit::load('config.PwConfig')->setConfig('site', 'hash', $site_hash);
     Wekit::load('config.PwConfig')->setConfig('site', 'cookie.pre', $cookie_pre);
     Wekit::load('config.PwConfig')->setConfig('site', 'info.mail', $db['founder']['manager_email']);
     Wekit::load('config.PwConfig')->setConfig('site', 'info.url', PUBLIC_URL);
     Wekit::load('nav.srv.PwNavService')->updateConfig();
     Wind::import('WINDID:service.config.srv.WindidConfigSet');
     $windidConfig = new WindidConfigSet('site');
     $windidConfig->set('hash', $site_hash)->set('cookie.pre', $cookie_pre)->flush();
     //风格默认数据
     Wekit::load('APPCENTER:service.srv.PwStyleInit')->init();
     //计划任务默认数据
     Wekit::load('cron.srv.PwCronService')->updateSysCron();
     //更新数据缓存
     /* @var $usergroup PwUserGroupsService */
     $usergroup = Wekit::load('SRV:usergroup.srv.PwUserGroupsService');
     $usergroup->updateLevelCache();
     $usergroup->updateGroupCache(range(1, 16));
     $usergroup->updateGroupRightCache();
     /* @var $emotion PwEmotionService */
     $emotion = Wekit::load('SRV:emotion.srv.PwEmotionService');
     $emotion->updateCache();
     //创始人配置
     $uid = $this->_writeFounder($db['founder']['manager'], $db['founder']['manager_pwd'], $db['founder']['manager_email']);
     //门户演示数据
     Wekit::load('SRV:design.srv.PwDesignDefaultService')->likeModule();
     Wekit::load('SRV:design.srv.PwDesignDefaultService')->tagModule();
     Wekit::load('SRV:design.srv.PwDesignDefaultService')->reviseDefaultData();
     //演示数据导入
     Wind::import('SRV:forum.srv.PwPost');
     Wind::import('SRV:forum.srv.post.PwTopicPost');
     $pwPost = new PwPost(new PwTopicPost(2, new PwUserBo($uid)));
     $threads = $this->_getDemoThreads();
     foreach ($threads as $thread) {
         $postDm = $pwPost->getDm();
         $postDm->setTitle($thread['title'])->setContent($thread['content']);
         $result = $pwPost->execute($postDm);
     }
     //全局缓存更新
     Wekit::load('SRV:cache.srv.PwCacheUpdateService')->updateConfig();
     Wekit::load('SRV:cache.srv.PwCacheUpdateService')->updateMedal();
     //清理安装过程的文件
     WindFile::write($this->_getInstallLockFile(), 'LOCKED');
     WindFile::del($this->_getTempFile());
     WindFile::del($this->_getTableLogFile());
     WindFile::del($this->_getTableSqlFile());
 }
开发者ID:sanzhumu,项目名称:nextwind,代码行数:60,代码来源:IndexController.php


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