• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP io_saveFile函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中io_saveFile函数的典型用法代码示例。如果您正苦于以下问题:PHP io_saveFile函数的具体用法?PHP io_saveFile怎么用?PHP io_saveFile使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: checkUpdateMessages

/**
 * Check for new messages from upstream
 *
 * @author Andreas Gohr <[email protected]>
 */
function checkUpdateMessages()
{
    global $conf;
    global $INFO;
    global $updateVersion;
    if (!$conf['updatecheck']) {
        return;
    }
    if ($conf['useacl'] && !$INFO['ismanager']) {
        return;
    }
    $cf = $conf['cachedir'] . '/messages.txt';
    $lm = @filemtime($cf);
    // check if new messages needs to be fetched
    if ($lm < time() - 60 * 60 * 24 || $lm < @filemtime(DOKU_INC . DOKU_SCRIPT)) {
        @touch($cf);
        dbglog("checkUpdatesMessages(): downloading messages.txt");
        $http = new DokuHTTPClient();
        $http->timeout = 12;
        $data = $http->get(DOKU_MESSAGEURL . $updateVersion);
        io_saveFile($cf, $data);
    } else {
        dbglog("checkUpdatesMessages(): messages.txt up to date");
        $data = io_readFile($cf);
    }
    // show messages through the usual message mechanism
    $msgs = explode("\n%\n", $data);
    foreach ($msgs as $msg) {
        if ($msg) {
            msg($msg, 2);
        }
    }
}
开发者ID:ngharaibeh,项目名称:Methodikos,代码行数:38,代码来源:infoutils.php


示例2: handle

 /**
  * Handle the match
  */
 function handle($data, $state, $pos, Doku_Handler $handler)
 {
     $data = explode("\n", $data);
     $conf = array_shift($data);
     array_pop($data);
     $conf = trim(substr($conf, 10, -1));
     $conf = $this->parseOpts($conf);
     // parse
     $count = count($data);
     for ($i = 0; $i < $count; $i++) {
         // copy line, free memory
         $line = $data[$i];
         unset($data[$i]);
         $line = trim($line);
         $line = rtrim($line, " ;");
         if (strpos($line, '->') === false) {
             $opt = $this->parseNode($line);
         } else {
             $opt = $this->parseEdge($line);
         }
     }
     $xml = $this->getXML($conf, $w, $h);
     $xmlid = md5($xml);
     $cache = getcachename($xmlid, 'graphgear');
     io_saveFile($cache, $xml);
     return array('xmlid' => $xmlid, 'width' => $w, 'height' => $h);
 }
开发者ID:splitbrain,项目名称:dokuwiki-plugin-graphgear,代码行数:30,代码来源:syntax.php


示例3: checkUpdateMessages

/**
 * Check for new messages from upstream
 *
 * @author Andreas Gohr <[email protected]>
 */
function checkUpdateMessages()
{
    global $conf;
    global $INFO;
    if (!$conf['updatecheck']) {
        return;
    }
    if ($conf['useacl'] && !$INFO['ismanager']) {
        return;
    }
    $cf = $conf['cachedir'] . '/messages.txt';
    $lm = @filemtime($cf);
    // check if new messages needs to be fetched
    if ($lm < time() - 60 * 60 * 24 || $lm < @filemtime(DOKU_CONF . 'msg')) {
        $num = @file(DOKU_CONF . 'msg');
        $num = is_array($num) ? (int) $num[0] : 0;
        $http = new DokuHTTPClient();
        $http->timeout = 8;
        $data = $http->get(DOKU_MESSAGEURL . $num);
        io_saveFile($cf, $data);
    } else {
        $data = io_readFile($cf);
    }
    // show messages through the usual message mechanism
    $msgs = explode("\n%\n", $data);
    foreach ($msgs as $msg) {
        if ($msg) {
            msg($msg, 2);
        }
    }
}
开发者ID:pyfun,项目名称:dokuwiki,代码行数:36,代码来源:infoutils.php


