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


PHP io_saveFile函数代码示例

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


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

示例1: checkUpdateMessages

/**
 * Check for new messages from upstream
 *
 * @author Andreas Gohr <andi@splitbrain.org>
 */
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 <andi@splitbrain.org>
 */
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


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