コード例 #1
0
ファイル: Image.php プロジェクト: ybluesky/h2o
 /**
  * 复制单个镜相文件
  * @param $resource 原文件
  * @param $dest 目标文件
  * @param $data 需要替换的内容
  */
 public function file($resource, $dest, $data = [])
 {
     $code = file_get_contents($this->_tpldir . $resource);
     $othur = $this->_devauthor();
     foreach ($othur as $k => $v) {
         $code = str_replace($k, $v, $code);
         //替换开发者变量信息
     }
     $code = str_replace($data['search'], $data['replace'], $code);
     //替换变量信息
     return file::write($dest, $code);
 }
コード例 #2
0
ファイル: application.php プロジェクト: dalinhuang/zotop
 public static function runtime()
 {
     if (!is_file(ZOTOP_RUNTIME . DS . '~runtime.php')) {
         $registers = zotop::register();
         $content = array();
         $content[] = '<?php';
         foreach ($registers as $file) {
             $content[] = file::compile($file);
         }
         $content[] = '?>';
         file::write(ZOTOP_RUNTIME . DS . '~runtime.php', implode("\n", $content));
     }
     //缓存配置文件
     zotop::data(ZOTOP_RUNTIME . DS . '~config.php', zotop::config());
 }
コード例 #3
0
ファイル: runtime.php プロジェクト: dalinhuang/zotop
 public static function hook()
 {
     //打包全部hook
     $hooks = array();
     $modules = zotop::data('module');
     foreach ($modules as $module) {
         $path = $module['path'] . DS . 'hook';
         $path = path::decode($path);
         $hook = (array) dir::files($path, '', true, true);
         $hooks = array_merge($hooks, $hook);
     }
     $content = runtime::compile($hooks);
     if (!empty($content)) {
         file::write(ZPATH_RUNTIME . DS . 'hook.php', $content, true);
     }
 }
コード例 #4
0
ファイル: runtime.php プロジェクト: dalinhuang/zotop
 /**
  * 运行时执行,并加载相关文件
  */
 public static function run()
 {
     //打包配置文件
     zotop::data(ZOTOP_PATH_RUNTIME . DS . 'config.php', zotop::config());
     //打包全部hook文件
     $hooks = runtime::compile(runtime::$hooks);
     if (!empty($hooks)) {
         file::write(ZOTOP_PATH_RUNTIME . DS . ZOTOP_APP_NAME . '_hooks.php', $hooks, true);
     }
     //加载hooks以便核心文件使用
     zotop::load(ZOTOP_PATH_RUNTIME . DS . ZOTOP_APP_NAME . '_hooks.php');
     //打包核心文件
     $libraries = zotop::register();
     $libraries = runtime::compile($libraries);
     if (!empty($libraries)) {
         file::write(ZOTOP_PATH_RUNTIME . DS . ZOTOP_APP_NAME . '.php', $libraries, true);
     }
 }
コード例 #5
0
ファイル: runtime.php プロジェクト: dalinhuang/zotop
 /**
  * 运行时执行,并加载相关文件
  */
 public static function build()
 {
     runtime::config();
     runtime::library();
     runtime::hooks();
     //打包配置文件
     zotop::data(ZOTOP_PATH_RUNTIME . DS . ZOTOP_APPLICATION_GROUP . '.config.php', zotop::config());
     //打包全部hook文件
     $hooks = runtime::compile(runtime::$hooks);
     if (!empty($hooks)) {
         file::write(ZOTOP_PATH_RUNTIME . DS . ZOTOP_APPLICATION_GROUP . '.hooks.php', $hooks, true);
     }
     //加载hooks以便核心文件使用
     zotop::load(ZOTOP_PATH_RUNTIME . DS . ZOTOP_APPLICATION_GROUP . '.hooks.php');
     //打包核心文件
     $libraries = zotop::register();
     $libraries = runtime::compile($libraries);
     if (!empty($libraries)) {
         file::write(ZOTOP_PATH_RUNTIME . DS . ZOTOP_APPLICATION_GROUP . '.core.php', $libraries, true);
     }
 }
