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


PHP FileHandler::writeFile方法代码示例

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


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

示例1: getPoint

 /**
  * @brief Get the points
  */
 function getPoint($member_srl, $from_db = false)
 {
     $member_srl = abs($member_srl);
     // Get from instance memory
     if (!$from_db && $this->pointList[$member_srl]) {
         return $this->pointList[$member_srl];
     }
     // Get from file cache
     $path = sprintf(_XE_PATH_ . 'files/member_extra_info/point/%s', getNumberingPath($member_srl));
     $cache_filename = sprintf('%s%d.cache.txt', $path, $member_srl);
     if (!$from_db && file_exists($cache_filename)) {
         return $this->pointList[$member_srl] = trim(FileHandler::readFile($cache_filename));
     }
     // Get from the DB
     $args = new stdClass();
     $args->member_srl = $member_srl;
     $output = executeQuery('point.getPoint', $args);
     if (isset($output->data->member_srl)) {
         $point = (int) $output->data->point;
         $this->pointList[$member_srl] = $point;
         if (!is_dir($path)) {
             FileHandler::makeDir($path);
         }
         FileHandler::writeFile($cache_filename, $point);
         return $point;
     }
     return 0;
 }
开发者ID:kimkucheol,项目名称:xe-core,代码行数:31,代码来源:point.model.php

示例2: _getWidgetContent

 function _getWidgetContent()
 {
     // Arrange a widget ryeolro
     if ($this->module_info->mcontent) {
         $cache_file = sprintf("%sfiles/cache/page/%d.%s.m.cache.php", _XE_PATH_, $this->module_info->module_srl, Context::getLangType());
         $interval = (int) $this->module_info->page_caching_interval;
         if ($interval > 0) {
             if (!file_exists($cache_file) || filesize($cache_file) < 1) {
                 $mtime = 0;
             } else {
                 $mtime = filemtime($cache_file);
             }
             if ($mtime + $interval * 60 > time()) {
                 $page_content = FileHandler::readFile($cache_file);
                 $page_content = preg_replace('@<\\!--#Meta:@', '<!--Meta:', $page_content);
             } else {
                 $oWidgetController =& getController('widget');
                 $page_content = $oWidgetController->transWidgetCode($this->module_info->mcontent);
                 FileHandler::writeFile($cache_file, $page_content);
             }
         } else {
             if (file_exists($cache_file)) {
                 FileHandler::removeFile($cache_file);
             }
             $page_content = $this->module_info->mcontent;
         }
     } else {
         preg_match_all('!(<img)([^\\>]*)(widget=)([^\\>]*?)(\\>)!is', $this->module_info->content, $matches);
         $page_content = '';
         for ($i = 0, $c = count($matches[0]); $i < $c; $i++) {
             $page_content .= preg_replace('/ style\\=\\"([^\\"]+)\\" /i', ' style="overflow:hidden;clear:both;margin:0 0 20px 0; _margin-right:10px;" ', $matches[0][$i]) . "\n\n";
         }
     }
     return $page_content;
 }
开发者ID:relip,项目名称:xe-core,代码行数:35,代码来源:page.mobile.php

示例3: _getWidgetContent

 function _getWidgetContent()
 {
     // Arrange a widget ryeolro
     if ($this->module_info->mcontent) {
         $cache_file = sprintf("%sfiles/cache/page/%d.%s.m.cache.php", _XE_PATH_, $this->module_info->module_srl, Context::getLangType());
         $interval = (int) $this->module_info->page_caching_interval;
         if ($interval > 0) {
             if (!file_exists($cache_file) || filesize($cache_file) < 1) {
                 $mtime = 0;
             } else {
                 $mtime = filemtime($cache_file);
             }
             if ($mtime + $interval * 60 > $_SERVER['REQUEST_TIME']) {
                 $page_content = FileHandler::readFile($cache_file);
                 $page_content = preg_replace('@<\\!--#Meta:@', '<!--Meta:', $page_content);
             } else {
                 $oWidgetController = getController('widget');
                 $page_content = $oWidgetController->transWidgetCode($this->module_info->mcontent);
                 FileHandler::writeFile($cache_file, $page_content);
             }
         } else {
             if (file_exists($cache_file)) {
                 FileHandler::removeFile($cache_file);
             }
             $page_content = $this->module_info->mcontent;
         }
     } else {
         $page_content = $this->module_info->content;
     }
     return $page_content;
 }
