本文整理汇总了PHP中file_write函数的典型用法代码示例。如果您正苦于以下问题:PHP file_write函数的具体用法?PHP file_write怎么用?PHP file_write使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了file_write函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: build
public function build($action, $settings)
{
global $config, $_theme;
/*if ($action == 'all') {
copy('templates/themes/recent/' . $settings['basecss'], $config['dir']['home'] . $settings['css']);
}*/
$this->excluded = explode(' ', $settings['exclude']);
if ($action == 'all' || $action == 'post' || $action == 'post-thread' || $action == 'post-delete') {
file_write($config['dir']['home'] . $settings['xml'], $this->homepage($settings));
}
}
开发者ID:fatpeopledotlol,项目名称:vichan,代码行数:11,代码来源:theme.php
示例17: post
private function post()
{
global $_W, $engine;
if (!in_array($this->message['msgtype'], array('text', 'image'))) {
return false;
}
$member = $this->getMember();
$wall = pdo_fetch("SELECT * FROM " . tablename('wxwall_reply') . " WHERE rid = :rid LIMIT 1", array(':rid' => $member['rid']));
if (!empty($wall['timeout']) && $wall['timeout'] > 0 && TIMESTAMP - $member['lastupdate'] >= $wall['timeout']) {
$this->endContext();
return $this->respText('由于您长时间未操作,请重新进入微信墙!');
}
$this->refreshContext();
if (empty($wall['quit_command']) && $this->message['content'] == '退出' || !empty($wall['quit_command']) && $this->message['content'] == $wall['quit_command']) {
$this->endContext();
return $this->respText($wall['quit_tips']);
}
if (empty($member['nickname']) || empty($member['avatar'])) {
return $this->respText('发表话题前请完善您的基本信息,<a target="_blank" href="' . $this->createMobileUrl('register') . '">点击完善</a>。');
}
$data = array('rid' => $member['rid'], 'from_user' => $_W['member']['uid'], 'type' => $this->message['type'], 'createtime' => TIMESTAMP);
if (empty($wall['isshow']) && empty($member['isblacklist'])) {
$data['isshow'] = 1;
} else {
$data['isshow'] = 0;
}
if ($this->message['type'] == 'text') {
$data['content'] = $this->message['content'];
}
if ($this->message['type'] == 'image') {
load()->func('communication');
$image = ihttp_request($this->message['picurl']);
$partPath = IA_ROOT . '/' . $_W['config']['upload']['attachdir'] . '/';
do {
$filename = "images/{$_W['uniacid']}/" . date('Y/m/') . random(30) . '.jpg';
} while (file_exists($partPath . $filename));
file_write($filename, $image['content']);
$data['content'] = $filename;
}
if ($this->message['type'] == 'link') {
$data['content'] = iserializer(array('title' => $this->message['title'], 'description' => $this->message['description'], 'link' => $this->message['link']));
}
pdo_insert('wxwall_message', $data);
if (!empty($member['isblacklist'])) {
$content .= '你已被列入黑名单,发送的消息需要管理员审核!';
} elseif (!empty($wall['isshow'])) {
$content = '发送消息成功,请等待管理员审核';
} elseif (!empty($wall['send_tips'])) {
$content = $wall['send_tips'];
} else {
$content = '发送消息成功。';
}
return $this->respText($content);
}
开发者ID:keycoolkui,项目名称:weixinfenxiao,代码行数:54,代码来源:processor.php
示例18: setbg
private function setbg($bg, $fan)
{
global $_W;
load()->func('communication');
load()->func('file');
$bg = tomedia($bg);
$file = ihttp_get($bg);
$file = $file['content'];
$img = '/images/' . $_W['uniacid'] . '/hx_qr/img/' . $fan['id'] . '.jpg';
file_write($img, $file);
return $img;
}
开发者ID:aspnmy,项目名称:weizan,代码行数:12,代码来源:site.php
示例19: ukko_build
function ukko_build($action, $settings)
{
global $config;
$ukko = new ukko();
$ukko->settings = $settings;
if (!($action == 'all' || $action == 'post' || $action == 'post-thread' || $action == 'post-delete')) {
return;
}
if ($config['smart_build']) {
file_unlink($settings['uri'] . '/index.html');
} else {
file_write($settings['uri'] . '/index.html', $ukko->build());
}
}
开发者ID:odilitime,项目名称:infinity,代码行数:14,代码来源:theme.php
示例20: plugin_freeze_action
function plugin_freeze_action()
{
global $script, $vars, $function_freeze;
$_title_isfreezed = _(' $1 has already been frozen');
$_title_freezed = _(' $1 has been frozen.');
$_title_freeze = _('Freeze $1');
$_msg_invalidpass = _('Invalid password.');
$_msg_freezing = _('Please input the password for freezing.');
$_btn_freeze = _('Freeze');
$page = isset($vars['page']) ? $vars['page'] : '';
if (!$function_freeze || is_cantedit($page) || !is_page($page)) {
return array('msg' => '', 'body' => '');
}
$pass = isset($vars['pass']) ? $vars['pass'] : NULL;
$msg = $body = '';
if (is_freeze($page)) {
// Freezed already
$msg =& $_title_isfreezed;
$body = str_replace('$1', htmlspecialchars(strip_bracket($page)), $_title_isfreezed);
} else {
if (!auth::check_role('role_adm_contents') || $pass !== NULL && pkwk_login($pass)) {
// Freeze
$postdata = get_source($page);
array_unshift($postdata, "#freeze\n");
file_write(DATA_DIR, $page, join('', $postdata), TRUE);
// Update
is_freeze($page, TRUE);
$vars['cmd'] = 'read';
$msg =& $_title_freezed;
$body = '';
} else {
// Show a freeze form
$msg =& $_title_freeze;
$s_page = htmlspecialchars($page);
$body = $pass === NULL ? '' : "<p><strong>{$_msg_invalidpass}</strong></p>\n";
$body .= <<<EOD
<p>{$_msg_freezing}</p>
<form action="{$script}" method="post">
<div>
<input type="hidden" name="cmd" value="freeze" />
<input type="hidden" name="page" value="{$s_page}" />
<input type="password" name="pass" size="12" />
<input type="submit" name="ok" value="{$_btn_freeze}" />
</div>
</form>
EOD;
}
}
return array('msg' => $msg, 'body' => $body);
}
开发者ID:aterai,项目名称:pukiwiki-plus-i18n,代码行数:50,代码来源:freeze.inc.php
注:本文中的file_write函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论