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


PHP file_write函数代码示例

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


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

示例1: ukko_install

 function ukko_install($settings)
 {
     if (!file_exists($settings['uri'])) {
         @mkdir($settings['uri'], 0777) or error("Couldn't create " . $settings['uri'] . ". Check permissions.", true);
     }
     file_write($settings['uri'] . '/ukko.js', Element('themes/ukko/ukko.js', array()));
 }
开发者ID:odilitime,项目名称:vichan,代码行数:7,代码来源:info.php

示例2: ukko_build

function ukko_build($action, $settings)
{
    $ukko = new ukko();
    $ukko->settings = $settings;
    file_write($settings['uri'] . '/index.html', $ukko->build());
    file_write($settings['uri'] . '/ukko.js', Element('themes/ukko/ukko.js', array()));
}
开发者ID:cable6-dev,项目名称:vichan,代码行数:7,代码来源:theme.php

示例3: rrdtool_install

 function rrdtool_install($settings)
 {
     global $config;
     if (!is_numeric($settings['interval']) || $settings['interval'] < 1 || $settings['interval'] > 86400) {
         return array(false, 'Invalid interval: <strong>' . $settings['interval'] . '</strong>. Must be an integer greater than 1 and less than 86400.');
     }
     if (!is_numeric($settings['width']) || $settings['width'] < 1) {
         return array(false, 'Invalid width: <strong>' . $settings['width'] . '</strong>!');
     }
     if (!is_numeric($settings['height']) || $settings['height'] < 1) {
         return array(false, 'Invalid height: <strong>' . $settings['height'] . '</strong>!');
     }
     if (!in_array($settings['rate'], array('second', 'minute', 'day', 'hour', 'week', 'month', 'year'))) {
         return array(false, 'Invalid rate: <strong>' . $settings['rate'] . '</strong>!');
     }
     $job = '*/' . $settings['interval'] . ' * * * * php -q ' . str_replace('\\', '/', dirname(__FILE__)) . '/cron.php' . PHP_EOL;
     if (function_exists('system')) {
         $crontab = tempnam($config['tmp'], 'tinyboard-rrdtool');
         file_write($crontab, $job);
         @system('crontab ' . escapeshellarg($crontab), $ret);
         unlink($crontab);
         if ($ret === 0) {
             return '';
         }
         // it seems to install okay?
     }
     return array(true, '<h2>I couldn\'t install the crontab!</h2>' . 'In order to use this plugin, you must add the following crontab entry (`crontab -e`):' . '<pre>' . $job . '</pre>');
 }
开发者ID:nabm,项目名称:Tinyboard,代码行数:28,代码来源:info.php

示例4: sitemap_build

function sitemap_build($action, $settings, $board)
{
    global $config;
    // Possible values for $action:
    //	- all (rebuild everything, initialization)
    //	- news (news has been updated)
    //	- boards (board list changed)
    //	- post (a post has been made)
    //	- thread (a thread has been made)
    if ($action != 'post-thread' && $action != 'post-delete') {
        return;
    }
    if ($settings['regen_time'] > 0) {
        if ($last_gen = @filemtime($settings['path'])) {
            if (time() - $last_gen < (int) $settings['regen_time']) {
                return;
            }
            // Too soon
        }
    }
    $boards = explode(' ', $settings['boards']);
    $threads = array();
    foreach ($boards as $board) {
        $query = query(sprintf("SELECT `id` AS `thread_id`, (SELECT `time` FROM ``posts_%s`` WHERE `thread` = `thread_id` OR `id` = `thread_id` ORDER BY `time` DESC LIMIT 1) AS `lastmod` FROM ``posts_%s`` WHERE `thread` IS NULL", $board, $board)) or error(db_error());
        $threads[$board] = $query->fetchAll(PDO::FETCH_ASSOC);
    }
    file_write($settings['path'], Element('themes/sitemap/sitemap.xml', array('settings' => $settings, 'config' => $config, 'threads' => $threads, 'boards' => $boards)));
}
开发者ID:2Rainbow,项目名称:fukuro,代码行数:28,代码来源:theme.php

示例5: rand_build

function rand_build($action, $settings)
{
    $rand = new rand();
    $rand->settings = $settings;
    file_write($settings['uri'] . '/index.html', $rand->build());
    file_write($settings['uri'] . '/rand.js', Element('themes/rand/rand.js', array()));
}
开发者ID:anastiel,项目名称:lainchan,代码行数:7,代码来源:theme.php