开发者ID:rhymix,项目名称:rhymix,代码行数:31,代码来源:page.mobile.php

示例4: getNewsFromAgency

function getNewsFromAgency()
{
    //Retrieve recent news and set them into context
    $newest_news_url = sprintf("http://www.xeshoppingmall.com/?module=newsagency&act=getNewsagencyArticle&inst=notice&top=6&loc=%s", _XE_LOCATION_);
    $cache_file = sprintf("%sfiles/cache/nstore_news.%s.cache.php", _XE_PATH_, _XE_LOCATION_);
    if (!file_exists($cache_file) || filemtime($cache_file) + 60 * 60 < time()) {
        // Considering if data cannot be retrieved due to network problem, modify filemtime to prevent trying to reload again when refreshing textmessageistration page
        // Ensure to access the textmessageistration page even though news cannot be displayed
        FileHandler::writeFile($cache_file, '');
        FileHandler::getRemoteFile($newest_news_url, $cache_file, null, 1, 'GET', 'text/html', array('REQUESTURL' => getFullUrl('')));
    }
    if (file_exists($cache_file)) {
        $oXml = new XmlParser();
        $buff = $oXml->parse(FileHandler::readFile($cache_file));
        $item = $buff->zbxe_news->item;
        if ($item) {
            if (!is_array($item)) {
                $item = array($item);
            }
            foreach ($item as $key => $val) {
                $obj = null;
                $obj->title = $val->body;
                $obj->date = $val->attrs->date;
                $obj->url = $val->attrs->url;
                $news[] = $obj;
            }
            return $news;
        }
    }
}
开发者ID:umjinsun12,项目名称:dngshin,代码行数:30,代码来源:functions.php

示例5: dispPageIndex

 /**
  * @brief 일반 요청시 출력
  **/
 function dispPageIndex()
 {
     // 템플릿에서 사용할 변수를 Context::set()
     if ($this->module_srl) {
         Context::set('module_srl', $this->module_srl);
     }
     // 캐시 파일 지정
     $cache_file = sprintf("%sfiles/cache/page/%d.%s.cache.php", _XE_PATH_, $this->module_info->module_srl, Context::getLangType());
     $interval = (int) $this->module_info->page_caching_interval;
     if ($interval > 0) {
         if (!file_exists($cache_file)) {
             $mtime = 0;
         } else {
             $mtime = filemtime($cache_file);
         }
         if ($mtime + $interval * 60 > time()) {
             $page_content = FileHandler::readFile($cache_file);
         } else {
             $oWidgetController =& getController('widget');
             $page_content = $oWidgetController->transWidgetCode($this->module_info->content);
             FileHandler::writeFile($cache_file, $page_content);
         }
     } else {
         if (file_exists($cache_file)) {
             FileHandler::removeFile($cache_file);
         }
         $page_content = $this->module_info->content;
     }
     Context::set('module_info', $this->module_info);
     Context::set('page_content', $page_content);
     $this->setTemplateFile('content');
 }
开发者ID:hottaro,项目名称:xpressengine,代码行数:35,代码来源:page.view.php

示例6: procAuthenticationAdminConfig

 function procAuthenticationAdminConfig()
 {
     $args = Context::getRequestVars();
     if (!trim(strip_tags($args->agreement))) {
         $agreement_file = _XE_PATH_ . 'files/authentication/agreement_' . Context::get('lang_type') . '.txt';
         FileHandler::removeFile($agreement_file);
         $args->agreement = NULL;
     }
     // check agreement value exist
     if ($args->agreement) {
         $agreement_file = _XE_PATH_ . 'files/authentication/agreement_' . Context::get('lang_type') . '.txt';
         $output = FileHandler::writeFile($agreement_file, $args->agreement);
         unset($args->agreement);
     }
     if (!$args->sender_no) {
         $args->sender_no = NULL;
     }
     if (!$args->message_content) {
         $args->message_content = NULL;
     }
     if (!$args->list) {
         $args->list = NULL;
     }
     if (!$args->cellphone_fieldname) {
         $args->cellphone_fieldname = NULL;
     }
     // save module configuration.
     $oModuleController = getController('module');
     $output = $oModuleController->updateModuleConfig('authentication', $args);
     $this->setMessage('success_saved');
     $redirectUrl = getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAuthenticationAdminConfig');
     $this->setRedirectUrl($redirectUrl);
 }
