本文整理汇总了PHP中get_file_path函数的典型用法代码示例。如果您正苦于以下问题:PHP get_file_path函数的具体用法?PHP get_file_path怎么用?PHP get_file_path使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_file_path函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: set
/**
* SET
* Add data to a cache file
*/
function set($key, $data)
{
// Get file path
$file_path = get_file_path($key);
// Add content to file
file_put_contents($file_path, serialize($data));
}
示例2: loadController
function loadController()
{
$controllerName = $this->router->getController();
$controllerPath = get_file_path($controllerName, "controllers");
if (file_exists($controllerPath)) {
require $controllerPath;
$controller = new $controllerName();
return $controller;
} else {
$this->showError("Not found controller.");
return false;
}
}
示例3: ParsePHPFile
function ParsePHPFile($file, $prepend_out = '')
{
$contents = file_get_contents($file);
$contents = strip_comments($contents);
if (preg_match_all("/<\\?(php)?(.*?)(\\?>|\$\$)/s", $contents, $matchs)) {
foreach ($matchs[2] as $match) {
$match = strip_comments($match);
$results = lookForPaths($match);
if ($results) {
for ($i = 0; $i < count($results[0]); $i++) {
$file_param = get_file_path($results[1][$i], $results[2][$i]);
if (is_absolute_file($file_param)) {
echo $prepend_out . "{$file} : " . trim($results[0][$i]) . PHP_EOL;
}
}
}
}
}
}
示例4: plugin_main_visual_convert
/**
* Main Visual Setting Plugin
* -------------------------------------------
* main_visual.inc.php
*
* Copyright (c) 2010 hokuken
* http://hokuken.com/
*
* created : 2010-09-13
* modified :
*
* hokukenstyleデザインで、main_visualを利用するときに使うプラグイン
*
* Usage :
* #mainvidual(imgurl|PageName[,title]);
*
*/
function plugin_main_visual_convert()
{
$args = func_get_args();
//error
if (count($args) == 0) {
return '';
}
$url = get_file_path($args[0]);
$title = count($args) > 1 ? htmlspecialchars($args[1]) : htmlspecialchars($url);
$align = 'center';
if (isset($args[2])) {
switch ($args[2]) {
case 'right':
$align = 'right';
break;
case 'left':
$align = 'left';
break;
}
}
$mv = '';
if (preg_match('/.*\\.(png|gif|jpg|jpeg)/i', $url)) {
$fp = fopen($url, 'r');
if ($fp) {
$mv = '<div style="text-align:' . $align . '"><img src="' . $url . '" title="' . $title . '" alt="' . $title . '" /></div>';
}
fclose($fp);
} else {
if (is_page($url)) {
$mv = convert_html(get_source($url));
}
}
if ($mv != '') {
$qt = get_qt();
$qt->setv('main_visual', "<div id=\"main_visual\">\n" . $mv . "\n</div>\n");
}
return '';
}
示例5: isset
$cancel = isset($HTTP_POST_VARS['cancel']) ? TRUE : FALSE;
if (empty($HTTP_POST_VARS['send_file'])) {
$no_page_header = $cancel ? TRUE : FALSE;
require $phpbb_root_path . 'admin/pagestart.php';
}
if ($cancel) {
$header_location = @preg_match('/Microsoft|WebSTAR|Xitami/', getenv('SERVER_SOFTWARE')) ? 'Refresh: 0; URL=' : 'Location: ';
header($header_location . append_sid("admin_styles.php"));
exit;
}
if (isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode'])) {
$mode = isset($HTTP_GET_VARS['mode']) ? $HTTP_GET_VARS['mode'] : $HTTP_POST_VARS['mode'];
} else {
$mode = "";
}
$styles_dir_name = get_file_path('/design/phpbb/templates');
switch ($mode) {
case "edit":
$submit = isset($HTTP_POST_VARS['submit']) ? TRUE : 0;
if ($submit) {
//
// DAMN! Thats alot of data to validate...
//
$updated['style_name'] = $HTTP_POST_VARS['style_name'];
$updated['template_name'] = $HTTP_POST_VARS['template_name'];
$updated['head_stylesheet'] = $HTTP_POST_VARS['head_stylesheet'];
$updated['body_background'] = $HTTP_POST_VARS['body_background'];
$updated['body_bgcolor'] = $HTTP_POST_VARS['body_bgcolor'];
$updated['body_text'] = $HTTP_POST_VARS['body_text'];
$updated['body_link'] = $HTTP_POST_VARS['body_link'];
$updated['body_vlink'] = $HTTP_POST_VARS['body_vlink'];
示例6: get_random_image
function get_random_image($cat_id = 0, $show_link = 1, $return_file = 0)
{
global $site_template, $random_image_cache;
if (!isset($random_image_cache)) {
$random_image_cache = get_random_image_cache();
}
if ($cat_id && SHOW_RANDOM_CAT_IMAGE) {
$template = 'random_cat_image';
$category_id = $cat_id;
} else {
$template = 'random_image';
if (SHOW_RANDOM_CAT_IMAGE) {
srand((double) microtime() * 1000000);
$category_id = array_rand($random_image_cache);
} else {
$category_id = 0;
}
}
if (!empty($random_image_cache[$category_id])) {
if (!$return_file) {
show_image($random_image_cache[$category_id], "", $show_link);
$random_image = $site_template->parse_template($template);
return $random_image;
} else {
return get_file_path($random_image_cache[$category_id]['image_thumb_file'], "thumb", $category_id, 0, 1);
}
}
}
示例7: realpath
<?php
// Define system path path
$system_path = "";
if (realpath($system_path) !== false) {
$system_path = realpath($system_path) . '/';
}
define("BASEPATH", str_replace("\\", "/", $system_path));
// load common functions
require BASEPATH . "/libs/Common.php";
// load config file
require get_file_path("paths", "config");
require get_file_path("database", "config");
// Use an autoloader!
require get_file_path("Bootstrap", "libs");
require get_file_path("Controller", "libs");
require get_file_path("Model", "libs");
require get_file_path("View", "libs");
require get_file_path("Database", "libs");
require get_file_path("Session", "libs");
$app = new Bootstrap();
示例8: get_shares_as_string
$ret = '';
if ($colluded_list['more'] <= 0) {
$shares = get_shares_as_string($_GET['fid']);
$info['shares'] = $shares;
$info['file-name'] = get_file_name($_GET['fid']);
$info['fid'] = $_GET['fid'];
// print_r($info);
$result = reconstruct($info);
set_decryption_status($_GET['fid'], $result);
// print_r($result);
$data = "<a href='/toyapp/repo/{$result}'>Download file</a><br />";
$ret = array('status' => 'success', 'data' => $data);
} else {
$data = '';
foreach ($colluded_list['list'] as $key => $value) {
$data .= $value['uid'] . ', ';
}
//$data = trim($data);
$data .= ' shared secrets. Needs ' . $colluded_list['more'] . ' more shares.';
$ret = array('status' => 'fail', 'data' => $data);
}
} else {
$file = get_file_path($_GET['fid']);
if (!empty($file)) {
$data = "<a href='/toyapp/repo/{$file}'>Download file</a><br />";
} else {
$data = "Decryption failed";
}
$ret = array('status' => 'success', 'data' => $data);
}
echo json_encode($ret);
示例9: prepare_batch
function prepare_batch($user)
{
$structure_file_path = get_file_path($user, 'structure_file');
$command_file_path = get_file_path($user, 'lammps_script');
$cmdline_file_path = get_file_path($user, 'cmdline_file');
$pot_files_path = get_file_path($user, 'zip');
$info = new StdClass();
$info->structure_file_path = $structure_file_path;
$info->command_file_path = $command_file_path;
$info->cmdline_file_path = $cmdline_file_path;
$info->pot_files_path = $pot_files_path;
$info->area = get_str("area");
// get the directory in which to run the test,
// clear it out,
// and set up links to the input files
//
$test_dir = "../../lammps_test/{$user->id}";
//echo "test_dir is ".$test_dir;
if (!is_dir($test_dir)) {
mkdir($test_dir);
}
$old_dir = getcwd();
if (!chdir($test_dir)) {
error_page("Can't chdir");
}
system("rm *");
symlink($structure_file_path, "structure_file");
symlink($command_file_path, "lammps_script");
symlink($cmdline_file_path, "cmd_variables");
symlink($pot_files_path, "pot_files");
list($error, $est_cpu_time, $disk) = lammps_est();
if ($GLOBALS["debug"]) {
print "est_cpu_time is " . $est_cpu_time . "<br>";
}
if ($error == 0) {
$err_msgs = file("output");
$err = "Your test job <strong>failed</strong>\n <br>Please refer to the following Error Message:<br><p>\n ";
foreach ($err_msgs as $line) {
$err = $err . $line . "<br>";
}
$err = $err . " <p>\n <a href=sandbox.php><strong> File_Sandbox </strong></a>\n ";
error_page($err);
}
system("rm *");
$info->rsc_fpops_est = $est_cpu_time * 1500000000.0;
$info->rsc_fpops_bound = $info->rsc_fpops_est * 20;
if ($disk == 0) {
$info->rsc_disk_bound = 1000000;
} else {
$info->rsc_disk_bound = $disk;
}
$tmpfile = tempnam("/tmp", "lammps_");
file_put_contents($tmpfile, serialize($info));
// get the # of jobs
//
$njobs = count(file($cmdline_file_path));
$secs_est = estimated_makespan($njobs, $info->rsc_fpops_est);
if ($GLOBALS["debug"]) {
echo "secs_est is {$secs_est}\n";
}
//assume the server's flops is 1.5G and the average client's flops is 1G
$hrs_est = number_format($secs_est * 1.5 / 60, 2);
//$hrs_est = number_format($secs_est, 2);
$client_mb = number_format($info->rsc_disk_bound / 1000000.0, 1);
$server_mb = number_format($njobs * $info->rsc_disk_bound / 1000000.0, 1);
chdir($old_dir);
page_head("Batch prepared");
echo "\n Your batch has {$njobs} jobs.\n <p>\n Estimated time to completion: {$hrs_est} Minutes.\n <p>\n Estimated client disk usage: {$client_mb} MB\n <p>\n Estimated server disk usage: {$server_mb} MB\n <p>\n ";
show_button("lammps.php?action=submit&tmpfile={$tmpfile}", "Submit Batch");
page_tail();
}
示例10: json_encode
echo json_encode($DB->getFieldsList($id));
break;
case 'lines':
echo json_encode($DB->getLinesList($id));
default:
}
die;
}
if (isset($_FILES['file'])) {
$uploadedFileArray = $_FILES['file'];
if ($uploadedFileArray['error'] != UPLOAD_ERR_OK) {
echo 'Ошибка загрузки файла';
} else {
if (!isset($tableId) || !isset($fieldId) || !isset($lineId)) {
echo 'Должны быть выбраны Таблица, Поле, Строка';
} else {
$fileName = $uploadedFileArray['name'];
$tmpFilePath = $uploadedFileArray['tmp_name'];
$newFilePath = get_file_path($fieldId, $lineId, $fileName);
$DB->setFileName($tableId, $fieldId, $lineId, $fileName);
create_data_file_dirs($fieldId, $lineId, $fileName);
if (!move_uploaded_file($tmpFilePath, $newFilePath)) {
echo 'Ошибка загрузки файла';
} else {
echo 'Файл загружен ';
}
}
}
} else {
showMainPage();
}
示例11: foreach
foreach ($fragments as $key => $value) {
if ($key == $filename) {
continue;
}
// echo FRAGMENT_PLACE_HOLDER.$key.LINE_BREAK.'<br/>'.
// "<pre>".
// FRAGMENT_BEGIN.$key.LINE_BREAK.
// $value.LINE_BREAK.
// FRAGMENT_END.$key.LINE_BREAK.'</pre>';
$key = basename($key, '.js');
$newFile = str_replace(FRAGMENT_PLACE_HOLDER . $key . LINE_BREAK, FRAGMENT_BEGIN . $key . LINE_BREAK . $value . FRAGMENT_END . $key . LINE_BREAK, $newFile);
}
echo "after join file length: " . strlen($newFile) . "<br/>";
$oldFile = file_get_contents(get_file_path());
file_put_contents(get_file_path() . '.bak', $oldFile);
file_put_contents(get_file_path(), $newFile);
run_action('view');
}, 'default' => function () {
run_action('view');
});
function run_action($action)
{
global $actions;
if ($actions[$action]) {
return $actions[$action]();
} else {
return $actions['default']();
}
}
?>
<!DOCTYPE html>
示例12: verify_asset_json
function verify_asset_json($json)
{
$path = get_file_path($json);
$url = get_url($json);
$aid = get_asset_id($json);
$file = file_get_contents($url . '/' . $path);
$regex = "/^{$aid}\n|\n{$aid}\n|\n{$aid}\$/";
preg_match($regex, $file, $matches);
// return (trim($matches[0]) == $aid)?TRUE:var_dump($matches); #for debu
return trim($matches[0]) == $aid ? TRUE : false;
}
示例13: cmo_import_tc_settings_ajax
function cmo_import_tc_settings_ajax()
{
cmo_import_tc_settings(get_file_path('tc-settings.json'));
ajax_finish(true, "done");
}
示例14: plugin_video_body
function plugin_video_body($args = array(), $body = "")
{
static $num = 0;
static $called_sources = array();
$num++;
$id = "qhm_plugin_video_{$num}";
$qt = get_qt();
$qt->setv("jquery_include", TRUE);
if (exist_plugin("icon")) {
plugin_icon_set_font_awesome();
}
$embed_url = $popup = FALSE;
$sources = array();
$poster = FALSE;
$aspect_ratio = "16by9";
$width = PLUGIN_VIDEO_EMBED_WIDTH;
$height = PLUGIN_VIDEO_EMBED_HEIGHT;
$aspect_ratio_float = 0.5625;
$theme = FALSE;
$youtube_thumbnail_type = FALSE;
$rel = true;
// 関連動画の表示(youtube)
foreach ($args as $arg) {
$arg = trim($arg);
switch ($arg) {
case "16:9":
case "4:3":
list($aspect_width, $aspect_height) = explode(':', $arg);
$aspect_ratio_float = (double) $aspect_height / (double) $aspect_width;
$aspect_ratio = str_replace(":", "by", $arg);
break;
case "popup":
$popup = TRUE;
break;
case preg_match('*^https?://(www\\.youtube\\.com|youtu\\.be|vimeo.com)/*', $arg) ? TRUE : FALSE:
$embed_url = $arg;
break;
case preg_match('/\\Aytpreview=(.+)\\z/', $arg, $mts) ? TRUE : FALSE:
// YouTube thumbnail type
$_types = array('thumb-default', 'thumb-1', 'thumb-2', 'thumb-3', 'default', 'medium', 'high');
if (in_array($mts[1], $_types)) {
$youtube_thumbnail_type = $mts[1];
}
break;
case preg_match('/^(.+\\.(png|jpeg|jpg|gif))\\z/i', $arg, $mts) ? TRUE : FALSE:
$poster = get_file_path($mts[1]);
break;
case preg_match('/^(.+\\.mp4)\\z/i', $arg, $mts) ? TRUE : FALSE:
$sources[PLUGIN_VIDEO_MIMETYPE_MP4] = get_file_path($mts[1]);
break;
case "ted":
case "wmp":
$theme = $arg;
break;
case "norel":
$rel = false;
break;
}
}
$mediaelement_path = 'js/mediaelementplayer/';
$include_mediaelement = '
<link rel="stylesheet" href="' . $mediaelement_path . 'mediaelementplayer.min.css">
<script src="' . $mediaelement_path . 'mediaelement-and-player.min.js"></script>
';
$qt->appendv_once("include_mediaelement", "beforescript", $include_mediaelement);
$addstyle = '
<link rel="stylesheet" href="' . $mediaelement_path . 'mejs-skins.css">
<link rel="stylesheet" href="' . PLUGIN_DIR . 'video/video.min.css">
';
$qt->appendv_once("plugin_video_style", "beforescript", $addstyle);
$qt->appendv_once("plugin_video_script", "beforescript", '<script src="' . PLUGIN_DIR . 'video/video.min.js"></script>');
$popup_html = $popup_style = '';
if ($popup) {
if ($body == '') {
if ($poster !== FALSE) {
$body = '<img src="' . h($poster) . '">';
} else {
$body = '<i class="fa fa-play-circle-o"></i>';
}
}
$popup_html = <<<EOD
<a class="qhm-plugin-video-trigger" data-toggle="modal" data-target="#{$id}_modal">{$body}</a>
EOD;
}
if ($embed_url !== FALSE) {
return $popup_html . plugin_video_embed($embed_url, $id, $aspect_ratio, $body, $popup, $poster, $youtube_thumbnail_type, $rel);
}
if (!isset($sources[PLUGIN_VIDEO_MIMETYPE_MP4])) {
return '<p>Usage: #video(video.mp4)</p>' . "\n";
} else {
if (is_url($sources[PLUGIN_VIDEO_MIMETYPE_MP4])) {
$sources[PLUGIN_VIDEO_MIMETYPE_WEBM] = substr($sources[PLUGIN_VIDEO_MIMETYPE_MP4], 0, -3) . "webm";
} else {
if (file_exists($sources[PLUGIN_VIDEO_MIMETYPE_MP4])) {
$webm_path = substr($sources[PLUGIN_VIDEO_MIMETYPE_MP4], 0, -3) . "webm";
if (file_exists($webm_path)) {
$sources[PLUGIN_VIDEO_MIMETYPE_WEBM] = $webm_path;
}
}
}
//.........这里部分代码省略.........
示例15: plugin_section_convert
//.........这里部分代码省略.........
$attrs['class'] .= ' qhm-section-' . $style;
if ($relative) {
$styles['position'] = 'relative';
}
if ($is_eyecatch) {
if (isset($_SESSION['temp_design'])) {
$conf = get_skin_custom_vars($_SESSION['temp_design']);
} else {
global $style_name;
$conf = get_skin_custom_vars($style_name);
}
if (isset($conf['default_eyecatch']) && $conf['default_eyecatch']) {
if ($background_color === FALSE && $background_image === FALSE && isset($conf['eyecatch_bgimage'])) {
$background_image = $conf['eyecatch_bgimage'];
}
if ($background_image === FALSE && isset($conf['enable_eyecatch_bgimage']) && !$conf['enable_eyecatch_bgimage']) {
$background_image = '';
}
if ($color === FALSE && isset($conf['eyecatch_color'])) {
$color = $conf['eyecatch_color'];
}
}
}
if ($color) {
$styles['color'] = $color;
}
if ($background_color) {
$styles['background-color'] = $background_color;
}
if ($background_image) {
if (is_url($background_image, TRUE, TRUE)) {
$background_filename = $background_image;
} else {
$background_filename = dirname($script . 'dummy') . '/' . get_file_path($background_image);
}
//first image をセット
$qt->set_first_image($background_filename);
// フィルター
if ($filter === 'blur') {
$attrs['data-filter'] = $filter;
$svg_html = '
<svg version="1.1" xmlns="http://www.w3.org/2000/svg">
<filter id="blur">
<feGaussianBlur stdDeviation="6" />
</filter>
</svg>
';
$qt->appendv_once('plugin_section_blur_svg', 'lastscript', $svg_html);
$addjs = '
<script>
$(function(){
var ua = {};
ua.name = window.navigator.userAgent.toLowerCase();
if (ua.name.indexOf("msie") >= 0 || ua.name.indexOf("trident") >= 0) {
$(".qhm-section[data-filter=blur] > div").css({background: "none", position: "static"});
}
});
</script>
';
$qt->appendv_once('plugin_section_kill_blur_on_ie', 'beforescript', $addjs);
}
if ($background_video === FALSE) {
$styles['background-image'] = 'url(' . h($background_filename) . ')';
}
if ($background_fix) {
// iOS, Android では無効にする