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


PHP FileHandler::readFile方法代码示例

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


在下文中一共展示了FileHandler::readFile方法的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: 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

示例3: checkEasyinstall

 /**
  * check easy install
  * @return void
  */
 function checkEasyinstall()
 {
     $lastTime = (int) FileHandler::readFile($this->easyinstallCheckFile);
     if ($lastTime > $_SERVER['REQUEST_TIME'] - 60 * 60 * 24 * 30) {
         return;
     }
     $oAutoinstallModel = getModel('autoinstall');
     $params = array();
     $params["act"] = "getResourceapiLastupdate";
     $body = XmlGenerater::generate($params);
     $buff = FileHandler::getRemoteResource(_XE_DOWNLOAD_SERVER_, $body, 3, "POST", "application/xml");
     $xml_lUpdate = new XmlParser();
     $lUpdateDoc = $xml_lUpdate->parse($buff);
     $updateDate = $lUpdateDoc->response->updatedate->body;
     if (!$updateDate) {
         $this->_markingCheckEasyinstall();
         return;
     }
     $item = $oAutoinstallModel->getLatestPackage();
     if (!$item || $item->updatedate < $updateDate) {
         $oController = getAdminController('autoinstall');
         $oController->_updateinfo();
     }
     $this->_markingCheckEasyinstall();
 }
开发者ID:rhymix,项目名称:rhymix,代码行数:29,代码来源:admin.admin.view.php

示例4: getHtmlPage

 /**
  * @brief 외부 http로 요청되는 파일일 경우 파일을 받아와서 저장 후 return
  **/
 function getHtmlPage($path, $caching_interval, $cache_file)
 {
     // 캐시 검사
     if ($caching_interval > 0 && file_exists($cache_file) && filemtime($cache_file) + $caching_interval * 60 > time()) {
         $content = FileHandler::readFile($cache_file);
     } else {
         FileHandler::getRemoteFile($path, $cache_file);
         $content = FileHandler::readFile($cache_file);
     }
     // opage controller 생성
     $oOpageController =& getController('opage');
     // 외부 서버의 페이지 일 경우 이미지, css, javascript등의 url을 변경
     $content = $oOpageController->replaceSrc($content, $path);
     // 해당 문서를 utf-8로 변경
     $buff->content = $content;
     $buff = Context::convertEncoding($buff);
     $content = $buff->content;
     // title 추출
     $title = $oOpageController->getTitle($content);
     if ($title) {
         Context::setBrowserTitle($title);
     }
     // header script 추출
     $head_script = $oOpageController->getHeadScript($content);
     if ($head_script) {
         Context::addHtmlHeader($head_script);
     }
     // body 내용 추출
     $body_script = $oOpageController->getBodyScript($content);
     if (!$body_script) {
         $body_script = $content;
     }
     return $content;
 }
开发者ID:hottaro,项目名称:xpressengine,代码行数:37,代码来源:opage.view.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: _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

示例7: _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

示例8: getLicenseFromAgency

 function getLicenseFromAgency($prodid, &$has_license = TRUE, &$expiration = NULL)
 {
     $has_license = TRUE;
     $oLicenseModel =& getModel('license');
     $config = $oLicenseModel->getModuleConfig();
     if ($prodid == 'nstore') {
         $user_id = $config->user_id;
         $serial_number = $config->serial_number;
     } else {
         if ($prodid == 'nstore_digital') {
             $user_id = $config->d_user_id;
             $serial_number = $config->d_serial_number;
         } else {
             $user_id = $config->e_user_id;
             $serial_number = $config->e_serial_number;
         }
     }
     $cache_file = $this->checkLicense($prodid, $user_id, $serial_number);
     if (file_exists($cache_file)) {
         $oXml = new XmlParser();
         $buff = $oXml->parse(FileHandler::readFile($cache_file));
         // user
         $userObj = $buff->drm->user;
         if ($userObj) {
             $user = $userObj->body;
             if ($user != $user_id) {
                 $this->checkLicense($prodid, $user_id, $serial_number, TRUE);
                 return TRUE;
             }
         }
         // serial
         $serialObj = $buff->drm->serial;
         if ($serialObj) {
             $serial = $serialObj->body;
             if ($serial != $serial_number) {
                 $this->checkLicense($prodid, $user_id, $serial_number, TRUE);
                 return TRUE;
             }
         }
         // license
         $licenseObj = $buff->drm->license;
         if ($licenseObj) {
             $license = $licenseObj->body;
             if ($license == 'none') {
                 $url = getUrl('act', 'dispLicenseAdminConfig');
                 Context::set(sprintf('%s_MESSAGE_TYPE', strtoupper($prodid)), 'error');
                 Context::set(sprintf('%s_MESSAGE', strtoupper($prodid)), Context::getLang('not_registered'));
                 $has_license = FALSE;
             }
         }
         // expiration
         $expirationObj = $buff->drm->expiration;
         if ($expirationObj) {
             $expiration = $expirationObj->body;
         }
     }
     return FALSE;
 }
开发者ID:WEN2ER,项目名称:nurigo,代码行数:58,代码来源:license.model.php

示例9: loadXmlFile

 /**
  * Load a xml file specified by a filename and parse it to Return the resultant data object
  * @param string $filename a file path of file
  * @return array Returns a data object containing data extracted from a xml file or NULL if a specified file does not exist
  */
 function loadXmlFile($filename)
 {
     if (!file_exists($filename)) {
         return;
     }
     $buff = FileHandler::readFile($filename);
     $oXmlParser = new XmlParser();
     return $oXmlParser->parse($buff);
 }
