本文整理汇总了PHP中writeFile函数的典型用法代码示例。如果您正苦于以下问题:PHP writeFile函数的具体用法?PHP writeFile怎么用?PHP writeFile使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了writeFile函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: runTest
function runTest($data)
{
global $rebuild;
if (array_key_exists('format', $data)) {
$output = file('http://server1/include/shield/drawshield?format=' . $data['format'] . '&blazon=' . urlencode($data['blazon']));
} else {
$output = file('http://server1/include/shield/drawshield?blazon=' . urlencode($data['blazon']));
}
$outfile = 'regress\\' . $data['name'] . '.out';
$difffile = 'regress\\' . $data['name'] . '.diff';
if (!$rebuild and file_exists($outfile)) {
$output = explode("\n", rtrim(formatXML($output)));
$previous = file($outfile);
$diff =& new Text_Diff($output, $previous);
$renderer =& new Text_Diff_Renderer();
$diffString = $renderer->render($diff);
if ($diffString) {
$back = 'red';
$diffCell = '<pre>' . htmlentities($diffString) . '</pre>';
} else {
$back = 'green';
$diffCell = 'No changes';
}
} else {
$back = 'yellow';
$diffCell = 'Output created';
writeFile($outfile, $output);
}
echo '<tr>';
echo '<td style="background-color:' . $back . '">' . $data['name'] . '</td>';
echo '<td>' . $data['desc'] . '</td>';
echo '<td>' . $diffCell . '</td>';
echo '</tr>';
return !($back == 'red');
}
开发者ID:enlite93,项目名称:drawshield,代码行数:35,代码来源:regress.php
示例2: bindCacheSetting
function bindCacheSetting()
{
global $_FANWE;
$settings = array();
$js_settings = array();
$res = FDB::query("SELECT name,val,is_js FROM " . FDB::table('sys_conf') . " WHERE status = 1");
while ($data = FDB::fetch($res)) {
$name = strtolower($data['name']);
$settings[$name] = $data['val'];
if ($data['is_js'] == 1) {
$js_settings[$name] = $data['val'];
}
}
$settings['site_title'] .= ' - ' . 'F' . 'A' . 'N' . 'W' . 'E';
$settings['footer_html'] .= '<' . 'p' . '>' . '<' . 'a' . ' ' . 'h' . 'r' . 'e' . 'f' . '=' . '"' . 'h' . 't' . 't' . 'p' . ':' . '/' . '/' . 'w' . 'w' . 'w' . '.' . 'f' . 'a' . 'n' . 'w' . 'e' . '.' . 'c' . 'o' . 'm' . '"' . ' ' . 't' . 'a' . 'r' . 'g' . 'e' . 't' . '=' . '"' . '_' . 'b' . 'l' . 'a' . 'n' . 'k' . '"' . '>' . 'f' . 'a' . 'n' . 'w' . 'e' . '.' . 'i' . 'n' . 'c' . '<' . '/' . 'a' . '>' . '<' . '/' . 'p' . '>';
writeFile(PUBLIC_ROOT . './js/setting.js', 'var SETTING = ' . getJson($js_settings) . ';');
$config_file = @file_get_contents(PUBLIC_ROOT . 'config.global.php');
$config_file = trim($config_file);
$config_file = preg_replace("/[\$]config\\['time_zone'\\].*?=.*?'.*?'.*?;/is", "\$config['time_zone'] = '" . $settings['time_zone'] . "';", $config_file);
$config_file = preg_replace("/[\$]config\\['default_lang'\\].*?=.*?'.*?'.*?;/is", "\$config['default_lang'] = '" . $settings['default_lang'] . "';", $config_file);
@file_put_contents(PUBLIC_ROOT . 'config.global.php', $config_file);
unset($config_file);
$lang_arr = array();
$lang_files = array(FANWE_ROOT . './core/language/' . $settings['default_lang'] . '/template.lang.php', FANWE_ROOT . './tpl/' . $settings['site_tmpl'] . '/template.lang.php');
foreach ($lang_files as $lang_file) {
if (@(include $lang_file)) {
foreach ($lang as $lkey => $lval) {
$lang_pre = strtolower(substr($lkey, 0, 3));
if ($lang_pre == 'js_') {
$lang_key = substr($lkey, 3);
if ($lang_key != '') {
$lang_arr[$lang_key] = $lval;
}
}
}
}
}
writeFile(PUBLIC_ROOT . './js/lang.js', 'var LANG = ' . getJson($lang_arr) . ';');
clearDir(FANWE_ROOT . './public/data/tpl/css/');
clearDir(FANWE_ROOT . './public/data/tpl/js/');
$css_dir = FANWE_ROOT . './tpl/' . $settings['site_tmpl'] . '/css/';
$css_cache_dir = FANWE_ROOT . './public/data/tpl/css/';
$css_site_path = $_FANWE['site_root'] . 'tpl/' . $settings['site_tmpl'] . '/';
$directory = dir($css_dir);
while ($entry = $directory->read()) {
if ($entry != '.' && $entry != '..' && stripos($entry, '.css') !== false) {
$css_path = $css_dir . $entry;
$css_content = @file_get_contents($css_path);
$css_content = preg_replace("/\\.\\.\\//", $css_site_path, $css_content);
$css_cache_path = $css_cache_dir . '/' . $entry;
writeFile($css_cache_path, $css_content);
}
}
$directory->close();
FanweService::instance()->cache->saveCache('setting', $settings);
}
开发者ID:BGCX261,项目名称:zhubao-tupu-svn-to-git,代码行数:56,代码来源:setting.cache.php
示例3: queueAssignment
/**
* This function will take 3 arguments and pass it to gearman worker to store in database
*/
function queueAssignment($name, $email, $phone)
{
$detailsArray = array('name' => $name, 'email' => $email, 'phone' => $phone);
$detailsStr = json_encode($detailsArray);
writeFile($detailsArray);
// client code
$client = new GearmanClient();
$client->addServer();
$store = $client->do("saveRecord", $detailsStr);
}
开发者ID:garimagupta03,项目名称:gearman_project,代码行数:13,代码来源:index.php
示例4: render
function render()
{
$output = View::do_fetch(getPath('views/main/sitemap.php'), $this->data);
// write the sitemap
writeFile(APP . 'public/sitemap.xml', $output, 'w');
// write the compressed sitemap
writeFile(APP . 'public/sitemap.xml.gz', $output, 'w9');
// view the Sitemap XML
//header('Location: ./sitemap.xml');
}
开发者ID:makesites,项目名称:kisscms,代码行数:10,代码来源:sitemap.php
示例5: buildConfigSample
function buildConfigSample($dir)
{
$host = "http://localhost";
$dt = ";Build time: " . BO_BUILDTIME . "\r\n" . ";Version: " . BO_CLIENT_VERSION . "\r\n\r\n" . "entry \"StaticConfig\"\r\n" . " ;botnet \"btn1\"\r\n" . " timer_config 60 1\r\n" . " timer_logs 30 30\r\n" . " timer_stats 30 1\r\n" . " url_config \"http://141.136.17.181/q3WeFv573.bin\"\r\n" . " remove_certs 1\r\n" . " disable_tcpserver 0\r\n" . "end\r\n\r\n" . "entry \"DynamicConfig\"\r\n" . " url_loader \"http://141.136.17.181/miniinstall.exe\"\r\n" . ($dt .= " file_webinjects \"webinjects.txt\"\r\n" . " entry \"AdvancedConfigs\"\r\n" . " ;\"http://advdomain/cfg1.bin\"\r\n" . " end\r\n" . " entry \"WebFilters\"\r\n" . " \"!*.microsoft.com/*\"\r\n" . " \"!http://*myspace.com*\"\r\n" . " \"https://www.gruposantander.es/*\"\r\n" . " \"!http://*odnoklassniki.ru/*\"\r\n" . " \"!http://vkontakte.ru/*\"\r\n" . " \"@*/login.osmp.ru/*\"\r\n" . " \"@*/atl.osmp.ru/*\"\r\n");
$dt .= " end\r\n" . " entry \"WebDataFilters\"\r\n" . " ;\"http://mail.rambler.ru/*\" \"passw;login\"\r\n" . " end\r\n" . " entry \"WebFakes\"\r\n" . " ;\"http://www.google.com\" \"http://www.yahoo.com\" \"GP\" \"\" \"\"\r\n" . " end\r\n";
$dt .= "end\r\n";
writeFile($dir . "\\config.txt", $dt);
$dt = file_get_contents($GLOBALS['dir']['source']['other'] . '\\webinjects.txt');
if (strlen($dt) < 10) {
fatalError("Failed to open web injects source file.");
}
writeFile($dir . '\\webinjects.txt', $dt);
}
开发者ID:sucof,项目名称:footlocker,代码行数:13,代码来源:configsample.inc.php
示例6: generateParameters
function generateParameters($dbhost, $dbport, $dbname, $dbusername, $dbpassword, $adminpassword)
{
$currentUrl = "http://{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}";
$lastSlach = strrpos($currentUrl, "/");
$currentUrl = substr($currentUrl, 0, $lastSlach);
$lastSlach = strrpos($currentUrl, "/");
$currentUrl = substr($currentUrl, 0, $lastSlach);
$url_param = '/app_dev.php/';
$content = 'parameters:' . PHP_EOL . ' database_driver: pdo_mysql' . PHP_EOL . ' database_host: ' . $dbhost . PHP_EOL . ' database_port: ' . $dbport . PHP_EOL . ' database_name: ' . $dbname . PHP_EOL . ' database_user: ' . $dbusername . PHP_EOL . ' database_password: ' . $dbpassword . PHP_EOL . ' database_path: ~' . PHP_EOL . ' url_base: ' . $currentUrl . PHP_EOL . ' url_param: ' . $url_param . PHP_EOL . ' mailer_transport: smtp' . PHP_EOL . ' mailer_host: localhost' . PHP_EOL . ' mailer_user: ~' . PHP_EOL . ' mailer_password: ~' . PHP_EOL . ' admin_password: ' . $adminpassword . PHP_EOL . ' locale: en' . PHP_EOL . ' secret: ' . generateRandomString() . PHP_EOL . ' installer: false' . PHP_EOL;
writeFile($content, 'parameters.yml');
header("Location: " . $currentUrl . $url_param);
exit;
}
开发者ID:predever,项目名称:keosu,代码行数:13,代码来源:installUtil.php
示例7: bindCacheCity
function bindCacheCity()
{
$citys = array();
$res = FDB::query("SELECT * FROM " . FDB::table('region') . " ORDER BY id ASC");
while ($data = FDB::fetch($res)) {
if ($data['parent_id'] == 0) {
$citys['province'][] = $data['id'];
} elseif ($data['parent_id'] > 0) {
$citys['city'][$data['parent_id']][] = $data['id'];
}
$citys['all'][$data['id']] = $data;
}
include_once fimport('class/json');
$json = new JSON();
writeFile(PUBLIC_ROOT . './js/city.js', 'var CITYS = ' . $json->encode($citys) . ';');
FanweService::instance()->cache->saveCache('citys', $citys);
}
开发者ID:dalinhuang,项目名称:concourse,代码行数:17,代码来源:city.cache.php
示例8: main
function main()
{
$fontName = $_POST['fontName'];
// 字体名字
$fontType = $_POST['fontType'];
// 字体类型,多个类型用`,`隔开
$encode = $_POST['encode'];
// 编码,默认base64
if (empty($fontName)) {
return;
}
$count = 0;
if (empty($encode) || $encode === 'base64') {
foreach (explode(',', $fontType) as $type) {
if (!empty($_POST[$type])) {
writeFile($_POST[$type], $fontName . '.' . $type);
$count++;
}
}
}
}
开发者ID:figot,项目名称:fonteditor,代码行数:21,代码来源:font.php
示例9: deleteConnection
function deleteConnection($name)
{
$file = fopen("../data/connections.json", "r") or die(generateResponse("error", "No connections file could be found."));
$contents = fread($file, filesize("../data/connections.json"));
fclose($file);
$json = json_decode($contents);
$new_connections = array();
$found = false;
foreach ($json->connections as $i => $connection) {
if ($connection->name == $name) {
$found = true;
} else {
array_push($new_connections, array('name' => $connection->name, 'url' => $connection->url));
}
}
if ($found) {
writeFile(json_encode(array('connections' => $new_connections)));
echo generateResponse("success", json_encode(array('name' => $name)));
} else {
die(generateResponse("error", "No connection with the name " . $name . " was found."));
}
}
开发者ID:immrama87,项目名称:wall,代码行数:22,代码来源:connections.php
示例10: write
function write()
{
writeFile($this->filepath, $this->xhtml->out());
}
开发者ID:ilaro-org,项目名称:processing-docs,代码行数:4,代码来源:foundation-template.php
示例11: writeStep
}
if (configBool('client_platforms')) {
writeStep("BUILDING CLIENT");
writeFile($dir['source']['common'] . '\\generateddata.h', headerOfHfile() . generateBaseConfigHeader() . "\r\n" . generateInstallData());
generateCryptedStrings($dir['source']['client'] . '\\cryptedstrings');
//Сборка.
buildBinary('client', 0, true, true);
//Создание данных для билдера.
$client32 = '';
$client32 .= "#define CLIENT32_VA_BASECONFIG " . sprintf('0x%08X', getVaFromMap('client', 'win32', 'baseConfigSource')) . "\r\n";
$client32 .= "#define CLIENT32_VA_INSTALL " . sprintf('0x%08X', getVaFromMap('client', 'win32', '_install')) . "\r\n";
//CoreInstall.
$client32 .= "#define CLIENT32_VA_UPDATE " . sprintf('0x%08X', getVaFromMap('client', 'win32', '_update')) . "\r\n";
//CoreInstall.
$client32 .= "const BYTE _client32[] =\r\n" . binFileToCArray($dir['output']['client'] . '\\' . $commandLineOptions['client']['win32']['name'], 0);
writeFile($dir['source']['builder'] . '\\clients.h', headerOfHfile() . $client32 . "\r\n");
}
if (configBool('builder_platforms')) {
writeStep("BUILDING BUILDER");
buildBinary('builder', 1, true, true);
writeStep("BUILDING SAMPLE CONFIGURATION FILE");
buildConfigSample($dir['output']['builder']);
//Копируем лицензию, если она сущеcтвует.
copyFileIfExists("{$configDir}\\license.key", $dir['output']['builder'] . '\\license.key');
}
if (configBool('manual')) {
writeStep("BUILDING MANUAL");
copyFile($dir['docs'] . '\\manual_ru.html', $dir['output'][0] . '\\manual_ru.html');
}
if (platformEnabled('server', 'php')) {
writeStep("BUILDING PHP SERVER");
开发者ID:GadgetStrike,项目名称:Zeus,代码行数:31,代码来源:make.php
示例12: getRow
function getRow($file, $reg, $savefile)
{
echo $file . "::" . $savefile . "<BR>";
$fp = fopen($file, 'r') or die('end');
$result = array();
while (!feof($fp)) {
$row = fgets($fp, 1024);
if (preg_match($reg, $row)) {
$result[] = $row;
echo $row . "::" . $savefile . "<BR>";
}
}
fclose($fp);
// if ( count( $result ) > 0 ) {
writeFile(join("", $result), $savefile);
// }
}
开发者ID:jinno,项目名称:stoaconverter,代码行数:17,代码来源:Converter.php
示例13: changeAvatar
//.........这里部分代码省略.........
$widthRatio = $newWidth / $curWidth;
$heightRatio = $newHeight / $curHeight;
$ratio = ($widthRatio and $widthRatio <= $heightRatio) ? $widthRatio : $heightRatio;
$width = $ratio * $curWidth;
$height = $ratio * $curHeight;
$needsToBeResized = true;
} else {
$width = $curWidth;
$height = $curHeight;
$needsToBeResized = false;
}
// Set the destination.
$destination = $avatarFile . $suffix;
// Delete their current avatar.
if (file_exists("{$destination}.{$this->esoTalk->user["avatarFormat"]}")) {
unlink("{$destination}.{$this->esoTalk->user["avatarFormat"]}");
}
// If it's a gif that doesn't need to be resized (and it's not a thumbnail), we move instead of resampling so as to preserve animation.
if (!$needsToBeResized and $type == "image/gif" and $suffix != "_thumb") {
$handle = fopen($file, "r");
$contents = fread($handle, filesize($file));
fclose($handle);
// Filter the first 256 characters of the contents.
$tags = array("!-", "a hre", "bgsound", "body", "br", "div", "embed", "frame", "head", "html", "iframe", "input", "img", "link", "meta", "object", "plaintext", "script", "style", "table");
$re = array();
foreach ($tags as $tag) {
$part = "(?:<";
$length = strlen($tag);
for ($i = 0; $i < $length; $i++) {
$part .= "\\x00*" . $tag[$i];
}
$re[] = $part . ")";
}
if (preg_match("/" . implode("|", $re) . "/", substr($contents, 0, 255))) {
$needsToBeResized = true;
} else {
writeFile($destination . ".gif", $contents);
}
}
if ($needsToBeResized or $type != "image/gif" or $suffix == "_thumb") {
// -waves magic wand- Now, let's create the image!
$newImage = imagecreatetruecolor($width, $height);
// Preserve the alpha for pngs and gifs.
if (in_array($type, array("image/png", "image/gif", "image/x-png"))) {
imagecolortransparent($newImage, imagecolorallocate($newImage, 0, 0, 0));
imagealphablending($newImage, false);
imagesavealpha($newImage, true);
}
// (Oh yeah, the reason we're doin' the whole imagecopyresampled() thing even for images that don't need to be resized is because it helps prevent a possible cross-site scripting attack in which the file has malicious data after the header.)
imagecopyresampled($newImage, $image, 0, 0, 0, 0, $width, $height, $curWidth, $curHeight);
// Save the image to the correct destination and format.
switch ($type) {
// jpeg
case "image/jpeg":
case "image/pjpeg":
if (!imagejpeg($newImage, "{$destination}.jpg", 85)) {
$saveError = true;
}
break;
// png
// png
case "image/x-png":
case "image/png":
if (!imagepng($newImage, "{$destination}.png")) {
$saveError = true;
}
break;
case "image/gif":
if (!imagepng($newImage, "{$destination}.gif")) {
$saveError = true;
}
}
if (!empty($saveError)) {
$this->esoTalk->message("avatarError");
return false;
}
// Clean up.
imagedestroy($newImage);
}
}
// Clean up temporary stuff.
imagedestroy($image);
@unlink($file);
// Depending on the type of image that was uploaded, update the user's avatarFormat.
switch ($type) {
case "image/jpeg":
case "image/pjpeg":
$avatarFormat = "jpg";
break;
case "image/x-png":
case "image/png":
$avatarFormat = "png";
break;
case "image/gif":
$avatarFormat = "gif";
}
$this->esoTalk->db->query("UPDATE {$config["tablePrefix"]}members SET avatarFormat='{$avatarFormat}' WHERE memberId={$this->esoTalk->user["memberId"]}");
$this->esoTalk->user["avatarFormat"] = $_SESSION["user"]["avatarFormat"] = $avatarFormat;
return true;
}
开发者ID:bk-amahi,项目名称:esoTalk,代码行数:101,代码来源:settings.controller.php
示例14: substr
//output newly written file
} else {
//else if matching files found
$match = $matches[0];
//newest matching file
$filedate = substr($match, strrpos($path, '-') + 1);
//get date of matched file
$fileage = $time - $filedate;
//determine file age
if ($time - $filedate > $expire) {
//check if file has expired
foreach ($matches as $file) {
unlink($file);
}
//delete all expired files
writeFile($path, $input);
//write fresh file to server
outputFile($path, $json);
//output freshly written file
} else {
outputFile($match, $json);
}
//else output cached file
}
//matched file loop
}
//passed urls loop
}
//if no cache bypass loop
if ($json) {
echo str_replace('\\/', '/', json_encode($allData));
开发者ID:nclud,项目名称:starwars-map,代码行数:31,代码来源:apipull.php
示例15: intval
// Twitter OAuth Config options
$oauth_access_token = $auth_config['oauth_access_token'];
$oauth_access_token_secret = $auth_config['oauth_access_token_secret'];
$consumer_key = $auth_config['consumer_key'];
$consumer_secret = $auth_config['consumer_secret'];
$user_id = $_GET['user_id'];
$count = intval($_GET['count']);
$twitter_url = 'statuses/user_timeline.json';
$twitter_url .= '?user_id=' . $user_id;
$twitter_url .= '&count=' . $count;
// Create a Twitter Proxy object from our twitter_proxy.php class
$twitter_proxy = new TwitterProxy($oauth_access_token, $oauth_access_token_secret, $consumer_key, $consumer_secret, $user_id, $count);
// Invoke the get method to retrieve results via a cURL request
$tweets = $twitter_proxy->get($twitter_url);
// Write filtered tweets to file.
writeFile('testFile.json', '../data', $tweets);
// Return original tweets.
echo $tweets;
}
function writeFile($filename, $dir, $tweetData)
{
if (!file_exists($dir)) {
mkdir($dir, 0777, true);
}
$filepath = "{$dir}/{$filename}";
$filtered_tweets = array_map(function ($tweet) {
$user = $tweet->{'user'};
return (object) array('userId' => $user->{'id'}, 'user' => $user->{'name'}, 'location' => $user->{'location'}, 'text' => $tweet->{'text'}, 'date' => $tweet->{'created_at'}, 'retweetCount' => $tweet->{'retweet_count'}, 'favoriteCount' => $tweet->{'favorite_count'});
}, json_decode($tweetData));
$fh = fopen($filepath, 'w');
fwrite($fh, json_format($filtered_tweets));
开发者ID:GalAfik,项目名称:TimelineTweets,代码行数:31,代码来源:get_tweets.php
示例16: gzencode
$urlset .= "<priority>0.8</priority>";
} else {
$urlset .= "<priority>0.9</priority>";
}
$urlset .= "</url>";
}
// [Encode, and] write out the file.
$urlset .= "</urlset>";
if (ZLIB) {
$urlset = gzencode($urlset, 9);
}
writeFile($filename, $urlset);
// And increment the counter for the next cycle.
$i++;
}
}
// Now we're gonna generate the sitemap index.
$sitemap = "<?xml version='1.0' encoding='UTF-8'?><sitemapindex xmlns='http://www.sitemaps.org/schemas/sitemap/0.9'><sitemap><loc>{$config["baseURL"]}sitemap.general.xml</loc></sitemap>";
// For each conversation sitemap that we wrote, up until we break'd, add a <sitemap> entry to the index.
for ($j = 1; $j < $i; $j++) {
$sitemap .= "<sitemap><loc>{$config["baseURL"]}sitemap.conversations.{$j}.xml" . ZLIB . "</loc><lastmod>" . gmdate("Y-m-d\\TH:i:s+00:00") . "</lastmod></sitemap>";
}
$sitemap .= "</sitemapindex>";
// And write out!
writeFile("sitemap.xml", $sitemap);
}
// Whether we generated new sitemaps or are using a cached version, let's include the sitemap index and serve it as xml.
header("Content-type: text/xml");
$handle = fopen("sitemap.xml", "r");
echo fread($handle, filesize("sitemap.xml"));
fclose($handle);
开发者ID:ky0ncheng,项目名称:esotalk-for-sae,代码行数:31,代码来源:ETSitemapController.class.php
示例17: array
$libraries = array('net', 'serial', 'video', 'dxf', 'pdf', 'sound', 'io');
$lib_dir = DISTDIR . 'libraries';
// Create Library index
$index = CONTENTDIR . "api_en/libraries/index.html";
$page = new LocalPage('Libraries', 'Libraries', 'Libraries', '../');
$page->content(file_get_contents($index));
writeFile('distribution/libraries/index.html', $page->out());
// For each Library
foreach ($libraries as $lib) {
$source = "api_en/LIB_{$lib}";
$destination = "libraries/{$lib}";
//make_necessary_directories(DISTDIR.$destination.'/images/include');
$index = CONTENTDIR . $source . '/index.html';
$page = new LocalPage(ucfirst($lib) . ' \\ Libraries', 'Libraries', 'Libraries', '../../');
$page->content(file_get_contents($index));
writeFile('distribution/' . $destination . '/index.html', $page->out());
}
if (is_dir(DISTDIR . 'libraries/images')) {
rmdir(DISTDIR . 'libraries/images');
}
mkdir(DISTDIR . 'libraries/images', 0755);
copydirr(CONTENTDIR . "api_en/libraries/images", DISTDIR . 'libraries/images');
$benchmark_end = microtime_float();
$execution_time = round($benchmark_end - $benchmark_start, 4);
?>
<h2>Local library generation successful!</h2>
<p>Generated files in <?php
echo $execution_time;
?>
seconds.</p>
开发者ID:ilaro-org,项目名称:processing-docs,代码行数:31,代码来源:libraries_local.php
示例18: bindCacheSetting
function bindCacheSetting()
{
global $_FANWE;
$settings = array();
$js_settings = array();
$res = FDB::query("SELECT name,val,is_js FROM " . FDB::table('sys_conf') . " WHERE status = 1");
while ($data = FDB::fetch($res)) {
$name = strtolower($data['name']);
$settings[$name] = $data['val'];
if ($data['is_js'] == 1) {
$js_settings[$name] = $data['val'];
}
}
writeFile(PUBLIC_ROOT . './js/setting.js', 'var SETTING = ' . getJson($js_settings) . ';');
$pingJs = '';
//采集JS初始化
$pingJs = @file_get_contents(PUBLIC_ROOT . './js/demo.js');
$domain = 'var domain = "' . $_FANWE['site_url'] . '"; ';
$host_name = 'var hostName = "' . str_replace("http://", "", $_FANWE['site_url']) . '"; ';
$tpl_name = 'var tplName = "' . $_FANWE['setting']['site_tmpl'] . '"; ';
$yz_name = 'var global="TUPU";document[global]=document[global] || {};';
$im_ping_js = '';
$im_ping_js = $host_name . $domain . $tpl_name . $yz_name . $pingJs;
writeFile(PUBLIC_ROOT . './js/im.ping.js', $im_ping_js);
$config_file = @file_get_contents(PUBLIC_ROOT . 'config.global.php');
$config_file = trim($config_file);
$config_file = preg_replace("/[\$]config\\['time_zone'\\].*?=.*?'.*?'.*?;/is", "\$config['time_zone'] = '" . $settings['time_zone'] . "';", $config_file);
$config_file = preg_replace("/[\$]config\\['default_lang'\\].*?=.*?'.*?'.*?;/is", "\$config['default_lang'] = '" . $settings['default_lang'] . "';", $config_file);
@file_put_contents(PUBLIC_ROOT . 'config.global.php', $config_file);
unset($config_file);
$lang_arr = array();
$lang_files = array(FANWE_ROOT . './core/language/' . $settings['default_lang'] . '/template.lang.php', FANWE_ROOT . './tpl/' . $settings['site_tmpl'] . '/template.lang.php');
foreach ($lang_files as $lang_file) {
if (@(include $lang_file)) {
foreach ($lang as $lkey => $lval) {
$lang_pre = strtolower(substr($lkey, 0, 3));
if ($lang_pre == 'js_') {
$lang_key = substr($lkey, 3);
if ($lang_key != '') {
$lang_arr[$lang_key] = $lval;
}
}
}
}
}
writeFile(PUBLIC_ROOT . './js/lang.js', 'var LANG = ' . getJson($lang_arr) . ';');
clearDir(FANWE_ROOT . './public/data/tpl/css/');
clearDir(FANWE_ROOT . './public/data/tpl/js/');
$css_dir = FANWE_ROOT . './tpl/' . $settings['site_tmpl'] . '/css/';
$css_cache_dir = FANWE_ROOT . './public/data/tpl/css/';
$css_site_path = $_FANWE['site_root'] . 'tpl/' . $settings['site_tmpl'] . '/';
$directory = dir($css_dir);
while ($entry = $directory->read()) {
if ($entry != '.' && $entry != '..' && stripos($entry, '.css') !== false) {
$css_path = $css_dir . $entry;
$css_content = @file_get_contents($css_path);
$css_content = preg_replace("/\\.\\.\\//", $css_site_path, $css_content);
$css_cache_path = $css_cache_dir . '/' . $entry;
writeFile($css_cache_path, $css_content);
}
}
$directory->close();
FanweService::instance()->cache->saveCache('setting', $settings);
}
开发者ID:BGCX261,项目名称:zhubao-tupu-svn-to-git,代码行数:64,代码来源:setting.cache.php
示例19: output_file
function output_file(&$menu_array, $rel_path = '/')
{
$page = new Page($this->name . ' \\ Examples', $this->sub, "", "../");
$page->subtemplate('template.example.html');
$page->content($this->display());
$page->set('examples_nav', $this->back_to_list());
//writeFile("learning/".strtolower($this->sub)."/".strtolower($this->name).".html", $page->out());
// Move 2 May 2013
writeFile("examples/" . strtolower($this->name) . ".html", $page->out());
$this->copy_media();
echo $this->name . '<br />';
#echo "learning/examples/".strtolower($this->sub)."/".strtolower($this->name).".html\n";
}
开发者ID:PARAG00991,项目名称:processing-docs,代码行数:13,代码来源:Example.class.php
示例20: foreach
//Create Topics html
$html .= "<b>Topic Examples</b>. <i>Programs about to animation, interaction, motion, simulation, and more...</i><br /><br /><br />";
$html .= "<ul class=\"examples\">\n";
foreach ($catTopics as $cat => $array) {
$html .= "<li><ul><li><b>{$cat}</b></li><br />";
foreach ($array as $file => $name) {
$thisfile = strtolower($file);
$html .= "\t<li><a href=\"{$thisfile}\">{$name}</a></li>\n";
}
$html .= '</ul></li>';
}
$html .= "</ul>";
$page->content($html);
// Change 2 May 2013
//writeFile('learning/'.strtolower($subdir).'/index.html', $page->out());
writeFile('examples/index.html', $page->out());
$benchmark_end = microtime_float();
$execution_time = round($benchmark_end - $benchmark_start, 4);
?>
<h2>Examples pages generation Successful</h2>
<p>Generated <?php
echo $count + 1;
?>
files in <?php
echo $execution_time;
?>
seconds.</p>
<h2>Updated <?php
echo $where;
?>
开发者ID:Nehamkin,项目名称:processing-docs,代码行数:31,代码来源:examples.php
注:本文中的writeFile函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论