示例4: handle_ajax_call

 public function handle_ajax_call()
 {
     global $INPUT;
     header('Content-Type: text/plain');
     $langCode = $INPUT->str('lang');
     $text = $INPUT->str('text');
     $dir = DOKU_CONF . 'lang/' . $langCode;
     $file = $dir . '/register.txt';
     // make sure the directory exists
     if (!file_exists($dir)) {
         if (mkdir($dir, 0755) === false) {
             echo $this->getLang('makeDirError');
             return;
         }
     }
     // save the file
     if (file_put_contents($file, $text) === false) {
         echo $this->getLang('saveFileError');
         return;
     }
     // set file permissions
     chmod($file, 0644);
     // log the change
     $timestamp = time();
     $id = $langCode . ':register';
     addLogEntry($timestamp, $id);
     // save this revision in the attic
     $atticFile = wikiFN($id, $timestamp, true);
     io_saveFile($atticFile, $text, false);
     // send OK to the browser
     echo 'OK';
 }
开发者ID:richmahn,项目名称:Door43,代码行数:32,代码来源:RegisterEdit.php


示例5: handle

 /**
  * Handle the match
  */
 function handle($match, $state, $pos, &$handler)
 {
     global $ID;
     global $ACT;
     // don't show linkback section on blog mainpages
     if (defined('IS_BLOG_MAINPAGE')) {
         return false;
     }
     // don't allow usage of syntax in comments
     if (isset($_REQUEST['comment'])) {
         return false;
     }
     // get linkback meta file name
     $file = metaFN($ID, '.linkbacks');
     $data = array('send' => false, 'receive' => false, 'display' => false, 'sentpings' => array(), 'receivedpings' => array(), 'number' => 0);
     if (@file_exists($file)) {
         $data = unserialize(io_readFile($file, false));
     }
     if ($match == '~~LINKBACK~~') {
         $data['receive'] = true;
         $data['display'] = true;
     } else {
         if ($match == '~~LINKBACK:off~~') {
             $data['receive'] = false;
             $data['display'] = false;
         } else {
             $data['receive'] = false;
             $data['display'] = true;
         }
     }
     io_saveFile($file, serialize($data));
 }
开发者ID:omusico,项目名称:isle-web-framework,代码行数:35,代码来源:syntax.php


示例6: handle

 /**
  * Handle the match
  */
 function handle($match, $state, $pos, &$handler)
 {
     global $ID, $ACT;
     // strip markup
     $match = substr($match, 12, -2);
     // split title (if there is one)
     list($match, $title) = explode('|', $match, 2);
     // assign discussion state
     if ($match == ':off') {
         $status = 0;
     } else {
         if ($match == ':closed') {
             $status = 2;
         } else {
             $status = 1;
         }
     }
     if ($ACT == 'preview') {
         return;
     }
     // get discussion meta file name
     $file = metaFN($ID, '.comments');
     $data = array();
     if (@file_exists($file)) {
         $data = unserialize(io_readFile($file, false));
     }
     $data['title'] = $title;
     $data['status'] = $status;
     io_saveFile($file, serialize($data));
     return $status;
 }
开发者ID:NikolausL,项目名称:plugin-discussion,代码行数:34,代码来源:comments.php


示例7: handle

 /**
  * Handle the match
  */
 function handle($match, $state, $pos, Doku_Handler $handler)
 {
     $info = $this->getInfo();
     // prepare default data
     $return = array('width' => 0, 'height' => 0, 'layout' => 'dot', 'align' => '', 'version' => $info['date']);
     // prepare input
     $lines = explode("\n", $match);
     $conf = array_shift($lines);
     array_pop($lines);
     // match config options
     if (preg_match('/\\b(left|center|right)\\b/i', $conf, $match)) {
         $return['align'] = $match[1];
     }
     if (preg_match('/\\b(\\d+)x(\\d+)\\b/', $conf, $match)) {
         $return['width'] = $match[1];
         $return['height'] = $match[2];
     }
     if (preg_match('/\\b(dot|neato|twopi|circo|fdp)\\b/i', $conf, $match)) {
         $return['layout'] = strtolower($match[1]);
     }
     if (preg_match('/\\bwidth=([0-9]+)\\b/i', $conf, $match)) {
         $return['width'] = $match[1];
     }
     if (preg_match('/\\bheight=([0-9]+)\\b/i', $conf, $match)) {
         $return['height'] = $match[1];
     }
     $input = join("\n", $lines);
     $return['md5'] = md5($input);
     // we only pass a hash around
     // store input for later use
     io_saveFile($this->_cachename($return, 'txt'), $input);
     return $return;
 }
开发者ID:janosroden,项目名称:dokuwiki-plugin-graphviz,代码行数:36,代码来源:syntax.php