示例6: siteExport

 /**
  * 导出
  */
 public function siteExport($filename = '')
 {
     if (IS_POST) {
         $setting_db = M('setting');
         $data = array('type' => 'setting');
         $data['data'] = $setting_db->select();
         $data['verify'] = md5(var_export($data['data'], true) . $data['type']);
         //数据进行多次加密,防止数据泄露
         $data = base64_encode(gzdeflate(json_encode($data)));
         $uniqid = uniqid();
         $filename = UPLOAD_PATH . 'export/' . $uniqid . '.data';
         if (file_write($filename, $data)) {
             $this->success('导出成功', U('Setting/siteExport', array('filename' => $uniqid)));
         }
         $this->error('导出失败,请重试!');
     } else {
         //过滤特殊字符,防止非法下载文件
         $filename = str_replace(array('.', '/', '\\'), '', $filename);
         $filename = UPLOAD_PATH . 'export/' . $filename . '.data';
         if (!file_exist($filename)) {
             $this->error('非法访问');
         }
         header('Content-type: application/octet-stream');
         header('Content-Disposition: attachment; filename="站点设置.data"');
         echo file_read($filename);
         file_delete($filename);
     }
 }
开发者ID:huangxulei,项目名称:app,代码行数:31,代码来源:SettingController.class.php

示例7: build

 public static function build($action, $settings)
 {
     global $config;
     if ($action == 'all') {
         file_write($config['dir']['home'] . $settings['file'], zine::install($settings));
     }
 }
开发者ID:anastiel,项目名称:lainchan,代码行数:7,代码来源:theme.php

示例8: build

 public static function build($action, $settings)
 {
     global $config;
     if ($action == 'all' || $action == 'news') {
         file_write($config['dir']['home'] . $settings['file'], Basic::homepage($settings));
     }
 }
开发者ID:npfriday,项目名称:Tinyboard,代码行数:7,代码来源:theme.php

示例9: createroot

 public static function createroot($path, $root, $module)
 {
     // create directory $path if not exists
     if (is_dir($path)) {
         return false;
     }
     if (!mkdir($path, PHP_AS_NOBODY ? 0777 : 0755)) {
         return false;
     }
     if (!mkdir($path . '/CVS', PHP_AS_NOBODY ? 0777 : 0755)) {
         return false;
     }
     // write $path/CVS files
     if (!file_write($path . '/CVS/Root', $root)) {
         return false;
     }
     if (!file_write($path . '/CVS/Repository', $module)) {
         return false;
     }
     $entries = '';
     if (!file_write($path . '/CVS/Entries', $entries)) {
         return false;
     }
     return true;
 }
开发者ID:cbsistem,项目名称:nexos,代码行数:25,代码来源:cvs.php

示例10: build

 public function build($settings, $board_name)
 {
     global $config, $board;
     openBoard($board_name);
     $recent_images = array();
     $recent_posts = array();
     $stats = array();
     $query = query(sprintf("SELECT *, `id` AS `thread_id`,\n\t\t\t\t(SELECT COUNT(`id`) FROM ``posts_%s`` WHERE `thread` = `thread_id`) AS `reply_count`,\n\t\t\t\t(SELECT SUM(`num_files`) FROM ``posts_%s`` WHERE `thread` = `thread_id` AND `num_files` IS NOT NULL) AS `image_count`,\n\t\t\t\t'%s' AS `board` FROM ``posts_%s`` WHERE `thread`  IS NULL ORDER BY `bump` DESC", $board_name, $board_name, $board_name, $board_name, $board_name)) or error(db_error());
     while ($post = $query->fetch(PDO::FETCH_ASSOC)) {
         $post['link'] = $config['root'] . $board['dir'] . $config['dir']['res'] . sprintf($config['file_page'], $post['thread'] ? $post['thread'] : $post['id']);
         $post['board_name'] = $board['name'];
         if ($post['embed'] && preg_match('/^https?:\\/\\/(\\w+\\.)?(?:youtube\\.com\\/watch\\?v=|youtu\\.be\\/)([a-zA-Z0-9\\-_]{10,11})(&.+)?$/i', $post['embed'], $matches)) {
             $post['youtube'] = $matches[2];
         }
         if (isset($post['files'])) {
             $files = json_decode($post['files']);
             if ($files[0]->file == 'deleted') {
                 continue;
             }
             $post['file'] = $config['uri_thumb'] . $files[0]->thumb;
         }
         $recent_posts[] = $post;
     }
     $required_scripts = array('js/jquery.min.js', 'js/jquery.mixitup.min.js', 'js/catalog.js');
     foreach ($required_scripts as $i => $s) {
         if (!in_array($s, $config['additional_javascript'])) {
             $config['additional_javascript'][] = $s;
         }
     }
     file_write($config['dir']['home'] . $board_name . '/catalog.html', Element('themes/catalog/catalog.html', array('settings' => $settings, 'config' => $config, 'boardlist' => createBoardlist(), 'recent_images' => $recent_images, 'recent_posts' => $recent_posts, 'stats' => $stats, 'board' => $board_name, 'link' => $config['root'] . $board['dir'])));
 }
开发者ID:vicentil,项目名称:vichan,代码行数:31,代码来源:theme.php

示例11: page_write