开发者ID:umjinsun12,项目名称:dngshin,代码行数:33,代码来源:authentication.admin.controller.php

示例7: put

 /**
  * Cache a variable in the data store
  *
  * @param string $key Store the variable using this name.
  * @param mixed $obj The variable to store
  * @param int $valid_time Not used
  * @return void
  */
 function put($key, $obj, $valid_time = 0)
 {
     $cache_file = $this->getCacheFileName($key);
     $content = array();
     $content[] = '<?php';
     $content[] = 'if(!defined(\'__XE__\')) { exit(); }';
     $content[] = 'return \'' . addslashes(serialize($obj)) . '\';';
     FileHandler::writeFile($cache_file, implode(PHP_EOL, $content));
 }
开发者ID:conory,项目名称:rhymix,代码行数:17,代码来源:CacheFile.class.php

示例8: dispInstallCheckEnv

 /**
  * @brief Display messages about installation environment
  */
 function dispInstallCheckEnv()
 {
     // Create a temporary file for mod_rewrite check.
     self::$rewriteCheckString = Password::createSecureSalt(32);
     FileHandler::writeFile(_XE_PATH_ . self::$rewriteCheckFilePath, self::$rewriteCheckString);
     // Check if the web server is nginx.
     Context::set('use_nginx', stripos($_SERVER['SERVER_SOFTWARE'], 'nginx') !== false);
     $this->setTemplateFile('check_env');
 }
开发者ID:kkkyyy03,项目名称:coffeemix,代码行数:12,代码来源:install.view.php

示例9: getThumbnailByUrl

 function getThumbnailByUrl($image_url, $width = 80, $height = 0, $thumbnail_type = '')
 {
     if (!$height) {
         $height = $width;
     }
     if (!in_array($thumbnail_type, array('crop', 'ratio'))) {
         $config = $GLOBALS['__document_config__'];
         if (!$config) {
             $oDocumentModel = getModel('document');
             $config = $oDocumentModel->getDocumentConfig();
             $GLOBALS['__document_config__'] = $config;
         }
         $thumbnail_type = $config->thumbnail_type;
     }
     if (!is_dir('./files/thumbnails/magiccontent_thumbnail')) {
         FileHandler::makeDir('./files/thumbnails/magiccontent_thumbnail');
     }
     $thumbnail_path = sprintf('files/thumbnails/magiccontent_thumbnail/%s', base64_encode($image_url));
     $thumbnail_file = sprintf('%s%dx%d.%s.jpg', $thumbnail_path, $width, $height, $thumbnail_type);
     $thumbnail_url = Context::getRequestUri() . $thumbnail_file;
     if (file_exists($thumbnail_file)) {
         if (filesize($thumbnail_file) < 1) {
             return false;
         } else {
             return $thumbnail_url;
         }
     }
     $tmp_file = sprintf('./files/cache/tmp/%s', md5(rand(111111, 999999) . $image_url));
     if (!is_dir('./files/cache/tmp')) {
         FileHandler::makeDir('./files/cache/tmp');
     }
     if (!preg_match('/^(http|https):\\/\\//i', $image_url)) {
         $image_url = Context::getRequestUri() . $image_url;
     }
     FileHandler::getRemoteFile($image_url, $tmp_file);
     if (!file_exists($tmp_file)) {
         return false;
     } else {
         list($_w, $_h, $_t, $_a) = @getimagesize($tmp_file);
         if (!in_array($_t, array(1, 2, 3, 6, 7, 8))) {
             FileHandler::writeFile($thumbnail_file, '', 'w');
             return false;
         }
         $source_file = $tmp_file;
     }
     $output = FileHandler::createImageFile($source_file, $thumbnail_file, $width, $height, 'jpg', $thumbnail_type);
     FileHandler::removeFile($source_file);
     if ($output) {
         return $thumbnail_url;
     } else {
         FileHandler::writeFile($thumbnail_file, '', 'w');
     }
     return false;
 }
