本文整理汇总了PHP中hg_file_write函数的典型用法代码示例。如果您正苦于以下问题:PHP hg_file_write函数的具体用法?PHP hg_file_write怎么用?PHP hg_file_write使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了hg_file_write函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: log2file
function log2file($user, $level, $message, $input, $output = array())
{
if (!LOG_LEVEL) {
return;
}
if (LOG_FOR_USER != 'ALL' && $user['user_name'] != LOG_FOR_USER) {
return;
}
$level = strtoupper($level);
$log_level = array('ERROR' => 1, 'DEBUG' => 2, 'ALL' => 3);
if ($log_level[$level] > LOG_LEVEL) {
return;
}
$log_path = CUR_CONF_PATH . 'data/log/' . date('Y') . '/' . date('m') . '/';
if (!is_dir($log_path)) {
hg_mkdir($log_path);
}
$input = json_encode($input);
$output = json_encode($output);
$time = date('Y-m-d H:i');
$user = @json_encode($user);
$log_message_tpl = <<<LC
Level : {$level}
Message : {$message}
Input : {$input}
Ouput : {$output}
Date\t: {$time}
User\t: {$user}
LC;
hg_file_write($log_path . 'log-' . date('Y-m-d') . '.php', $log_message_tpl, 'a+');
}
开发者ID:h3len,项目名称:Project,代码行数:33,代码来源:functions.php
示例2: get_server_config
/**
* 生成缓存文件
* Enter description here ...
*/
private function get_server_config()
{
$alive_filename = $this->settings['alive_filename'] ? $this->settings['alive_filename'] : 'alive';
$filename = $alive_filename . '.php';
if (is_file(CACHE_DIR . $filename)) {
include CACHE_DIR . $filename;
} else {
$this->db = hg_ConnectDB();
$sql = "SELECT id, host, output_dir, input_port, type FROM " . DB_PREFIX . "server_config ";
$sql .= " WHERE status = 1 ORDER BY id DESC ";
$q = $this->db->query($sql);
$return = array();
while ($row = $this->db->fetch_array($q)) {
$row['host'] = $row['host'] . ':' . $row['input_port'];
$return[] = $row;
}
$content = '<?php
if (!IS_READ)
{
exit();
}
$return = ' . var_export($return, 1) . ';
?>';
hg_file_write(CACHE_DIR . $filename, $content);
}
return $return;
}
开发者ID:h3len,项目名称:Project,代码行数:31,代码来源:alive.php
示例3: hg_debug_tofile
function hg_debug_tofile($str, $is_arr = 0, $dir = '', $op_type = 'a+', $tofile = false)
{
if ($is_arr) {
$str = var_export($str, true);
}
if ($op_type == "a" || $op_type == "a+") {
$str .= "<br />";
}
$tmp_info = debug_backtrace();
$debug_tree = "";
$max = count($tmp_info);
$i = 1;
foreach ($tmp_info as $debug_info) {
$space = str_repeat(' ', $max - $i);
$debug_tree = "<br />" . $space . $debug_info['file'] . " on line " . $debug_info['line'] . ":" . $debug_tree;
$i++;
}
$str = "<br />" . '[' . date('Y-m-d H:i:s') . ']' . $debug_tree . $str;
if ($tofile) {
$filename = $dir ? $dir : LOG_DIR . "log.txt";
hg_file_write($filename, $str, $op_type);
} else {
echo $str;
}
}
开发者ID:h3len,项目名称:Project,代码行数:25,代码来源:db.class.php
示例4: hg_debug_tofile
function hg_debug_tofile($str = '', $is_arr = 0, $dir = '', $filename = 'log.txt', $op_type = 'a+', $tofile = true)
{
if ($is_arr) {
$str = var_export($str, true);
}
if ($op_type == "a" || $op_type == "a+") {
if ($tofile) {
$entersplit = "\r\n";
} else {
$entersplit = "<br />";
}
}
$tmp_info = debug_backtrace();
$str .= $entersplit;
$debug_tree = "";
$max = count($tmp_info);
$i = 1;
foreach ($tmp_info as $debug_info) {
$space = str_repeat(' ', $max - $i);
$debug_tree = $entersplit . $space . $debug_info['file'] . " on line " . $debug_info['line'] . ":" . $debug_tree;
$i++;
}
$str = $entersplit . '[' . date('Y-m-d H:i:s') . ']' . $debug_tree . $str;
if ($tofile) {
$filename = $filename ? $filename : "log.txt";
$filenamedir = explode('/', $filename);
unset($filenamedir[count($filenamedir) - 1]);
hg_mkdir(LOG_DIR . $dir . implode('/', $filenamedir));
hg_file_write(LOG_DIR . $dir . $filename, $str, $op_type);
} else {
echo $str;
}
}
开发者ID:h3len,项目名称:Project,代码行数:33,代码来源:debug.php
示例5: buildCache
function buildCache($filename, $content)
{
if ($this->menableCache) {
$this->deleteCache($filename);
$filename = $this->mcacheDir . md5($filename) . $this->msuffix;
return hg_file_write($filename, $content);
} else {
return false;
//缓存被禁用
}
}
开发者ID:h3len,项目名称:Project,代码行数:11,代码来源:cache.class.php
示例6: recache
function recache($cache_name, $cache_dir = CACHE_DIR)
{
if (empty($cache_name)) {
return false;
}
$material_type = $this->get_material_type();
hg_mkdir($cache_dir);
$cache_file = $cache_dir . $cache_name;
hg_file_write($cache_file, serialize($material_type));
return $material_type;
}
开发者ID:h3len,项目名称:Project,代码行数:11,代码来源:cache.class.php
示例7: settings_process
function settings_process()
{
$basic_settings = $this->input['param']['cloudvideo_basic_set'];
if (!is_array($basic_settings)) {
$basic_settings = array();
}
$content = '<?php
return $basic_settings = ' . var_export($basic_settings, 1) . ';
?>';
hg_file_write(DATA_DIR . 'settings.php', $content);
}
开发者ID:h3len,项目名称:Project,代码行数:11,代码来源:configuare.php
示例8: ParseTemplate
/**
* 解析模板,生成模板缓存
* @param $FileName
* @return String
*/
public function ParseTemplate($FileName = '')
{
$file = $this->mTemplateDir . $FileName;
if (!is_file($file)) {
return false;
}
$content = file_get_contents($file);
$content = $this->ParseNestTemplate($content);
$cache_file = $this->mTemplateCacheDir . md5($FileName . realpath($this->mTemplateDir)) . '.php';
hg_file_write($cache_file, $content);
return $cache_file;
}
开发者ID:h3len,项目名称:Project,代码行数:17,代码来源:template.class.php
示例9: update_cache
function update_cache($v = array(), $cache_dir = CACHE_DIR)
{
if (is_string($v) && !empty($v)) {
$v['name'] = $v;
}
if ($v['name']) {
if (empty($v['value'])) {
$v['value'] = $this->cache[$v['name']];
} else {
$this->cache[$v['name']] = $v['value'];
}
$cache_file = $cache_dir . $this->convert_cache_name($v['name'], true) . '.php';
if ($v['value'] === false) {
$v['value'] = 0;
}
if (!defined('CACHE_INCLUDE')) {
$content = '<' . '?php exit; ?' . '>' . serialize($v['value']);
} else {
$content = '<' . "?php\n\$gCache['{$v['name']}'] = " . var_export($v['value'], true) . ";\n?" . '>';
}
hg_file_write($cache_file, $content);
}
}
开发者ID:h3len,项目名称:Project,代码行数:23,代码来源:functions.class.php
示例10: error_output
$rename = @rename($mp4, $source_file);
if (!$rename) {
error_output('005', '视频权限限制,无法编辑视频');
}
$mediainfo = new mediainfo($source_file);
$source_file_data = $mediainfo->getMeidaInfo();
$source = array();
foreach ($svodid as $k => $vid) {
$video_dir = hg_num2dir($vid);
$targerdir = TARGET_DIR . $video_dir . $vid . '.ssm/';
if ($vid == $vodid) {
$sourcef = $source_file;
$data = $source_file_data;
} else {
$sourcef = $targerdir . $vid . '.mp4';
if (!is_file($sourcef)) {
error_output('006', '指定片段视频不存在');
}
$mediainfo->setFile($sourcef);
$data = $mediainfo->getMeidaInfo();
}
$source[] = array('source' => $sourcef, 'start' => intval($start[$k]), 'duration' => intval($duration[$k]), 'mediainfo' => $data);
}
$curl = new curl($gVodApi['host'], $gVodApi['dir'], $gVodApi['token']);
$curl->initPostData();
$conf = $curl->request('vod_config.php');
$gTransApi['filename'] = 'getVideoInfo.php';
$trans_info = array('sourceFile' => $source, 'id' => $video_id, 'vodid' => $vodid, 'targetDir' => $targerdir, 'config' => $conf[0], 'callback' => $gTransApi);
hg_file_write(UPLOAD_DIR . FILE_QUEUE . $vodid, json_encode($trans_info));
$data = array('id' => $video_id, 'vodid' => $vodid, 'trans_info' => $trans_info);
output($data);
开发者ID:h3len,项目名称:Project,代码行数:31,代码来源:update.php
示例11: hg_update_role_prms
function hg_update_role_prms($role_ids = '')
{
$complex = array();
global $gDB;
//获取节点和发布栏目的权限
$sql = 'SELECT * FROM ' . DB_PREFIX . 'role_prms WHERE admin_role_id IN(' . $role_ids . ')';
$query = $gDB->query($sql);
while ($row = $gDB->fetch_array($query)) {
$temp = array();
$temp['action'] = trim($row['func_prms']) ? explode(',', $row['func_prms']) : array();
$temp['nodes'] = strlen($row['node_prms']) ? explode(',', $row['node_prms']) : array();
$temp['setting'] = $row['setting_prms'];
$temp['is_complete'] = $row['is_complete'];
$complex[$row['admin_role_id']]['app_prms'][$row['app_uniqueid']] = $temp;
}
//栏目节点
$sql = 'SELECT publish_prms,extend_prms,id,site_prms FROM ' . DB_PREFIX . 'admin_role WHERE id IN(' . $role_ids . ')';
$query = $gDB->query($sql);
while ($publish_prms = $gDB->fetch_array($query)) {
$complex[$publish_prms['id']]['site_prms'] = $publish_prms['site_prms'] ? explode(',', $publish_prms['site_prms']) : array();
$complex[$publish_prms['id']]['publish_prms'] = $publish_prms['publish_prms'] ? explode(',', $publish_prms['publish_prms']) : array();
$complex[$publish_prms['id']]['default_setting'] = $publish_prms['extend_prms'] ? unserialize($publish_prms['extend_prms']) : array();
}
if ($complex) {
foreach ($complex as $role_id => $prms) {
if (!write_role_prms_to_redis($role_id, json_encode($prms))) {
$cache_dir = get_prms_cache_dir();
if (!is_dir($cache_dir)) {
hg_mkdir($cache_dir);
}
$role_prms_file = get_prms_cache_dir($role_id);
//$prms = hg_merger_show_node($prms);
$content = '<?php
/*
权限测试注意事项
1、授权和测试在同一服务器上 因为读取是缓存文件
2、确定自己应用的主模块的标识符号
3、辅助模块 即除了主模块以外的 都是通过settings这个选项判定是否具有增删改查的权限
4、app_prms 存储的是应用标志 主要用于主模块的操作和节点控制
5、site_prms 全站栏目授权
6、publish_prms 控制发布权限 有栏目即即有发布操作权限
7、default_setting 控制其他选项 同之前版本
*/
return ' . var_export($prms, 1) . ';?>';
hg_file_write($role_prms_file, $content);
}
}
}
return $complex;
}
开发者ID:h3len,项目名称:Project,代码行数:50,代码来源:functions.php
示例12: cache
public function cache()
{
$sql = 'SELECT sort.id as catalog_sort_id,sort.catalog_sort,
sort.catalog_sort_name,field.id,field.catalog_field,field.remark,
field.catalog_default,field.selected,field.bak,field.batch,field.required,
field.zh_name,style.formhtml AS style,style.type FROM ' . DB_PREFIX . 'field AS field
LEFT JOIN ' . DB_PREFIX . 'style AS style ON field.form_style=style.id
LEFT JOIN ' . DB_PREFIX . 'field_sort AS sort ON sort.id=field.catalog_sort_id WHERE 1 AND field.switch = 1';
$sql .= " ORDER BY sort.order_id DESC,field.order_id DESC";
$q = $this->db->query($sql);
while ($data = $this->db->fetch_array($q)) {
$data['catalog_field'] = catalog_prefix($data['catalog_field']);
$default = $data['catalog_default'] = $data['catalog_default'] ? explode(',', $data['catalog_default']) : NULL;
$data['selected'] = maybe_unserialize($data['selected']);
if (is_string($data['selected']) && !empty($data['selected'])) {
$data['selected'] = $this->content_change($data['type'], $data['selected']);
}
$datas[$data['catalog_sort']]['catalog_sort_id'] = $data['catalog_sort_id'];
$datas[$data['catalog_sort']]['catalog_sort_name'] = $data['catalog_sort_name'];
$datas[$data['catalog_sort']]['catalog_sort'] = $data['catalog_sort'];
if ($data['type'] == 'text' || $data['type'] == 'textarea') {
$data['style'] = str_replace(REPLACE_NAME, $data['catalog_field'], $data['style']);
} elseif ($data['type'] == 'radio') {
$style = str_replace(REPLACE_NAME, $data['catalog_field'], $data['style']);
unset($data['style']);
foreach ($default as $defaults) {
$data['style'] .= str_replace(REPLACE_DATA, $defaults, $style);
}
} elseif ($data['type'] == 'checkbox') {
$style = str_replace(REPLACE_NAME, $data['catalog_field'] . '[]', $data['style']);
unset($data['style']);
foreach ($default as $defaults) {
$data['style'] .= str_replace(REPLACE_DATA, $defaults, $style);
}
} elseif ($data['type'] == 'option') {
$style = $data['style'];
unset($data['style']);
foreach ($default as $defaults) {
$data['style'] .= str_replace(REPLACE_DATA, $defaults, $style);
}
$data['style'] = '<select name=' . $data['catalog_field'] . '><option value>请选择' . $data['zh_name'] . '</option>' . $data['style'] . '</select>';
} elseif ($data['type'] == 'img') {
if ($data['batch']) {
$data['style'] = str_replace(REPLACE_NAME, $data['catalog_field'] . '[]', $data['style']);
} else {
$data['style'] = str_replace(REPLACE_NAME, $data['catalog_field'], $data['style']);
}
} else {
continue;
}
$html = array('catalog_id' => $data['id'], 'zh_name' => $data['zh_name'], 'catalog_field' => $data['catalog_field'], 'remark' => $data['remark'], 'catalog_default' => $data['catalog_default'], 'selected' => $data['selected'], 'bak' => $data['bak'], 'batch' => $data['batch'], 'required' => $data['required'], 'type' => $data['type'], 'style' => $data['style']);
$datas[$data['catalog_sort']]['html'][$data['catalog_field']] = $html;
$datas[$data['catalog_sort']]['html'][$data['catalog_field']]['data'] = NULL;
}
$text = '<?php $cache=' . var_export($datas, true) . ';?>';
hg_file_write(CACHE_SORT, $text);
}
开发者ID:h3len,项目名称:Project,代码行数:57,代码来源:catalog.core.php
示例13: _changeCss
private function _changeCss($dir, $root = false)
{
if (!$root) {
$root = $dir;
}
if (is_dir($dir) && ($dh = opendir($dir))) {
while (false !== ($file = readdir($dh))) {
if ($file != '.' && $file != '..') {
if (is_dir($dir . $file . '/')) {
$this->_changeCss($dir . $file . '/', $root);
} else {
if (preg_match('/.css$/', $file)) {
$content = file_get_contents($dir . $file);
$content = preg_replace("/{\\\$[a-zA-Z0-9_\\[\\]\\-\\'\\>]+}/", RESOURCE_URL, $content);
hg_file_write($dir . $file, $content);
}
}
}
}
closedir($dh);
}
}
开发者ID:RoyZeng,项目名称:custom,代码行数:22,代码来源:template.php
示例14: show
function show()
{
$hg_ad_js = ADV_DATA_DIR . 'script/hg_ad.js';
if (!file_exists($hg_ad_js) || $this->input['forcejs']) {
if (!is_dir(ADV_DATA_DIR . 'script/')) {
hg_mkdir(ADV_DATA_DIR . 'script/');
}
$adjs = file_get_contents('./core/ad.js');
hg_file_write($hg_ad_js, str_replace('{$addomain}', AD_DOMAIN, $adjs));
}
$para = array();
$para['offset'] = $this->input['offset'] ? intval($this->input['offset']) : 0;
$para['count'] = $this->input['count'] ? intval($this->input['count']) : 100;
$para['where'] = urldecode($this->get_condition());
$para['arcinfo'] = json_decode(urldecode($this->input['vinfo']), true);
$para['colid'] = hg_filter_ids($this->input['colid']);
$para['colid'] = $para['colid'] == -1 ? 0 : $para['colid'];
$dostatistic = true;
if ($this->input['preview']) {
$dostatistic = false;
}
$ad = new adv();
$ads = $ad->getAdDatas($para, $dostatistic);
if ($ads) {
$outputjs = '';
foreach ($ads as $k => $r) {
$_ad = $r;
if (!is_array($r[0])) {
//不存在广告位多个广告
$_ad = array(0 => $r);
unset($r);
}
$_ad_tpl = '';
foreach ($_ad as $r) {
if ($r['mtype'] != 'javascript') {
$is_js = 0;
} else {
$is_js = 1;
}
$r['param'] = array_merge((array) $r['param']['pos'], (array) $r['param']['ani']);
$r['param']['title'] = $r['title'];
$r['param']['content'] = build_ad_tpl($r['url'], $r['mtype'], $r['param']);
foreach ($r as $k => $v) {
if (is_array($v)) {
foreach ($v as $kk => $vv) {
${$kk} = $vv;
}
} else {
${$k} = $v;
}
}
if (!$tpl) {
$tpl = '{$content}';
}
$ad_tpl = stripslashes(preg_replace("/{(\\\$[a-zA-Z0-9_\\[\\]\\-\\'\"\$\\>\\.]+)}/ies", '${1}', $tpl));
$ad_tpl = preg_replace("/[\n]+/is", '', $ad_tpl);
//通过API进行统计
if ($link) {
if ($r['mtype'] != 'javascript') {
$_ad_tpl .= '<a href="' . AD_DOMAIN . 'click.php?a=doclick&url=' . urlencode($link) . '&pubid=' . $pubid . '" target="_blank">' . $ad_tpl . '</a>';
}
} else {
$_ad_tpl .= $ad_tpl;
}
if (!$ad_js_para) {
$ad_js_para = stripslashes(preg_replace("/{\\\$([a-zA-Z0-9_\\[\\]\\-\\'\"\$\\>\\.]+)}/ies", '${1} . ":\\"" . $${1} . "\\""', str_replace("\r\n", '', $js_para)));
}
}
$outputjs .= 'hg_AD_AddHtml({para:{' . $ad_js_para . '}, html:"' . addslashes($_ad_tpl) . '",box:"ad_' . $id . '",loadjs:"' . $include_js . '",loadurl:"' . ADV_DATA_URL . 'script/",isjs:' . $is_js . '});';
}
header('Content-Type:application/x-javascript');
echo $outputjs;
}
}
开发者ID:h3len,项目名称:Project,代码行数:74,代码来源:javascript.php
示例15: unset_logindb_cache
public function unset_logindb_cache()
{
$id = $this->input['id'];
if (!$id) {
$this->errorOutput("无效的数据库服务器");
}
if ($id) {
//禁用的数据库
$sql = 'UPDATE ' . DB_PREFIX . 'login_server SET status = 0 WHERE id IN(' . $id . ')';
$this->db->query($sql);
}
$sql = 'SELECT host,port,user,pass,`database`,`charset`,`pconnect` FROM ' . DB_PREFIX . 'login_server WHERE status=1 ORDER BY id DESC';
//$this->errorOutput($sql);
$query = $this->db->query($sql);
$cache = array();
while ($row = $this->db->fetch_array($query)) {
$cache[] = $row;
}
hg_file_write(CACHE_DIR . 'loginserv.php', "<?php\n \$servers = " . var_export($cache, 1) . "\n?>");
$this->addItem(explode(',', $id));
$this->output();
}
开发者ID:h3len,项目名称:Project,代码行数:22,代码来源:logindb_update.php
示例16: generate
/**
* 云表单使用需要选择模板
*/
public function generate()
{
$id = $this->input['id'];
if (!$id) {
$this->errorOutput(NOID);
}
$lottery = $this->mode->detail($id);
if (!$lottery) {
$this->errorOutput(NO_DATA);
}
if (!defined('LOTTERY_DOMAIN') || !LOTTERY_DOMAIN) {
$this->errorOutput(ERROR_URL);
}
$dir = $this->template->get_template($lottery['type']);
//文件路径加密
include_once CUR_CONF_PATH . 'lib/XDeode.php';
$this->script = new XDeode();
$dir_file = $this->script->encode($lottery['user_id']);
$filename = $this->script->encode($lottery['id']);
$lottery['winlist_url'] = $this->settings['winlist_url'];
$lottery['prize'] = json_encode($lottery['prize']);
$lottery['assist_url'] = LOTTERY_DOMAIN . $dir['sign'] . '/' . $dir['theme'] . '/' . $dir['id'];
$lottery['url'] = LOTTERY_DOMAIN . 'lottery.php';
//生成内容静态页
$content = $this->template->generation($lottery, $dir['template_file']);
if (!$content) {
$this->errorOutput('生成模板失败');
}
$html_dir = DATA_DIR . $dir_file . '/';
if (!is_dir($html_dir)) {
hg_mkdir($html_dir);
}
hg_file_write($html_dir . '/' . $filename . '.html', $content, 'wb+');
//生成辅助文件
if (!$this->template->create_file(array('lottery.php'))) {
$this->errorOutput('生成辅助文件失败');
}
//生成js/css/images辅助文件
if (!$this->template->generate_assist($dir['style_dir'], $dir['sign'], $dir['theme'], $dir['id'])) {
$this->errorOutput('生成辅助文件失败');
}
if (file_exists($html_dir . '/' . $filename . '.html')) {
$ret['state'] = 1;
$ret['url'] = LOTTERY_DOMAIN . $dir_file . '/' . $filename . '.html';
} else {
$ret['state'] = 0;
}
$this->addItem($ret);
$this->output();
}
开发者ID:h3len,项目名称:Project,代码行数:53,代码来源:lottery_update.php
示例17: compile_show
private function compile_show($nodeapi, $application, $mod_uniqueid = '')
{
$api = $this->cal_api($application, $nodeapi);
$program = '<?php
$this->curlNode = new curl(\'' . $api['host'] . '\', \'' . $api['dir'] . '\', \'' . $api['token'] . '\');
';
$nodeapi['return_var'] = $nodeapi['return_var'] ? $nodeapi['return_var'] : $nodeapi['template'];
$nodeapi['primary_key'] = $nodeapi['primary_key'] ? $nodeapi['primary_key'] : '_id';
$program .= '
$fid = $this->input[\'fid\'];
$offset = $this->input[\'offset\'];
$count = $this->input[\'count\'];
$this->curlNode->setReturnFormat(\'' . $nodeapi['return_type'] . '\');
$this->curlNode->initPostData();
$this->curlNode->addRequestData(\'a\', \'' . $nodeapi['func_name'] . '\');
if (!empty($offset))
{
$this->curlNode->addRequestData(\'offset\', $offset);
}
if (!empty($count))
{
$this->curlNode->addRequestData(\'count\', $count);
}
$this->curlNode->addRequestData(\'fid\', $fid);
$this->curlNode->addRequestData(\'trigger_action\', \'show\');
$this->curlNode->addRequestData(\'trigger_mod_uniqueid\', \'' . $mod_uniqueid . '\');
$hg_data = $this->curlNode->request(\'' . $nodeapi['file_name'] . $nodeapi['file_type'] . '\');
$s = \'hg_' . $nodeapi['return_var'] . '_selected\';
if ($$s)
{
if (!is_array($$s))
{
$$s = array($$s);
}
$hg_selected_node = implode(\',\', $$s);
$this->curlNode->initPostData();
$this->curlNode->addRequestData(\'a\', \'' . $nodeapi['func_name'] . '\');
$this->curlNode->addRequestData(\'' . $nodeapi['primary_key'] . '\', $hg_selected_node);
$hg_selected_data = $this->curlNode->request(\'' . $nodeapi['file_name'] . $nodeapi['file_type'] . '\');
$this->tpl->addVar(\'hg_' . $nodeapi['return_var'] . '_selected\', $hg_selected_data);
}
$hg_node_template = \'' . $nodeapi['template'] . '\';
$extlink = \'&infrm=1\';
$hg_attr[\'nodeapi\'] = \'fetch_node.php?nid=' . $nodeapi['id'] . '&node_en=' . $nodeapi['node_uniqueid'] . '&mid=\' . $this->input[\'mid\'] . $extlink;
';
$program .= '
$this->tpl->addVar(\'hg_' . $nodeapi['return_var'] . '\', $hg_data);
$this->tpl->addVar(\'hg_' . $nodeapi['return_var'] . '_attr\', $hg_attr);
$this->tpl->addVar(\'hg_data\', $hg_data);
$this->tpl->addVar(\'hg_attr\', $hg_attr);
';
if (hg_mkdir($this->mNodedir)) {
hg_file_write($this->mNodedir . $nodeapi['id'] . '.php', $program);
} else {
exit($this->mNodedir . '目录不可写');
}
return $this->mNodedir . $nodeapi['id'] . '.php';
}
开发者ID:h3len,项目名称:Project,代码行数:58,代码来源:node.class.php
示例18: cellProcess
/**
* 处理单元、生成单元的html
*
* @param array $info 单元详细信息
* @param boolean $force 是否强制生成单元缓存
* @param array $arData 数据、有此参数时用该数据生成单元hmtl 用于单元预览
* @param array 处理过后的单元详细信息
*/
public function cellProcess($info, $force = false, $arData = array())
{
if (!$info['cell_mode']) {
//return array();
}
/**********专题栏目链接处理***************************/
if (strpos($info['more_href'], 'COLURL') !== false) {
$intColumnId = intval(str_replace('COLURL', '', $info['more_href']));
if (!class_exists('special')) {
include ROOT_PATH . 'lib/class/special.class.php';
}
$objSpecial = new special();
$info['more_href'] = $objSpecial->get_special_col_url($intColumnId);
}
/**********专题栏目链接处理***************************/
$mode_info = common::get_mode_info(intval($info['cell_mode']), $info['id'], intval($info['css_id']), intval($info['js_id']), $info['param_asso']);
$blBuiltCell = $this->blBuiltCell && $this->blBuiltCell !== 'false' ? 1 : 0;
if ($info['cell_type'] == 3 && $blBuiltCell) {
$html = $info['static_html'];
} else {
$content = $mode_info['mode_info']['content'];
$content = str_replace(' ', ' ', $content);
$ret_data = array();
if (!$info['data_source']) {
$map = common::get_mode_map($mode_info);
if ($blBuiltCell) {
$ret_data = !empty($arData) ? $arData : $mode_info['mode_info']['default_param'];
}
$ret_data = $info['using_block'] ? common::getBlockData($info['block_id']) : $ret_data;
} else {
$data_source = common::get_datasource_info($info['data_source'], $info['param_asso']);
if ($info['using_block'] && $blBuiltCell) {
$ret_data = !empty($arData) ? $arData : common::getBlockData($info['block_id']);
} else {
$map = common::get_cell_map($mode_info, $data_source, $info['param_asso']);
if ($blBuiltCell) {
$ret_data = common::get_content_by_datasource($info['data_source'], $map['data_input_variable']);
if (isset($ret_data['total'])) {
$intTotal = $ret_data['total'];
$ret_data = $ret_data['data'];
}
if (!$info['layout_id']) {
//替换已经编辑过的单元数据
if (!class_exists('cell')) {
include CUR_CONF_PATH . 'lib/cell.class.php';
}
$objCell = new cell();
$arCellData = $objCell->getCellData($info['id']);
if (is_array($ret_data) && count($ret_data) > 0) {
foreach ($ret_data as $k => $v) {
!empty($arCellData[$v['id']]) && ($arCellData[$v['id']]['id'] = $arCellData[$v['id']]['content_id']);
$ret_data[$k] = !empty($arCellData[$v['id']]) ? $arCellData[$v['id']] : $v;
if (!empty($arData)) {
if ($v['id'] == $arData['content_id']) {
//arData 预览提交的数据
$arData['id'] = $arData['content_id'];
$ret_data[$k] = $arData;
}
}
}
}
}
if (isset($intTotal)) {
$ret_data = array('total' => $intTotal, 'data' => $ret_data);
}
}
}
}
$cache_file = $info['layout_id'] ? $info['id'] . '_' . $info['layout_id'] . '.php' : $info['id'] . '.php';
$cache_filepath = MODE_CACHE_DIR . substr(md5($cache_file), 0, 2) . '/';
include_once CUR_CONF_PATH . 'lib/parse.class.php';
$parse = new Parse();
$parse->parse_template(stripcslashes($content), $info['id'], $mode_info['mode_info'], $map['relation_map'], $map['mode_variable_map'], $map['variable_function_relation']);
if ($blBuiltCell) {
if (MAGIC_DEBUG) {
$path = CUR_CONF_PATH . 'cache/log/data/';
hg_mkdir($path);
hg_file_write($path . $info['id'] . '.txt', var_export($map['data_input_variable'], 1) . var_export($ret_data, 1));
}
$html = $parse->built_cell_html($ret_data, $cache_file, $mode_info['mode_info'], $this->arNeedPageInfo, $this->arPageSiteInfo, $this->arPageColumnInfo, $this->arPageClientInfo, $this->arPageSpecialInfo, $this->arPageSpecialColumnInfo, $map['data_input_variable'], $force, $cache_filepath);
if ($info['is_header']) {
$find = array('{$header_text}', '{$more_href}', '{$more_text}');
$replace = array($info['header_text'], $info['is_more'] ? $info['more_href'] : '#', $info['is_more'] ? '更多>>' : '');
$header = str_replace($find, $replace, $this->settings['header_dom']['cell']);
$html = $header . $html;
}
// if (empty($ret_data)) {
// $html = '<span>暂无数据</span>' . $html;
// }
} else {
$parse->built_mode_cache($cache_file, $cache_filepath);
}
//.........这里部分代码省略.........
开发者ID:h3len,项目名称:Project,代码行数:101,代码来源:magic.class.php
示例19: hg_cache_outputxml
function hg_cache_outputxml($filepath = '', $filename = '', $content = '')
{
if (!CACHE_TIME) {
return;
}
if (!$filename || !$filepath) {
return false;
}
if (hg_mkdir($filepath)) {
hg_file_write($filepath . $filename . '.xml', $content);
}
}
开发者ID:h3len,项目名称:Project,代码行数:12,代码来源:functions.php
示例20: uploadVideo
public function uploadVideo()
{
$params['cate_id'] = $this->input['cate_id'];
if ($params['cate_id'] && ($categoryVideoNumMax = $this->settings['categoryVideoNumMax'])) {
$sql = 'select count(*) as total from ' . DB_PREFIX . 'video where 1 and cate_id = ' . $params['cate_id'] . ' and user_id = ' . $this->user['user_id'];
$total = $this->db->query_first($sql);
if ($total['total'] > $categoryVideoNumMax) {
$this->errorOutput('此专辑内视频已达上限');
}
}
$re = $this->upload();
if (!is_array($re[0])) {
$this->errorOutput(NO_VIDEO_UPLOAD);
}
//视频video_id
$params['id'] = $re[0]['id'];
$params['title'] = $re[0]['title'];
//视频img
$params['img']['host'] = $re[0]['img']['host'];
$params['img']['dir'] = $re[0]['img']['dir'];
$params['img']['filepath'] = $re[0]['img']['filepath'];
$params['img']['filename'] = $re[0]['img']['filename'];
$text = '<?php return ' . var_export($params, true) . ';?>';
$filePath = CACHE_DIR . 'uploadVideo_' . $params['id'] . '.php';
hg_file_write($filePath, $text);
$cache_file = CUR_CONF_PATH . $filePath;
if (!file_exists($cache_file)) {
$this->errorOutPut(CACHE_ERROR);
}
$this->addItem($params);
$this->output();
}
开发者ID:h3len,项目名称:Project,代码行数:32,代码来源:VideoUpdate.php
注:本文中的hg_file_write函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论