function page_write($page, $postdata, $notimestamp = FALSE)
{
    global $trackback;
    if (PKWK_READONLY) {
        return;
    }
    // Do nothing
    $postdata = make_str_rules($postdata);
    // Create and write diff
    $oldpostdata = is_page($page) ? join('', get_source($page)) : '';
    $diffdata = do_diff($oldpostdata, $postdata);
    file_write(DIFF_DIR, $page, $diffdata);
    // Create backup
    make_backup($page, $postdata == '');
    // Is $postdata null?
    // Create wiki text
    file_write(DATA_DIR, $page, $postdata, $notimestamp);
    if ($trackback) {
        // TrackBack Ping
        $_diff = explode("\n", $diffdata);
        $plus = join("\n", preg_replace('/^\\+/', '', preg_grep('/^\\+/', $_diff)));
        $minus = join("\n", preg_replace('/^-/', '', preg_grep('/^-/', $_diff)));
        tb_send($page, $plus, $minus);
    }
    links_update($page);
}
开发者ID:KimuraYoichi,项目名称:PukiWiki,代码行数:26,代码来源:file.php

示例12: cache_set

function cache_set($file, $data, $dir = '')
{
    if (!is_string($data)) {
        $data = "<?php \r\ndefined('CURRENT_VERSION') or exit('Access Denied');\r\nreturn " . var_export($data, true) . ';';
    }
    $file = $dir ? "{$GLOBALS['config']['cache']['dir']}/{$dir}/{$file}" : "{$GLOBALS['config']['cache']['dir']}/{$file}";
    return file_write($file, $data);
}
开发者ID:legeng,项目名称:project-2,代码行数:8,代码来源:cache.file.func.php

示例13: build

 public static function build($action, $settings)
 {
     global $config;
     if ($action == 'all' || $action == 'bans.html') {
         file_write($config['dir']['home'] . $settings['file_bans'], PBanlist::homepage($settings));
     }
     if ($action == 'all' || $action == 'bans') {
         file_write($config['dir']['home'] . $settings['file_json'], PBanlist::gen_json($settings));
     }
 }
开发者ID:odilitime,项目名称:infinity,代码行数:10,代码来源:theme.php

示例14: cron_track_running

function cron_track_running($mode)
{
    @define('CRON_STARTMARK', TRIGGERS_DIR . 'cron_started_at_' . date('Y-m-d_H-i-s') . '_by_pid_' . getmypid());
    if ($mode == 'start') {
        cron_touch_lock_file(CRON_RUNNING);
        file_write('', CRON_STARTMARK);
    } elseif ($mode == 'end') {
        @unlink(CRON_STARTMARK);
    }
}
开发者ID:ErR163,项目名称:torrentpier,代码行数:10,代码来源:cron_init.php

示例15: plugin_unfreeze_action

function plugin_unfreeze_action()
{
    global $script, $vars, $function_freeze;
    global $_title_isunfreezed, $_title_unfreezed, $_title_unfreeze;
    global $_msg_invalidpass, $_msg_unfreezing, $_btn_unfreeze;
    $page = isset($vars['page']) ? $vars['page'] : '';
    if (!$function_freeze || !is_page($page)) {
        return array('msg' => '', 'body' => '');
    }
    $pass = isset($vars['pass']) ? $vars['pass'] : NULL;
    $msg = $body = '';
    if (!is_freeze($page)) {
        // Unfreezed already
        $msg =& $_title_isunfreezed;
        $body = str_replace('$1', htmlspecialchars(strip_bracket($page)), '<p>' . $_title_isunfreezed . '</p>');
    } else {
        if ($pass !== NULL && pkwk_login($pass)) {
            // Unfreeze
            $postdata = get_source($page);
            array_shift($postdata);
            $postdata = join('', $postdata);
            file_write(DATA_DIR, $page, $postdata, TRUE);
            // Update
            is_freeze($page, TRUE);
            if (PLUGIN_UNFREEZE_EDIT) {
                $vars['cmd'] = 'read';
                // To show 'Freeze' link
                $msg =& $_title_unfreezed;
                $body = edit_form($page, $postdata);
            } else {
                $vars['cmd'] = 'read';
                $msg =& $_title_unfreezed;
                $body = '';
            }
        } else {
            // Show unfreeze form
            // kazuwaya
            $msg =& $_title_unfreeze;
            $s_page = htmlspecialchars($page);
            $body = $pass === NULL ? '' : "<p><strong>{$_msg_invalidpass}</strong></p>\n";
            $body .= <<<EOD
<p>{$_msg_unfreezing}</p>
<form action="{$script}" method="post">
 <p>
  <input type="hidden"   name="cmd"  value="unfreeze" />
  <input type="hidden"   name="page" value="{$s_page}" />
  <input type="password" name="pass" size="12" />
  <input type="submit"   name="ok"   value="{$_btn_unfreeze}" />
 </p>
</form>
EOD;
        }
    }
    return array('msg' => $msg, 'body' => $body);
}
开发者ID:lolo3-sight,项目名称:wiki,代码行数:55,代码来源:unfreeze.inc.php


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