开发者ID:ilbecms,项目名称:xe_module_magiccontent,代码行数:54,代码来源:magiccontent.model.php

示例10: checkLicense

 function checkLicense($prodid, $user_id, $serial_number, $force = FALSE)
 {
     $hostinfo = array($_SERVER['SERVER_ADDR'], $_SERVER['SERVER_NAME'], $_SERVER['HTTP_HOST']);
     $agency_url = sprintf("http://www.xeshoppingmall.com/?module=drmagency&act=getDrmagencyLicense&prodid=%s&hostinfo=%s&user=%s&serial=%s", $prodid, implode(',', $hostinfo), $user_id, $serial_number);
     $cache_file = sprintf("%sfiles/cache/license_%s.cache.php", _XE_PATH_, $prodid);
     if (!file_exists($cache_file) || filemtime($cache_file) + 60 * 60 < time() || $force == TRUE) {
         FileHandler::writeFile($cache_file, '');
         FileHandler::getRemoteFile($agency_url, $cache_file, null, 1, 'GET', 'text/html', array('REQUESTURL' => getFullUrl('')));
     }
     return $cache_file;
 }
开发者ID:WEN2ER,项目名称:nurigo,代码行数:11,代码来源:license.model.php

示例11: dispNcenterliteAdminConfig

 function dispNcenterliteAdminConfig()
 {
     $oModuleModel = getModel('module');
     $oNcenterliteModel = getModel('ncenterlite');
     $oLayoutModel = getModel('layout');
     $config = $oNcenterliteModel->getConfig();
     Context::set('config', $config);
     $layout_list = $oLayoutModel->getLayoutList();
     Context::set('layout_list', $layout_list);
     $mobile_layout_list = $oLayoutModel->getLayoutList(0, 'M');
     Context::set('mlayout_list', $mobile_layout_list);
     $skin_list = $oModuleModel->getSkins($this->module_path);
     Context::set('skin_list', $skin_list);
     $mskin_list = $oModuleModel->getSkins($this->module_path, "m.skins");
     Context::set('mskin_list', $mskin_list);
     if (!$skin_list[$config->skin]) {
         $config->skin = 'default';
     }
     Context::set('colorset_list', $skin_list[$config->skin]->colorset);
     if (!$mskin_list[$config->mskin]) {
         $config->mskin = 'default';
     }
     Context::set('mcolorset_list', $mskin_list[$config->mskin]->colorset);
     $security = new Security();
     $security->encodeHTML('config..');
     $security->encodeHTML('skin_list..title');
     $security->encodeHTML('colorset_list..name', 'colorset_list..title');
     $mid_list = $oModuleModel->getMidList(null, array('module_srl', 'mid', 'browser_title', 'module'));
     Context::set('mid_list', $mid_list);
     // 사용환경정보 전송 확인
     $ncenterlite_module_info = $oModuleModel->getModuleInfoXml('ncenterlite');
     $agreement_file = FileHandler::getRealPath(sprintf('%s%s.txt', './files/ncenterlite/ncenterlite-', $ncenterlite_module_info->version));
     $agreement_ver_file = FileHandler::getRealPath(sprintf('%s%s.txt', './files/ncenterlite/ncenterlite_ver-', $ncenterlite_module_info->version));
     if (file_exists($agreement_file)) {
         $agreement = FileHandler::readFile($agreement_file);
         Context::set('_ncenterlite_env_agreement', $agreement);
         $agreement_ver = FileHandler::readFile($agreement_ver_file);
         if ($agreement == 'Y') {
             $_ncenterlite_iframe_url = 'http://sosifam.com/index.php?mid=ncenterlite_iframe';
             if (!$agreement_ver) {
                 $_host_info = urlencode($_SERVER['HTTP_HOST']) . '-NC' . $ncenterlite_module_info->version . '-PHP' . phpversion() . '-XE' . __XE_VERSION__;
             }
             Context::set('_ncenterlite_iframe_url', $_ncenterlite_iframe_url . '&_host=' . $_host_info);
             Context::set('ncenterlite_module_info', $ncenterlite_module_info);
         }
         FileHandler::writeFile($agreement_ver_file, 'Y');
     } else {
         Context::set('_ncenterlite_env_agreement', 'NULL');
     }
 }