コード例 #6
0
ファイル: file.php プロジェクト: dalinhuang/zotop
 public function actionEdit($file = '')
 {
     $file = empty($file) ? zotop::get('file') : $file;
     $file = trim(url::decode($file), '/');
     $filepath = ZOTOP_PATH_ROOT . DS . str_replace('/', DS, $file);
     if (form::isPostBack()) {
         $content = request::post('source');
         $content = trim($content);
         if (empty($content)) {
             msg::error('内容为空,无法保存!');
         }
         file::write($filepath, trim($content));
         msg::success('内容保存成功!');
     }
     $filecontent = file::read($filepath);
     $page = new dialog();
     $page->title = '文件编辑器';
     $page->set('file', $file);
     $page->set('filepath', $filepath);
     $page->set('filecontent', $filecontent);
     $page->display();
 }
コード例 #7
0
ファイル: file.php プロジェクト: dalinhuang/zotop
 public function actionEdit($file)
 {
     $filepath = realpath(ZOTOP_PATH_ROOT . DS . trim($file, '/'));
     if (empty($file)) {
         return false;
     }
     if (form::isPostBack()) {
         $content = request::post('source');
         $content = trim($content);
         if (empty($content)) {
             msg::error('内容为空,无法保存!');
         }
         file::write($filepath, trim($content));
         msg::success('内容保存成功!');
     }
     $content = file::read($filepath);
     $page = new dialog();
     $page->title = '文件编辑器';
     $page->set('file', $file);
     $page->set('filepath', $filepath);
     $page->set('content', $content);
     $page->display();
 }
コード例 #8
0
ファイル: file.class.php プロジェクト: nyroDev/nyroFwk
 /**
  * Save the output with the setting passed by the last call from start,
  * and show it
  *
  * @return bool True if store cache success
  * @see start
  */
 public function end()
 {
     $ret = null;
     if (!empty($this->prmOut)) {
         $content = ob_get_contents();
         ob_end_clean();
         if ($this->obSave) {
             echo $this->obSave . $content;
             ob_start();
         } else {
             echo $content;
         }
         $ret = file::write($this->prmOut['file'], $content);
     }
     $this->prmOut = null;
     return $ret;
 }
コード例 #9
0
ファイル: template.php プロジェクト: dalinhuang/zotop
 public function actionNewfile($dir = '')
 {
     $dir = empty($dir) ? zotop::get('dir') : $dir;
     $dir = trim(url::decode($dir), '/');
     $file = 'newfile.php';
     if (form::isPostBack()) {
         $file = zotop::post('name');
         $title = zotop::post('title');
         $description = zotop::post('description');
         $filepath = site::template($dir . DS . $file);
         $filecontent = "<?php\r\n/**\r\n * title:{$title}\r\n * description:{$description}\r\n*/\r\n?>";
         if (file::exists($filepath)) {
             msg::error(zotop::t('新建失败,当前目录已经存在文件:{$file}', array('file' => $file)));
         }
         if (file::write($filepath, $filecontent)) {
             msg::success('新建文件成功');
         }
         msg::error('新建文件失败');
     }
     $page = new dialog();
     $page->title = zotop::t('模板编辑器');
     $page->set('dir', $dir);
     $page->set('file', $file);
     $page->display();
 }
コード例 #10
0
ファイル: admin.core.php プロジェクト: dalinhuang/zotop
 /**
  * 应用程序重启
  *
  *
  * @return null
  */
 public static function reboot()
 {
     //清理运行时文件
     folder::clear(ZOTOP_PATH_RUNTIME);
     //加载全部配置
     zotop::config(@(include ZOTOP_PATH_DATA . DS . 'config.php'));
     zotop::config('zotop.database', @(include ZOTOP_PATH_DATA . DS . 'database.php'));
     zotop::config('zotop.application', @(include ZOTOP_PATH_DATA . DS . 'application.php'));
     zotop::config('zotop.module', @(include ZOTOP_PATH_DATA . DS . 'module.php'));
     zotop::config('zotop.router', @(include ZOTOP_PATH_DATA . DS . 'router.php'));
     zotop::register(@(include ZOTOP_PATH_MODULES . DS . 'system' . DS . 'libraries.php'));
     zotop::register(@(include ZOTOP_PATH_APPLICATION . DS . 'libraries.php'));
     //加载全部开启模块的hook以及注册类文件
     $modules = zotop::config('zotop.module');
     foreach ((array) $modules as $module) {
         if ((int) $module['status'] >= 0 && folder::exists($module['path'])) {
             //加载库文件
             zotop::register(@(include path::decode($module['path']) . DS . 'libraries.php'));
             //加载hook文件
             application::$hooks[] = $module['path'] . DS . 'hooks' . DS . ZOTOP_APPLICATION . '.php';
         }
     }
     //打包配置文件
     zotop::data(ZOTOP_PATH_RUNTIME . DS . ZOTOP_APPLICATION . '.config.php', zotop::config());
     //打包hook文件
     file::write(ZOTOP_PATH_RUNTIME . DS . ZOTOP_APPLICATION . '.hooks.php', application::compile(application::$hooks), true);
     //加载hooks以便核心文件使用
     zotop::load(ZOTOP_PATH_RUNTIME . DS . ZOTOP_APPLICATION . '.hooks.php');
     //打包类文件
     file::write(ZOTOP_PATH_RUNTIME . DS . ZOTOP_APPLICATION . '.core.php', application::compile(zotop::register()), true);
 }
