本文整理汇总了PHP中get_relative_path函数的典型用法代码示例。如果您正苦于以下问题:PHP get_relative_path函数的具体用法?PHP get_relative_path怎么用?PHP get_relative_path使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_relative_path函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: upload
function upload()
{
import("ORG.Net.Image3");
if (!empty($_FILES)) {
//获取文件名
$tempFile = $_FILES['Filedata']['tmp_name'];
//保存路径
$targetPath = APP_PATH . 'Public/Uploads/';
//新图片名
$new_file_name = new_name($_FILES['Filedata']['name']);
//图片网站路径
$targetFile = $targetPath . $new_file_name;
//判断是否文件夹存在
if (!is_dir($targetPath)) {
mkdir($targetPath, 0777, true);
}
//防止中文文件名乱码
move_uploaded_file($tempFile, iconv('utf-8', 'gbk', $targetFile));
//水印
$water = '';
$img = new Image3();
$img->param($targetFile)->water($targetFile, $water, 9);
//ajax返回图片名称
echo get_relative_path($new_file_name);
}
}
示例2: get_path
/**
* Get relative path to a directory/file
* @param string $path Path to a directory/file
* @param boolean $use_doc_root Use document root or relative path?
* @return string
*/
function get_path($path, $use_doc_root = false)
{
$doc_root = DOCUMENT_ROOT;
if (!$use_doc_root) {
$doc_root = get_relative_path();
}
return join_path(preg_replace('/(\\/)+$/', '', $doc_root), preg_replace('/^(\\/+)/', '', $path));
}
示例3: get_Olympus_Makernote_Html
function get_Olympus_Makernote_Html($Makernote_tag, $filename)
{
// Check that this tag uses the Olympus tags, otherwise it can't be interpreted here
if ($Makernote_tag['Makernote Tags'] != "Olympus") {
// Not Olympus tags - can't interpret with this function
return FALSE;
}
// Check if the Decoded data is valid
if ($Makernote_tag['Decoded Data'][0] === FALSE) {
// Decoded data is not valid - can't interpret with this function
return FALSE;
}
// Minolta Thumbnail 1
if (array_key_exists(0x88, $Makernote_tag['Decoded Data'][0]) && $Makernote_tag['Makernote Tags'] == "Olympus") {
// Change: as of version 1.11 - Changed to make thumbnail link portable across directories
// Build the path of the thumbnail script and its filename parameter to put in a url
$link_str = get_relative_path(dirname(__FILE__) . "/../get_minolta_thumb.php", getcwd());
$link_str .= "?filename=";
$link_str .= get_relative_path($filename, dirname(__FILE__) . "/..");
// Add thumbnail link to html
$Makernote_tag['Decoded Data'][0][0x88]['Text Value'] = "<a class=\"EXIF_Minolta_Thumb_Link\" href=\"{$link_str}\" ><img class=\"EXIF_Minolta_Thumb\" src=\"{$link_str}\"></a>";
$Makernote_tag['Decoded Data'][0][0x88]['Type'] = "String";
}
// Minolta Thumbnail 2
if (array_key_exists(0x81, $Makernote_tag['Decoded Data'][0]) && $Makernote_tag['Makernote Tags'] == "Olympus") {
// Change: as of version 1.11 - Changed to make thumbnail link portable across directories
// Build the path of the thumbnail script and its filename parameter to put in a url
$link_str = get_relative_path(dirname(__FILE__) . " /../get_minolta_thumb.php", getcwd());
$link_str .= "?filename=";
$link_str .= get_relative_path($filename, dirname(__FILE__) . "/..");
// Add thumbnail link to html
$Makernote_tag['Decoded Data'][0][0x81]['Text Value'] = "<a class=\"EXIF_Minolta_Thumb_Link\" href=\"{$link_str}\" ><img class=\"EXIF_Minolta_Thumb\" src=\"{$link_str}\"></a>";
$Makernote_tag['Decoded Data'][0][0x81]['Type'] = "String";
}
// Interpret the IFD and return the HTML
return interpret_IFD($Makernote_tag['Decoded Data'][0], $filename);
}
示例4: Copyright
?>
, Copyright (C) 2004 Evan Hunter</a></p> <!-- Change: displayed toolkit version numbers to reference Toolkit_Version.php - as of version 1.11 -->
<br>
<br>
<h1><B><U>Metadata for "<?php
echo $filename;
?>
"</U></B></h1>
<br>
<!-- Output a link allowing user to edit the Photoshop File Info
Change: Allow this example file to be easily relocatable - as of version 1.11
-->
<?php
$relative_filename = get_relative_path($filename, $Toolkit_Dir);
?>
<h4><a href="<?php
echo $Toolkit_Dir . "Edit_File_Info_Example.php?jpeg_fname={$relative_filename}";
?>
" >Click here to edit the Photoshop File Info for this file</a></h4>
<br>
Output the information about the APP segments -->
<?php
echo Generate_JPEG_APP_Segment_HTML($jpeg_header_data);
?>
<BR>
示例5: interpret_IFD
function interpret_IFD($IFD_array, $filename)
{
// Create the output string with the table tag
$output_str = "<table class=\"EXIF_Table\" border=1>\n";
// Create an extra output string to receive any supplementary html
// which cannot go inside the table
$extra_IFD_str = "";
// Check that the IFD array is valid
if ($IFD_array === FALSE || $IFD_array === NULL) {
// the IFD array is NOT valid - exit
return "";
}
// Check if this is an EXIF IFD and if there is a makernote present
if ($IFD_array['Tags Name'] === "EXIF" && !array_key_exists(37500, $IFD_array)) {
// This is an EXIF IFD but NO makernote is present - Add a message to the output
$extra_IFD_str .= "<h3 class=\"EXIF_Secondary_Heading\">No Makernote Present</h3>";
}
// Cycle through each tag in the IFD
foreach ($IFD_array as $Tag_ID => $Exif_Tag) {
// Ignore the non numeric elements - they aren't tags
if (!is_numeric($Tag_ID)) {
// Skip Tags Name
} else {
if ($Exif_Tag['Decoded'] == TRUE) {
// This tag has been successfully decoded
// Table cells won't get drawn with nothing in them -
// Ensure that at least a non breaking space exists in them
if (trim($Exif_Tag['Text Value']) == "") {
$Exif_Tag['Text Value'] = " ";
}
// Check if the tag is a sub-IFD
if ($Exif_Tag['Type'] == "SubIFD") {
// This is a sub-IFD tag
// Add a sub-heading for the sub-IFD
$extra_IFD_str .= "<h3 class=\"EXIF_Secondary_Heading\">" . $Exif_Tag['Tag Name'] . " contents</h3>";
// Cycle through each sub-IFD in the chain
foreach ($Exif_Tag['Data'] as $subIFD) {
// Interpret this sub-IFD and add the html to the secondary output
$extra_IFD_str .= interpret_IFD($subIFD, $filename);
}
} else {
if ($Exif_Tag['Type'] == "Maker Note") {
// This is a Makernote Tag
// Add a sub-heading for the Makernote
$extra_IFD_str .= "<h3 class=\"EXIF_Secondary_Heading\">Maker Note Contents</h3>";
// Interpret the Makernote and add the html to the secondary output
$extra_IFD_str .= Interpret_Makernote_to_HTML($Exif_Tag, $filename);
} else {
if ($Exif_Tag['Type'] == "IPTC") {
// This is a IPTC/NAA Record, interpret it and output to the secondary html
$extra_IFD_str .= "<h3 class=\"EXIF_Secondary_Heading\">Contains IPTC/NAA Embedded in EXIF</h3>";
$extra_IFD_str .= Interpret_IPTC_to_HTML($Exif_Tag['Data']);
} else {
if ($Exif_Tag['Type'] == "XMP") {
// This is a XMP Record, interpret it and output to the secondary html
$extra_IFD_str .= "<h3 class=\"EXIF_Secondary_Heading\">Contains XMP Embedded in EXIF</h3>";
$extra_IFD_str .= Interpret_XMP_to_HTML($Exif_Tag['Data']);
} else {
if ($Exif_Tag['Type'] == "IRB") {
// This is a Photoshop IRB Record, interpret it and output to the secondary html
$extra_IFD_str .= "<h3 class=\"EXIF_Secondary_Heading\">Contains Photoshop IRB Embedded in EXIF</h3>";
$extra_IFD_str .= Interpret_IRB_to_HTML($Exif_Tag['Data'], $filename);
} else {
if ($Exif_Tag['Type'] == "Numeric") {
// Numeric Tag - Output text value as is.
$output_str .= "<tr class=\"EXIF_Table_Row\"><td class=\"EXIF_Caption_Cell\">" . $Exif_Tag['Tag Name'] . "</td><td class=\"EXIF_Value_Cell\">" . $Exif_Tag['Text Value'] . "</td></tr>\n";
} else {
// Other tag - Output text as preformatted
$output_str .= "<tr class=\"EXIF_Table_Row\"><td class=\"EXIF_Caption_Cell\">" . $Exif_Tag['Tag Name'] . "</td><td class=\"EXIF_Value_Cell\"><pre>" . trim($Exif_Tag['Text Value']) . "</pre></td></tr>\n";
}
}
}
}
}
}
} else {
// Tag has NOT been decoded successfully
// Hence it is either an unknown tag, or one which
// requires processing at the time of html construction
// Table cells won't get drawn with nothing in them -
// Ensure that at least a non breaking space exists in them
if (trim($Exif_Tag['Text Value']) == "") {
$Exif_Tag['Text Value'] = " ";
}
// Check if this tag is the first IFD Thumbnail
if ($IFD_array['Tags Name'] == "TIFF" && $Tag_ID == 513) {
// This is the first IFD thumbnail - Add html to the output
// Change: as of version 1.11 - Changed to make thumbnail link portable across directories
// Build the path of the thumbnail script and its filename parameter to put in a url
$link_str = get_relative_path(dirname(__FILE__) . "/get_exif_thumb.php", getcwd());
$link_str .= "?filename=";
$link_str .= get_relative_path($filename, dirname(__FILE__));
// Add thumbnail link to html
$output_str .= "<tr class=\"EXIF_Table_Row\"><td class=\"EXIF_Caption_Cell\">" . $Exif_Tag['Tag Name'] . "</td><td class=\"EXIF_Value_Cell\"><a class=\"EXIF_First_IFD_Thumb_Link\" href=\"{$link_str}\"><img class=\"EXIF_First_IFD_Thumb\" src=\"{$link_str}\"></a></td></tr>\n";
} else {
if ($Exif_Tag['Type'] == "Maker Note") {
// This is the makernote, but has not been decoded
// Add a message to the secondary output
$extra_IFD_str .= "<h3 class=\"EXIF_Secondary_Heading\">Makernote Coding Unknown</h3>\n";
} else {
//.........这里部分代码省略.........
示例6: get_Casio_Makernote_Html
function get_Casio_Makernote_Html($Makernote_tag, $filename)
{
// Check that this tag uses the Casio tags, otherwise it can't be interpreted here
if ($Makernote_tag['Makernote Type'] != "Casio Type 1" && $Makernote_tag['Makernote Type'] != "Casio Type 2") {
// Not Casio tags - can't interpret with this function
return FALSE;
}
// Casio Thumbnail (Tag 4)
if (array_key_exists(4, $Makernote_tag['Decoded Data'][0]) && $Makernote_tag['Makernote Tags'] == "Casio Type 2") {
// Change: as of version 1.11 - Changed to make thumbnail link portable across directories
// Build the path of the thumbnail script and its filename parameter to put in a url
$link_str = get_relative_path(dirname(__FILE__) . "/get_casio_thumb.php", getcwd());
$link_str .= "?filename=";
$link_str .= get_relative_path($filename, dirname(__FILE__));
// Add thumbnail link to html
$Makernote_tag['Decoded Data'][0][4]['Text Value'] = "<a class=\"EXIF_Casio_Thumb_Link\" href=\"{$link_str}\"><img class=\"EXIF_Casio_Thumb\" src=\"{$link_str}\"></a></td></tr>\n";
$Makernote_tag['Decoded Data'][0][4]['Type'] = "String";
}
// Casio Thumbnail (Tag 8192)
if (array_key_exists(8192, $Makernote_tag['Decoded Data'][0]) && $Makernote_tag['Makernote Tags'] == "Casio Type 2") {
// Change: as of version 1.11 - Changed to make thumbnail link portable across directories
// Build the path of the thumbnail script and its filename parameter to put in a url
$link_str = get_relative_path(dirname(__FILE__) . "/.." . "/get_casio_thumb.php", getcwd());
$link_str .= "?filename=";
$link_str .= get_relative_path($filename, dirname(__FILE__) . "/..");
// Add thumbnail link to html
$Makernote_tag['Decoded Data'][0][8192]['Text Value'] = "<a class=\"EXIF_Casio_Thumb_Link\" href=\"{$link_str}\"><img class=\"EXIF_Casio_Thumb\" src=\"{$link_str}\"></a></td></tr>\n";
$Makernote_tag['Decoded Data'][0][8192]['Type'] = "String";
}
// Check if there are two thumbnail offset tags
if (array_key_exists(4, $Makernote_tag['Decoded Data'][0]) && array_key_exists(8192, $Makernote_tag['Decoded Data'][0])) {
// There are two copies of the thumbnail offset - Remove one
array_splice($Makernote_tag['Decoded Data'][0], 4, 1);
}
// Interpret the IFD and return the html
return interpret_IFD($Makernote_tag['Decoded Data'][0], $filename);
}
示例7: array
$header_class = 'noPrint';
}
}
$lmt_main_navbar = array('Math Club Home' => 'Home', backstage_is_open() ? 'ARL' : 'A' => ['Backstage' => 'LMT/Backstage/Home'], '');
$result = DB::query('SELECT page_id, name FROM pages ORDER BY order_num');
foreach ($result as $row) {
if ($row['page_id'] == '-1') {
if (registration_is_open()) {
$lmt_main_navbar['Registration'] = 'LMT/Registration/Home';
$lmt_main_navbar[] = '';
}
} else {
if ($row['name'] == '') {
$lmt_main_navbar[] = '';
} else {
$lmt_main_navbar[$row['name']] = 'LMT/' . str_replace(' ', '_', $row['name']);
}
}
}
$lmt_backstage_navbar = array('ARL' => ['LMT Home' => 'LMT', 'Backstage Home' => 'LMT/Backstage/Home', 'A' => ['', 'Status' => 'LMT/Backstage/Status', 'Website' => 'LMT/Backstage/Pages/List', 'Email' => 'LMT/Backstage/Email/Home', 'Export' => 'LMT/Backstage/Export'], '', 'Check-in' => 'LMT/Backstage/Checkin/Home', 'Score Entry' => 'LMT/Backstage/Scoring/Home', 'Guts Round' => 'LMT/Backstage/Guts/Home', 'Results' => 'LMT/Backstage/Results/Full', '', 'Data' => 'LMT/Backstage/Data/Home', 'Verification' => 'LMT/Backstage/Database/Verify', 'Backup' => 'LMT/Backstage/Database/Backup']);
if (strpos(get_relative_path(), 'Backstage') === 4) {
//position 4, because it's after 'LMT/'
if (backstage_is_open()) {
restrict_access('ARL');
} else {
restrict_access('A');
}
set_navbar($lmt_backstage_navbar);
} else {
set_navbar($lmt_main_navbar);
}
示例8: pfupdate
$webdlmon_pf = 'webdlmon.pf';
pfupdate($webdlmon_pf);
$pf_change_time = "1182297600";
if (pfrequire($webdlmon_pf, $pf_change_time) < 0) {
die("<b><u>Webdlmon Error:</u></b>\n\t\tThe parameter file {$webdlmon_pf}.pf is out of date. \n\t\tPlease upgrade to the latest version. Goodbye.");
}
$sources = pfget($webdlmon_pf, 'sources');
$dlmon_pf = $sources['dlmon_pf'];
$optional = pfget($webdlmon_pf, 'optional');
$table_caption = trim($optional['table_caption'], "'\"");
$dataloggers = pfget($webdlmon_pf, 'dataloggers');
$dlmodel = trim($dataloggers['model'], "'\"");
$customization = pfget($webdlmon_pf, 'customization');
if ($customization['customize'] == 'true') {
$cookie_name = $customization['cookie_name'];
$cookie_domain = get_relative_path(dirname(__FILE__));
if (!empty($_POST['submit']) && !empty($_POST['cookie'])) {
ksort($_POST['cookie']);
$cookie_val = implode('|', $_POST['cookie']);
$cookie_expire = time() + 60 * 60 * 24 * 365;
// One year from now
setcookie($cookie_name, $cookie_val, $cookie_expire, $cookie_domain);
} else {
// Make sure we delete the old cookie, browser specific
// See http://www.php.net/setcookie
if (eregi('MSIE', $_SERVER['HTTP_USER_AGENT'])) {
// MS IE issue
setcookie($cookie_name, "", time() + 3600, $cookie_domain);
} elseif (eregi('Firefox', $_SERVER['HTTP_USER_AGENT'])) {
setcookie($cookie_name, $COOKIE[$cookie_name], time() - 3600, $cookie_domain);
} else {
示例9: navbar_html
function navbar_html($navbar = NULL)
{
if (is_null($navbar)) {
global $navbar_array;
$navbar = $navbar_array;
}
$html = '';
foreach ($navbar as $key => $nav_elem) {
if (is_array($nav_elem)) {
if (user_access($key)) {
//If it's a section and it's allowed, then recursively continue flattening the array.
$html .= navbar_html($nav_elem);
}
} elseif ($nav_elem === '') {
$html .= "</div><div class='linkgroup'>";
} elseif (is_string($key)) {
//In this case $key is the name, $nav_elem is the path.
if ($nav_elem === get_relative_path()) {
//In this case it's the current page, so indicate so.
$html .= "<span class='selected'>{$key}</span><br />";
} else {
$html .= "<a href='" . URL::root() . "/{$nav_elem}'>{$key}</a><br />";
}
} else {
//In this case $nav_elem is both the name and the path.
if ($nav_elem === get_relative_path()) {
//In this case it's the current page, so indicate so.
$html .= "<span class='selected'>{$nav_elem}</span><br />";
} else {
$html .= "<a href='" . URL::root() . "/{$nav_elem}'>{$nav_elem}</a><br />";
}
}
}
return $html;
}
示例10: setAlternativeAndClose
obj.style.display='none';
btn.style.display = '';
}
}
<?php
}
?>
<?php
// When uploading a file as an alternative content, set the alternative field in the opener window
// and close "file manager" once the upload is successful
if ($a_type > 0 && isset($_GET['uploadfile']) && $_GET['uploadfile'] != '') {
?>
function setAlternativeAndClose() {
setAlternative('<?php
echo get_relative_path($_GET['cp'], $pathext) . $_GET['uploadfile'];
?>
', '<?php
echo TR_BASE_HREF . $get_file . $pathext . urlencode($_GET['uploadfile']);
?>
', '<?php
echo $_content_id;
?>
', '<?php
echo $pid;
?>
', '<?php
echo $a_type;
?>
');
window.close();
示例11: find_best_location_in_include_path
function find_best_location_in_include_path($path)
{
$newpath = $path;
$reltoinclude;
if (substr($newpath, 0, 1) == "/" || substr($newpath, 0, 1) == "\\") {
if (is_file($newpath) || is_dir($newpath)) {
return $newpath;
} else {
return false;
}
}
if (!is_file($newpath) && !is_dir($newpath)) {
$found = find_file_to_include($newpath, $newpath, $reltoinclude);
$newpath = get_relative_path(str_replace("/", "\\", realpath($newpath)), dirname(realpath($_SERVER["SCRIPT_FILENAME"])));
if (!$found) {
return false;
}
}
return $newpath;
}
示例12: find_best_location_in_include_path
function find_best_location_in_include_path($path)
{
$newpath = $path;
$reltoinclude;
//if ( !is_file ( $newpath ) && !is_dir ( $newpath ) )
//{
$found = find_file_to_include($newpath, $newpath, $reltoinclude);
$newpath = get_relative_path(str_replace("/", "\\", realpath($newpath)), dirname(realpath($_SERVER["SCRIPT_FILENAME"])));
if (!$found) {
return false;
}
//}
return $newpath;
}
示例13: setCheckboxCookie
}
// set a cookie
function setCheckboxCookie(obj, value1, value2, date)
{
var today = new Date();
var the_date = new Date(date);
var the_cookie_date = the_date.toGMTString();
if (obj.checked==true)
var the_cookie = value1 + ";expires=" + the_cookie_date;
else
var the_cookie = value2 + ";expires=" + the_cookie_date;
document.cookie = the_cookie;
}
<?php endif; ?>
<?php
// When uploading a file as an alternative content, set the alternative field in the opener window
// and close "file manager" once the upload is successful
if ($a_type > 0 && isset($_GET['uploadfile']) && $_GET['uploadfile'] <> '') { ?>
function setAlternativeAndClose() {
setAlternative('<?php echo get_relative_path($_GET['cp'], $pathext).$_GET['uploadfile']; ?>', '<?php echo AT_BASE_HREF.$get_file.$pathext.urlencode($_GET['uploadfile']); ?>', '<?php echo $cid; ?>', '<?php echo $pid; ?>', '<?php echo $a_type; ?>');
window.close();
}
window.onload=setAlternativeAndClose;
<?php } ?>
//-->
</script>
示例14: get_reportico_url_path
function get_reportico_url_path()
{
$newpath = "reportico.php";
$found = find_file_to_include($newpath, $newpath, $reltoinclude);
$newpath = get_relative_path(str_replace("/", "\\", realpath($newpath)), dirname(realpath($_SERVER["SCRIPT_FILENAME"])));
$above = dirname($_SERVER["SCRIPT_NAME"]);
if ($above == "/") {
$above = "";
}
$url_path = $above . "/" . session_request_item('reporticourl', dirname($newpath));
// If reportico source files are installed in root directory or in some other
// scenarios such as an invalid linkbaseurl parameter the dirname of the
// the reportico files returns just a slash (backslash on windows) so
// return a true path
if ($url_path == "/" || $url_path == "\\") {
$url_path = "/";
} else {
$url_path = $url_path . "/";
}
return $url_path;
}
示例15: clean_old_tmp_files
$b4plot->SetFillColor("#FBE32A");
$b4plot->SetLegend('Lectures');
$b5plot->SetColor("#000");
$b5plot->SetFillColor("#000");
$b5plot->SetLegend('Abandon');
$graph->legend->SetColumns(5);
$graph->legend->SetFrameWeight(2);
$graph->legend->SetShadow();
$graph->legend->Pos(0.5, 0.99, 'center', 'bottom');
$graph->legend->SetLayout(LEGEND_HOR);
$graph->Stroke($tmpfname);
clean_old_tmp_files();
?>
<article class="stats_graph">
<img src="<?php
echo get_relative_path($tmpfname);
?>
">
</article>
<?php
break;
default:
case 'ch':
echo '<table class="tablesorter" cellspacing="0">
<thead>
<tr>
<th>Date</th>
<th>Sujet</th>
<th>Envois</th>
<th>Lectures</th>
<th>Ouvertures</th>