开发者ID:kimkucheol,项目名称:xe-core,代码行数:14,代码来源:XmlParser.class.php

示例10: 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

示例11: makeTagCache

 /**
  * @brief liveXE 30일 내의 인기 태그 추출
  **/
 function makeTagCache($module_srl, $list_cnt = 15, $period = 30)
 {
     $cache_file = sprintf('%sfiles/cache/liveXE/%d.txt', _XE_PATH_, $module_srl);
     if (!file_exists($cache_file) || filemtime($cache_file) < time() - 60 * 5) {
         $args->module_srl = $module_srl;
         $args->list_count = $list_cnt;
         $args->date = date("YmdHis", time() - 60 * 60 * 24 * $period);
         $output = executeQueryArray('livexe.getPopularTags', $args);
         if (!$output->toBool() || !$output->data) {
             return array();
         }
         $tags = array();
         $max = 0;
         $min = 99999999;
         foreach ($output->data as $key => $val) {
             $tag = trim($val->tag);
             if (!$tag) {
                 continue;
             }
             $count = $val->count;
             if ($max < $count) {
                 $max = $count;
             }
             if ($min > $count) {
                 $min = $count;
             }
             $tags[] = $val;
         }
         $mid2 = $min + (int) (($max - $min) / 2);
         $mid1 = $mid2 + (int) (($max - $mid2) / 2);
         $mid3 = $min + (int) (($mid2 - $min) / 2);
         $output = null;
         foreach ($tags as $key => $item) {
             if ($item->count > $mid1) {
                 $rank = 1;
             } elseif ($item->count > $mid2) {
                 $rank = 2;
             } elseif ($item->count > $mid3) {
                 $rank = 3;
             } else {
                 $rank = 4;
             }
             $tags[$key]->rank = $rank;
         }
         shuffle($tags);
         FileHandler::writeFile($cache_file, serialize($tags));
     }
     $tags = unserialize(FileHandler::readFile($cache_file));
     return $tags;
 }
开发者ID:haegyung,项目名称:xe-module-live,代码行数:53,代码来源:livexe.controller.php

示例12: getTableInfo

 /**
  * Returns table information
  *
  * Used for finding column type info (string/numeric) <br />
  * Obtains the table info from XE's XML schema files
  *
  * @param object $query_id
  * @param bool $table_name
  * @return array
  */
 function getTableInfo($query_id, $table_name)
 {
     $column_type = array();
     $module = '';
     $id_args = explode('.', $query_id);
     if (count($id_args) == 2) {
         $target = 'modules';
         $module = $id_args[0];
         $id = $id_args[1];
     } else {
         if (count($id_args) == 3) {
             $target = $id_args[0];
             $targetList = array('modules' => 1, 'addons' => 1, 'widgets' => 1);
             if (!isset($targetList[$target])) {
                 return;
             }
             $module = $id_args[1];
             $id = $id_args[2];
         }
     }
     // get column properties from the table
     $table_file = sprintf('%s%s/%s/schemas/%s.xml', _XE_PATH_, 'modules', $module, $table_name);
     if (!file_exists($table_file)) {
         $searched_list = FileHandler::readDir(_XE_PATH_ . 'modules');
         $searched_count = count($searched_list);
         for ($i = 0; $i < $searched_count; $i++) {
             $table_file = sprintf('%s%s/%s/schemas/%s.xml', _XE_PATH_, 'modules', $searched_list[$i], $table_name);
             if (file_exists($table_file)) {
                 break;
             }
         }
     }
     if (file_exists($table_file)) {
         $table_xml = FileHandler::readFile($table_file);
         $xml_parser = new XmlParser();
         $table_obj = $xml_parser->parse($table_xml);
         if ($table_obj->table) {
             if (isset($table_obj->table->column) && !is_array($table_obj->table->column)) {
                 $table_obj->table->column = array($table_obj->table->column);
             }
             foreach ($table_obj->table->column as $k => $v) {
                 $column_type[$v->attrs->name] = $v->attrs->type;
             }
         }
     }
     return $column_type;
 }
开发者ID:rhymix,项目名称:rhymix,代码行数:57,代码来源:QueryParser.class.php

示例13: 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

示例14: 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

示例15: dispTextmessageAdminIndex

 /**
  * @brief Display Super Admin Dashboard
  **/
 function dispTextmessageAdminIndex()
 {
     $oTextmessageModel = getModel('textmessage');
     $config = $oTextmessageModel->getConfig();
     if (!$config) {
         Context::set('isSetupCompleted', false);
     } else {
         Context::set('isSetupCompleted', true);
     }
     Context::set('config', $config);
     //Retrieve recent news and set them into context
     $newest_news_url = sprintf("http://www.coolsms.co.kr/?module=newsagency&act=getNewsagencyArticle&inst=notice&loc=%s", _XE_LOCATION_);
     $cache_file = sprintf("%sfiles/cache/cool_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 textmessage registration 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 = new stdClass();
                 $obj->title = $val->body;
                 $obj->date = $val->attrs->date;
                 $obj->url = $val->attrs->url;
                 $news[] = $obj;
             }
             Context::set('news', $news);
         }
         Context::set('released_version', $buff->zbxe_news->attrs->released_version);
         Context::set('download_link', $buff->zbxe_news->attrs->download_link);
     }
     $this->setTemplateFile('index');
 }
开发者ID:bjrambo,项目名称:nurigo,代码行数:44,代码来源:textmessage.admin.view.php


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