コード例 #11
0
ファイル: couch.php プロジェクト: briancohan/FDSGeoSim
$f->add(new init(array("XYZ" => array(2.45, 4.35, 0.65), "DX" => 0.1, "PART_ID" => "ignitor particle", "N_PARTICLES" => 3)));
//Vents
$f->add(new vent(array("mb" => "xmin", "surf_id" => "open")));
$f->add(new vent(array("mb" => "xmax", "surf_id" => "open")));
$f->add(new vent(array("mb" => "ymin", "surf_id" => "open")));
//Boundary Files
$f->add(new bndf(array("QUANTITY" => "RADIATIVE HEAT FLUX")));
$f->add(new bndf(array("QUANTITY" => "CONVECTIVE HEAT FLUX")));
$f->add(new bndf(array("QUANTITY" => "NET HEAT FLUX")));
$f->add(new bndf(array("QUANTITY" => "WALL TEMPERATURE")));
$f->add(new bndf(array("QUANTITY" => "BURNING RATE")));
//Slice Files
$f->add(new slcf(array("PBX" => 2.5, "QUANTITY" => "TEMPERATURE", "VECTOR" => TRUE, "CELL_CENTERED" => TRUE)));
$f->add(new slcf(array("PBX" => 2.5, "QUANTITY" => "HRRPUV", "CELL_CENTERED" => TRUE)));
$f->add(new slcf(array("PBX" => 2.5, "QUANTITY" => "RADIATION LOSS", "CELL_CENTERED" => TRUE)));
$f->add(new slcf(array("PBX" => 2.5, "QUANTITY" => "VISCOSITY", "CELL_CENTERED" => TRUE)));
$f->add(new slcf(array("PBY" => 4.4, "QUANTITY" => "TEMPERATURE", "VECTOR" => TRUE, "CELL_CENTERED" => TRUE)));
$f->add(new slcf(array("PBY" => 4.4, "QUANTITY" => "HRRPUV", "CELL_CENTERED" => TRUE)));
$f->add(new slcf(array("PBY" => 4.4, "QUANTITY" => "RADIATION LOSS", "CELL_CENTERED" => TRUE)));
//Devices
$f->add(new devc(array("XYZ" => array(2.55, 4.4, 0.75), "QUANTITY" => "WALL TEMPERATURE", "IOR" => -2, "ID" => "temp")));
$f->add(new devc(array("XYZ" => array(2.55, 4.4, 0.75), "QUANTITY" => "BURNING RATE", "IOR" => -2, "ID" => "burn")));
$f->add(new devc(array("XYZ" => array(2.55, 4.4, 0.75), "QUANTITY" => "RADIATIVE HEAT FLUX", "IOR" => -2, "ID" => "rad")));
$f->add(new devc(array("XYZ" => array(2.55, 4.4, 0.75), "QUANTITY" => "GAUGE HEAT FLUX", "IOR" => -2, "ID" => "gauge")));
$f->add(new devc(array("XYZ" => array(2.55, 4.4, 0.75), "QUANTITY" => "CONVECTIVE HEAT FLUX", "IOR" => -2, "ID" => "con")));
$f->add(new devc(array("XYZ" => array(2.55, 4.35, 0.75), "QUANTITY" => "TEMPERATURE", "ID" => "gas")));
$f->add(new devc(array("XYZ" => array(2.55, 4.35, 0.75), "QUANTITY" => "HRRPUV", "ID" => "hrrpuv")));
$f->add(new devc(array("XYZ" => array(2.55, 4.35, 0.75), "QUANTITY" => "RADIATION LOSS", "ID" => "qr")));
$f->add(new devc(array("XYZ" => array(2.55, 4.35, 0.75), "QUANTITY" => "INTEGRATED INTENSITY", "ID" => "U")));
$f->write();
コード例 #12
0
 public static function createSesssionFile($name, $ext, $content)
 {
     $name = self::createFileName($name);
     $file = self::$sessionFolder . "/" . $name . $ext;
     if (!file_exists($file)) {
         touch($file);
         chmod($file, 0777);
         file::write($file, $content, false);
     } else {
         file::write($file, $content, false);
     }
     return $file;
 }