示例8: handle_approve

 function handle_approve(&$event, $param)
 {
     global $ID, $REV, $INFO;
     if ($event->data == 'show' && isset($_GET['approve'])) {
         if (!$this->can_approve()) {
             return;
         }
         //change last commit comment to Approved
         $meta = p_read_metadata($ID);
         $meta[current][last_change][sum] = $meta[persistent][last_change][sum] = APPROVED;
         $meta[current][last_change][user] = $meta[persistent][last_change][user] = $INFO[client];
         if (!array_key_exists($INFO[client], $meta[current][contributor])) {
             $meta[current][contributor][$INFO[client]] = $INFO[userinfo][name];
             $meta[persistent][contributor][$INFO[client]] = $INFO[userinfo][name];
         }
         p_save_metadata($ID, $meta);
         //update changelog
         //remove last line from file
         $changelog_file = metaFN($ID, '.changes');
         $changes = file($changelog_file, FILE_SKIP_EMPTY_LINES);
         $lastLogLine = array_pop($changes);
         $info = parseChangelogLine($lastLogLine);
         $info[user] = $INFO[client];
         $info[sum] = APPROVED;
         $logline = implode("\t", $info) . "\n";
         array_push($changes, $logline);
         io_saveFile($changelog_file, implode('', $changes));
         header('Location: ?id=' . $ID);
     }
 }
开发者ID:vincentkersten,项目名称:dokuwiki-plugin-approve,代码行数:30,代码来源:approve.php


示例9: _saveMeta

 /**
  * Saves the name of the uploaded media file to a meta file
  */
 function _saveMeta(&$event)
 {
     global $conf;
     $id = $event->data[2];
     $filename_tidy = noNS($id);
     // retrieve original filename
     if (!empty($_POST['id'])) {
         // via normal uploader
         $filename_pat = $conf['useslash'] ? '/([^:;\\/]*)$/' : '/([^:;]*)$/';
         preg_match($filename_pat, $_POST['id'], $matches);
         $filename_orig = $matches[1];
     } elseif (isset($_FILES['Filedata'])) {
         // via multiuploader
         $filename_orig = $_FILES['upload']['name'];
     } else {
         return;
     }
     $filename_safe = $this->common->_sanitizeFileName($filename_orig);
     // no need to save original filename
     if ($filename_tidy === $filename_safe) {
         return;
     }
     // fallback if suspicious characters found
     if ($filename_orig !== $filename_safe) {
         return;
     }
     // save original filename to metadata
     $metafile = metaFN($id, '.filename');
     io_saveFile($metafile, serialize(array('filename' => $filename_safe)));
 }
开发者ID:kazmiya,项目名称:dokuwiki-plugin-preservefilenames,代码行数:33,代码来源:action_anteater.php


示例10: handle

 /**
  * handle user request
  */
 function handle()
 {
     if ($_POST['redirdata']) {
         if (io_saveFile(dirname(__FILE__) . '/redirect.conf', cleanText($_POST['redirdata']))) {
             msg($this->getLang('saved'), 1);
         }
     }
 }
开发者ID:omusico,项目名称:isle-web-framework,代码行数:11,代码来源:admin.php


示例11: _write

 function _write($file)
 {
     $contents = "The\nWrite\nTest\n";
     $this->assertTrue(io_saveFile($file, $contents));
     $this->assertEquals($contents, io_readFile($file));
     $this->assertTrue(io_saveFile($file, $contents, true));
     $this->assertEquals($contents . $contents, io_readFile($file));
 }
开发者ID:richmahn,项目名称:Door43,代码行数:8,代码来源:io_savefile.test.php


示例12: save_dbnames_ser

 function save_dbnames_ser($fname, $content)
 {
     if (function_exists(io_saveFile)) {
         return io_saveFile($fname, $content);
     } else {
         return file_put_contents($names_fname, $content);
     }
 }
开发者ID:omusico,项目名称:isle-web-framework,代码行数:8,代码来源:helper.php


示例13: numberingDB

function numberingDB()
{
    $db = metaFN("numbering:seqnum", '.ser');
    if (!file_exists($db)) {
        io_saveFile($db, "", array());
    }
    return $db;
}
开发者ID:omusico,项目名称:isle-web-framework,代码行数:8,代码来源:getnum.php


示例14: _enableAutosubmit

 /**
  * Enable or disable autosubmit
  * @param bool $enable If TRUE, it will enable autosubmit. Else, it will disable it.
  */
 function _enableAutosubmit($enable)
 {
     if ($enable) {
         io_saveFile($this->helper->autosubmitFile, ' ');
     } else {
         @unlink($this->helper->autosubmitFile);
     }
 }