开发者ID:leehankyeol,项目名称:JaWeTip,代码行数:50,代码来源:ncenterlite.admin.view.php

示例12: strtolower

 /**
  * 1. Read xml file<br />
  * 2. Check the action<br />
  * 3. Parsing and write a cache file<br />
  * @return QueryParser object
  */
 function &parse_xml_query($query_id, $xml_file, $cache_file)
 {
     // Read xml file
     $xml_obj = $this->getXmlFileContent($xml_file);
     // insert, update, delete, select action
     $action = strtolower($xml_obj->query->attrs->action);
     if (!$action) {
         return;
     }
     // Write query cache file
     $parser = new QueryParser($xml_obj->query);
     FileHandler::writeFile($cache_file, $parser->toString());
     return $parser;
 }
开发者ID:relip,项目名称:xe-core,代码行数:20,代码来源:XmlQueryParser.150.class.php

示例13: setExifCache

function setExifCache($cache_path, $cache_file, &$exif_data)
{
    if (!$exif_data['make']) {
        return false;
    }
    unset($exif_data['Thumbnail']);
    $cache = '<?php if(!defined("__ZBXE__")) exit();' . "\r\n";
    foreach ($exif_data as $key => $val) {
        $cache .= "\$exif_data['" . $key . "'] = \"" . $val . "\";\r\n";
    }
    $cache .= '?>';
    if (!is_dir($cache_path)) {
        FileHandler::makeDir($cache_path);
    }
    FileHandler::writeFile($cache_path . $cache_file, $cache);
}
开发者ID:noxowl,项目名称:Yojouhankai-Sketchbook5,代码行数:16,代码来源:exif.lib.php

示例14: getPoint

 /**
  * @brief 포인트를 구해옴
  **/
 function getPoint($member_srl, $from_db = false)
 {
     $member_srl = abs($member_srl);
     $path = sprintf('./files/member_extra_info/point/%s', getNumberingPath($member_srl));
     if (!is_dir($path)) {
         FileHandler::makeDir($path);
     }
     $cache_filename = sprintf('%s%d.cache.txt', $path, $member_srl);
     if (!$from_db && file_exists($cache_filename)) {
         return trim(FileHandler::readFile($cache_filename));
     }
     // DB에서 가져옴
     $args->member_srl = $member_srl;
     $output = executeQuery('point.getPoint', $args);
     $point = (int) $output->data->point;
     FileHandler::writeFile($cache_filename, $point);
     return $point;
 }
开发者ID:hottaro,项目名称:xpressengine,代码行数:21,代码来源:point.model.php

示例15: getWikiTreeList

 /**
  * @brief 계층구조 추출
  * document_category테이블을 이용해서 위키 문서의 계층 구조도를 그림
  * document_category테이블에 등록되어 있지 않은 경우 depth = 0 으로 하여 신규 생성
  **/
 function getWikiTreeList()
 {
     header("Content-Type: text/xml; charset=UTF-8");
     header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
     header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
     header("Cache-Control: no-store, no-cache, must-revalidate");
     header("Cache-Control: post-check=0, pre-check=0", false);
     header("Pragma: no-cache");
     $oModuleModel =& getModel('module');
     $mid = Context::get('mid');
     $cache_file = sprintf('%sfiles/cache/wiki/%d.xml', _XE_PATH_, $this->module_srl);
     if ($this->grant->write_document || !file_exists($cache_file)) {
         FileHandler::writeFile($cache_file, $this->loadWikiTreeList($this->module_srl));
     }
     print FileHandler::readFile($cache_file);
     Context::close();
     exit;
 }
开发者ID:hottaro,项目名称:xpressengine,代码行数:23,代码来源:wiki.model.php


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