コード例 #13
0
ファイル: Pa2.php プロジェクト: craffft/contao-photoalbums2
 /**
  * Generate an XML files and save them to the root directory
  * @param array
  */
 protected function generateFiles($arrArchive)
 {
     $this->import('Database');
     $time = time();
     $strType = $arrArchive['format'] == 'atom' ? 'generateAtom' : 'generateRss';
     $strLink = $arrArchive['feedBase'] != '' ? $arrArchive['feedBase'] : $this->Environment->base;
     $strFile = $arrArchive['feedName'];
     $objFeed = new \Feed($strFile);
     $objFeed->link = $strLink;
     $objFeed->title = $arrArchive['title'];
     $objFeed->description = $arrArchive['description'];
     $objFeed->language = $arrArchive['language'];
     $objFeed->published = $arrArchive['tstamp'];
     // Get items
     $objArticleStmt = $this->Database->prepare("SELECT *, (SELECT name FROM tl_user u WHERE u.id=p.author) AS authorName FROM tl_photoalbums2_album p WHERE pid=? AND (start='' OR start<{$time}) AND (stop='' OR stop>{$time}) AND published=1 ORDER BY sorting ASC");
     if ($arrArchive['maxItems'] > 0) {
         $objArticleStmt->limit($arrArchive['maxItems']);
     }
     $objArticle = $objArticleStmt->execute($arrArchive['id']);
     // Get the default URL
     $objParent = \PageModel::findByPk($arrArchive['modulePage']);
     if ($objParent == null) {
         return;
     }
     $objParent = $this->getPageDetails($objParent->id);
     $strUrl = $this->generateFrontendUrl($objParent->row(), $GLOBALS['TL_CONFIG']['useAutoItem'] ? '/%s' : '/album/%s', $objParent->language);
     // Parse items
     if ($objArticle !== null) {
         while ($objArticle->next()) {
             // Deserialize image arrays
             $objArticle->images = deserialize($objArticle->images);
             $objArticle->imageSort = deserialize($objArticle->imageSort);
             // Sort images
             $objPa2ImageSorter = new \Pa2ImageSorter($objArticle->imageSortType, $objArticle->images, $objArticle->imageSort);
             $this->arrImages = $objPa2ImageSorter->getSortedUuids();
             $objItem = new \FeedItem();
             $objItem->title = $objArticle->title;
             $objItem->link = sprintf($strLink . $strUrl, $objArticle->alias != '' && !$GLOBALS['TL_CONFIG']['disableAlias'] ? $objArticle->alias : $objArticle->id);
             $objItem->published = $objArticle->startdate;
             $objItem->author = $objArticle->authorName;
             if (is_array($objArticle->arrImages) && count($objArticle->arrImages) > 0) {
                 foreach ($objArticle->arrImages as $image) {
                     if (is_file(TL_ROOT . '/' . $image)) {
                         $objItem->addEnclosure($image);
                     }
                 }
             }
             $objItem->description = $this->replaceInsertTags($objArticle->description);
             $objFeed->addItem($objItem);
         }
     }
     // Create file
     $objRss = new \file($strFile . '.xml');
     $objRss->write($this->replaceInsertTags($objFeed->{$strType}()));
     $objRss->close();
 }