开发者ID:kevinlovesing,项目名称:dokuwiki,代码行数:12,代码来源:admin.php


示例15: writeCache

 function writeCache($id)
 {
     if (!$this->is_inCache($id)) {
         $this->cache[md5($id)] = $id;
         io_saveFile($this->script_file, serialize($this->cache));
         return true;
     }
     return false;
 }
开发者ID:omusico,项目名称:isle-web-framework,代码行数:9,代码来源:helper.php


示例16: process_feed

 /**
  */
 function process_feed(&$event, $param)
 {
     global $ID;
     if ($this->helper->pageUpdated()) {
         $metafile = metaFN('newsfeed:wasupdated', '.meta');
         io_saveFile($metafile, time() . "\n" . $ID . "\n");
         $this->helper->saveFeedData($ID);
     }
 }
开发者ID:omusico,项目名称:isle-web-framework,代码行数:11,代码来源:action.php


示例17: test_delete

 function test_delete()
 {
     $file = TMP_DIR . '/test.txt';
     $contents = "The\nDelete\nDelete01\nDelete02\nDelete\nDeleteX\nTest\n";
     io_saveFile($file, $contents);
     $this->assertTrue(io_deleteFromFile($file, "Delete\n"));
     $this->assertEquals("The\nDelete01\nDelete02\nDeleteX\nTest\n", io_readFile($file));
     $this->assertTrue(io_deleteFromFile($file, "#Delete\\d+\n#", true));
     $this->assertEquals("The\nDeleteX\nTest\n", io_readFile($file));
 }
开发者ID:richmahn,项目名称:Door43,代码行数:10,代码来源:io_deletefromfile.test.php


示例18: setUp

 public function setUp()
 {
     parent::setUp();
     $opts_file = dirname(DOKU_CONF) . '/data/meta/__move_opts';
     if (file_exists($opts_file)) {
         unlink($opts_file);
     }
     $file = "oldns:page01\tnewns:page01\n" . "oldns:page02\tnewns:page02\n" . "oldns:page03\tnewns:page03\n" . "oldns:page04\tnewns:page04\n" . "oldns:page05\tnewns:page05\n" . "oldns:page06\tnewns:page06\n" . "oldns:page07\tnewns:page07\n" . "oldns:page08\tnewns:page08\n" . "oldns:page09\tnewns:page09\n" . "oldns:page10\tnewns:page10\n" . "oldns:page11\tnewns:page11\n" . "oldns:page12\tnewns:page12\n" . "oldns:page13\tnewns:page13\n" . "oldns:page14\tnewns:page14\n" . "oldns:page15\tnewns:page15\n" . "oldns:page16\tnewns:page16\n" . "oldns:page17\tnewns:page17\n" . "oldns:page18\tnewns:page18";
     $file_path = dirname(DOKU_CONF) . '/data/meta/__move_pagelist';
     io_saveFile($file_path, $file);
 }
开发者ID:kochichi,项目名称:dokuwiki-plugin-move,代码行数:11,代码来源:stepThroughDocuments.test.php


示例19: _log

 function _log($msg)
 {
     global $conf;
     $user = $_SERVER['REMOTE_USER'];
     if (!$user) {
         $user = $_REQUEST['u'];
     }
     $t = time();
     $log = $t . "\t" . strftime($conf['dformat'], $t) . "\t" . $_SERVER['REMOTE_ADDR'] . "\t" . $user . "\t" . $msg;
     io_saveFile($conf['cachedir'] . '/loglog.log', "{$log}\n", true);
 }
开发者ID:omusico,项目名称:isle-web-framework,代码行数:11,代码来源:action.php


示例20: addBook

 function addBook($id, $epub, $title)
 {
     $md5 = md5($id);
     if (!$this->is_inCache($id)) {
         $this->cache[$md5] = $id;
     }
     if (!isset($this->cache['current_books'])) {
         $this->cache['current_books'] = array();
     }
     $this->cache['current_books'][$md5] = array('title' => $title, 'epub' => $epub);
     io_saveFile($this->script_file, serialize($this->cache));
 }
开发者ID:omusico,项目名称:isle-web-framework,代码行数:12,代码来源:helper.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP io_sweepNS函数代码示例发布时间:2022-05-15
下一篇:
PHP io_rename函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap