当前位置: 首页>>代码示例>>PHP>>正文


PHP get_file_url函数代码示例

本文整理汇总了PHP中get_file_url函数的典型用法代码示例。如果您正苦于以下问题:PHP get_file_url函数的具体用法?PHP get_file_url怎么用?PHP get_file_url使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了get_file_url函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: rss_get_url

/**
 * This function returns the URL for the RSS XML file.
 *
 * @param int    $contextid      the course id
 * @param int    $userid         the current user id
 * @param string $componentname  the name of the current component. For example "forum"
 * @param string $additionalargs For modules, module instance id
 * @return string the url of the RSS feed
 */
function rss_get_url($contextid, $userid, $componentname, $additionalargs)
{
    global $CFG;
    require_once $CFG->libdir . '/filelib.php';
    $usertoken = rss_get_token($userid);
    return get_file_url($contextid . '/' . $usertoken . '/' . $componentname . '/' . $additionalargs . '/rss.xml', null, 'rssfile');
}
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:16,代码来源:rsslib.php

示例2: picture_header

function picture_header()
{
    if (project() && project()->type() == 'picture') {
        echo theme()->js(array('src' => get_file_url('ex/plugin/picture/jquery.colorbox-min.js'))), "\n";
        echo theme()->css(array('href' => get_file_url('ex/plugin/picture/colorbox.css'))), "\n";
    }
}
开发者ID:Wanyor,项目名称:ProjectManager,代码行数:7,代码来源:run.php

示例3: page_edit_header_out

/**
 * 增加后台编辑器所需的引用文件
 */
function page_edit_header_out()
{
    theme()->header_add(theme()->css(array('href' => get_file_url("ex/kindeditor/themes/default/default.css"))));
    theme()->header_add(theme()->js(array('src' => get_file_url("ex/kindeditor/kindeditor-min.js"))));
    theme()->header_add(theme()->js(array('src' => get_file_url("ex/kindeditor/lang/zh_CN.js"))));
    theme()->header_add(theme()->js(array('src' => get_file_url("js/jquery.form.js"))));
}
开发者ID:Wanyor,项目名称:ProjectManager,代码行数:10,代码来源:admin.php

示例4: blog_rss_print_link

function blog_rss_print_link($filtertype, $filterselect, $tagid = 0, $tooltiptext = '')
{
    global $CFG, $USER;
    if (empty($USER->id)) {
        $userid = 1;
    } else {
        $userid = $USER->id;
    }
    switch ($filtertype) {
        case 'site':
            $path = SITEID . '/' . $userid . '/blog/site/' . SITEID;
            break;
        case 'course':
            $path = $filterselect . '/' . $userid . '/blog/course/' . $filterselect;
            break;
        case 'group':
            $path = SITEID . '/' . $userid . '/blog/group/' . $filterselect;
            break;
        case 'user':
            $path = SITEID . '/' . $userid . '/blog/user/' . $filterselect;
            break;
    }
    if ($tagid) {
        $path .= '/' . $tagid;
    }
    $path .= '/rss.xml';
    $rsspix = $CFG->pixpath . '/i/rss.gif';
    require_once $CFG->libdir . '/filelib.php';
    $path = get_file_url($path, null, 'rssfile');
    print '<div class="mdl-right"><a href="' . $path . '"><img src="' . $rsspix . '" title="' . strip_tags($tooltiptext) . '" alt="' . get_string('rss') . '" /></a></div>';
}
开发者ID:kai707,项目名称:ITSA-backup,代码行数:31,代码来源:rsslib.php

示例5: sitemap_create

/**
 * 生成网站地图信息
 */
function sitemap_create($out_message = false)
{
    require_once __DIR__ . "/sitemap.php";
    $sitemap = new \Plugin\SiteMap($out_message);
    $sitemap->msg("准备生成网站地图,最大10M,最多5000条<br />当前内存消耗:<span class='text-danger'>" . sitemap_size(memory_get_usage()) . "</span>");
    $sitemap->create();
    $file = _BasePath_ . "/sitemap.xml";
    $sitemap->write_file($file);
    $sitemap->msg("生成文件大小: <span class='text-danger'>" . sitemap_size(filesize($file))) . "</span>";
    $sitemap->msg("生成记录: <span class='text-danger'>" . $sitemap->count() . "</span> 条");
    $sitemap->msg("地图地址: <a rel='external' class='text-warning' href='" . get_file_url('sitemap.xml') . "'>" . get_file_url('sitemap.xml') . "</a>");
    $sitemap->msg("生成地图成功<br />当前内存消耗:<span class='text-danger'>" . sitemap_size(memory_get_usage()) . "</span>");
}
开发者ID:Wanyor,项目名称:ProjectManager,代码行数:16,代码来源:run.php

示例6: print_student_answer

 function print_student_answer($userid, $return = false)
 {
     global $CFG, $USER;
     $filearea = $this->file_area_name($userid);
     $output = '';
     if ($basedir = $this->file_area($userid)) {
         if ($files = get_directory_list($basedir)) {
             require_once $CFG->libdir . '/filelib.php';
             foreach ($files as $key => $file) {
                 $icon = mimeinfo('icon', $file);
                 $ffurl = get_file_url("{$filearea}/{$file}");
                 //died right here
                 //require_once($ffurl);
                 $output = '<img align="middle" src="' . $CFG->pixpath . '/f/' . $icon . '" class="icon" alt="' . $icon . '" />' . '<a href="' . $ffurl . '" >' . $file . '</a><br />';
             }
         }
     }
     $output = '<div class="files">' . $output . '</div>';
     return $output;
 }
开发者ID:veritech,项目名称:pare-project,代码行数:20,代码来源:assignment.class.php

示例7: process_cdata

 /**
  * Provide NULL and legacy file.php uses decoding
  */
 public function process_cdata($cdata)
 {
     global $CFG;
     if ($cdata === '$@NULL@$') {
         // Some cases we know we can skip complete processing
         return null;
     } else {
         if ($cdata === '') {
             return '';
         } else {
             if (is_numeric($cdata)) {
                 return $cdata;
             } else {
                 if (strlen($cdata) < 32) {
                     // Impossible to have one link in 32cc
                     return $cdata;
                     // (http://10.0.0.1/file.php/1/1.jpg, http://10.0.0.1/mod/url/view.php?id=)
                 } else {
                     if (strpos($cdata, '$@FILEPHP@$') === false) {
                         // No $@FILEPHP@$, nothing to convert
                         return $cdata;
                     }
                 }
             }
         }
     }
     // Decode file.php calls
     $search = array("\$@FILEPHP@\$");
     $replace = array(get_file_url($this->courseid));
     $result = str_replace($search, $replace, $cdata);
     // Now $@SLASH@$ and $@FORCEDOWNLOAD@$ MDL-18799
     $search = array('$@SLASH@$', '$@FORCEDOWNLOAD@$');
     if ($CFG->slasharguments) {
         $replace = array('/', '?forcedownload=1');
     } else {
         $replace = array('%2F', '&amp;forcedownload=1');
     }
     return str_replace($search, $replace, $result);
 }
开发者ID:vuchannguyen,项目名称:web,代码行数:42,代码来源:restore_structure_parser_processor.class.php

示例8: get_rss_enclosure

function get_rss_enclosure($file_name, $image_type, $cat_id)
{
    if (!get_file_path($file_name, $image_type, $cat_id, 0, 0)) {
        return array();
    }
    $file = get_file_path($file_name, $image_type, $cat_id, 0, 1);
    $url = get_file_url($file_name, $image_type, $cat_id);
    return array('url' => $url, 'length' => @filesize($file), 'type' => get_mime_content_type($file));
}
开发者ID:4images,项目名称:4images,代码行数:9,代码来源:rss.php

示例9: error

<?php

include '../config.php';
//require_login();
/// Remove the following three lines if you want everyone to access it
//require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
if (!($users = get_records("user", "picture", "1", "lastaccess DESC", "id,firstname,lastname"))) {
    error("no users!");
}
$title = get_string("users");
print_header($title, $title, build_navigation(array(array('name' => $title, 'link' => null, 'type' => 'misc'))));
foreach ($users as $user) {
    $fullname = fullname($user);
    echo "<a href=\"{$CFG->wwwroot}/user/view.php?id={$user->id}&amp;course=1\" " . "title=\"{$fullname}\">";
    require_once $CFG->libdir . '/filelib.php';
    $userpictureurl = get_file_url($user->id . '/f1.jpg', null, 'user');
    echo '<img src="' . $userpictureurl . '"' . ' style="border:0px; width:100px; height:100px" alt="' . $fullname . '" />';
    echo "</a> \n";
}
print_footer();
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:20,代码来源:faculty.php

示例10: blog_print_attachments

function blog_print_attachments($blogentry, $return = NULL)
{
    // if return=html, then return a html string.
    // if return=text, then return a text-only string.
    // otherwise, print HTML for non-images, and return image HTML
    global $CFG;
    $filearea = blog_file_area_name($blogentry);
    $imagereturn = "";
    $output = "";
    if ($basedir = blog_file_area($blogentry)) {
        if ($files = get_directory_list($basedir)) {
            $strattachment = get_string("attachment", "forum");
            foreach ($files as $file) {
                include_once $CFG->libdir . '/filelib.php';
                $icon = mimeinfo("icon", $file);
                $type = mimeinfo("type", $file);
                $ffurl = get_file_url("{$filearea}/{$file}");
                $image = "<img src=\"{$CFG->pixpath}/f/{$icon}\" class=\"icon\" alt=\"\" />";
                if ($return == "html") {
                    $output .= "<a href=\"{$ffurl}\">{$image}</a> ";
                    $output .= "<a href=\"{$ffurl}\">{$file}</a><br />";
                } else {
                    if ($return == "text") {
                        $output .= "{$strattachment} {$file}:\n{$ffurl}\n";
                    } else {
                        if (in_array($type, array('image/gif', 'image/jpeg', 'image/png'))) {
                            // Image attachments don't get printed as links
                            $imagereturn .= "<br /><img src=\"{$ffurl}\" alt=\"\" />";
                        } else {
                            echo "<a href=\"{$ffurl}\">{$image}</a> ";
                            echo filter_text("<a href=\"{$ffurl}\">{$file}</a><br />");
                        }
                    }
                }
            }
        }
    }
    if ($return) {
        return $output;
    }
    return $imagereturn;
}
开发者ID:nadavkav,项目名称:MoodleTAO,代码行数:42,代码来源:lib.php

示例11: display


//.........这里部分代码省略.........
             $querystring = implode('&amp;', $querysbits);
         }
     }
     /// Set up some variables
     $inpopup = optional_param('inpopup', 0, PARAM_BOOL);
     if (resource_is_url($resource->reference)) {
         $fullurl = $resource->reference;
         if (!empty($querystring)) {
             $urlpieces = parse_url($resource->reference);
             if (empty($urlpieces['query']) or $isteamspeak) {
                 $fullurl .= '?' . $querystring;
             } else {
                 $fullurl .= '&amp;' . $querystring;
             }
         }
     } else {
         if ($CFG->resource_allowlocalfiles and strpos($resource->reference, RESOURCE_LOCALPATH) === 0) {
             // Localpath
             $localpath = get_user_preferences('resource_localpath', 'D:');
             $relativeurl = str_replace(RESOURCE_LOCALPATH, $localpath, $resource->reference);
             if ($querystring) {
                 $relativeurl .= '?' . $querystring;
             }
             $relativeurl = str_replace('\\', '/', $relativeurl);
             $relativeurl = str_replace(' ', '%20', $relativeurl);
             $fullurl = 'file:///' . htmlentities($relativeurl);
             $localpath = true;
         } else {
             // Normal uploaded file
             $forcedownloadsep = '?';
             if ($resource->options == 'forcedownload') {
                 $querys['forcedownload'] = '1';
             }
             $fullurl = get_file_url($course->id . '/' . $resource->reference, $querys);
         }
     }
     /// Print a notice and redirect if we are trying to access a file on a local file system
     /// and the config setting has been disabled
     if (!$CFG->resource_allowlocalfiles and strpos($resource->reference, RESOURCE_LOCALPATH) === 0) {
         if ($inpopup) {
             print_header($pagetitle, $course->fullname);
         } else {
             $navigation = build_navigation($this->navlinks, $cm);
             print_header($pagetitle, $course->fullname, $navigation, "", "", true, update_module_button($cm->id, $course->id, $this->strresource), navmenu($course, $cm));
         }
         notify(get_string('notallowedlocalfileaccess', 'resource', ''));
         if ($inpopup) {
             close_window_button();
         }
         print_footer('none');
         die;
     }
     /// Check whether this is supposed to be a popup, but was called directly
     if ($resource->popup and !$inpopup) {
         /// Make a page and a pop-up window
         $navigation = build_navigation($this->navlinks, $cm);
         print_header($pagetitle, $course->fullname, $navigation, "", "", true, update_module_button($cm->id, $course->id, $this->strresource), navmenu($course, $cm));
         echo "\n<script type=\"text/javascript\">";
         echo "\n<!--\n";
         echo "openpopup('/mod/resource/view.php?inpopup=true&id={$cm->id}','resource{$resource->id}','{$resource->popup}');\n";
         echo "\n-->\n";
         echo '</script>';
         if (trim(strip_tags($resource->summary))) {
             print_simple_box(format_text($resource->summary, FORMAT_MOODLE, $formatoptions), "center");
         }
         $link = "<a href=\"{$CFG->wwwroot}/mod/resource/view.php?inpopup=true&amp;id={$cm->id}\" " . "onclick=\"this.target='resource{$resource->id}'; return openpopup('/mod/resource/view.php?inpopup=true&amp;id={$cm->id}', " . "'resource{$resource->id}','{$resource->popup}');\">" . format_string($resource->name, true) . "</a>";
开发者ID:nadavkav,项目名称:MoodleTAO,代码行数:67,代码来源:resource.class.php

示例12: display

 function display()
 {
     global $CFG;
     /// Set up generic stuff first, including checking for access
     parent::display();
     /// Set up some shorthand variables
     $cm = $this->cm;
     $course = $this->course;
     $resource = $this->resource;
     require_once $CFG->libdir . '/filelib.php';
     $subdir = optional_param('subdir', '', PARAM_PATH);
     $resource->reference = clean_param($resource->reference, PARAM_PATH);
     $formatoptions = new object();
     $formatoptions->noclean = true;
     $formatoptions->para = false;
     // MDL-12061, <p> in html editor breaks xhtml strict
     add_to_log($course->id, "resource", "view", "view.php?id={$cm->id}", $resource->id, $cm->id);
     if ($resource->reference) {
         $relativepath = "{$course->id}/{$resource->reference}";
     } else {
         $relativepath = "{$course->id}";
     }
     if ($subdir) {
         $relativepath = "{$relativepath}{$subdir}";
         if (stripos($relativepath, 'backupdata') !== FALSE or stripos($relativepath, $CFG->moddata) !== FALSE) {
             error("Access not allowed!");
         }
         $subs = explode('/', $subdir);
         array_shift($subs);
         $countsubs = count($subs);
         $count = 0;
         $backsub = '';
         foreach ($subs as $sub) {
             $count++;
             if ($count < $countsubs) {
                 $backsub .= "/{$sub}";
                 $this->navlinks[] = array('name' => $sub, 'link' => "view.php?id={$cm->id}", 'type' => 'title');
             } else {
                 $this->navlinks[] = array('name' => $sub, 'link' => '', 'type' => 'title');
             }
         }
     }
     $pagetitle = strip_tags($course->shortname . ': ' . format_string($resource->name));
     $update = update_module_button($cm->id, $course->id, $this->strresource);
     if (has_capability('moodle/course:managefiles', get_context_instance(CONTEXT_COURSE, $course->id))) {
         $options = array('id' => $course->id, 'wdir' => '/' . $resource->reference . $subdir);
         $editfiles = print_single_button("{$CFG->wwwroot}/files/index.php", $options, get_string("editfiles"), 'get', '', true);
         $update = $editfiles . $update;
     }
     $navigation = build_navigation($this->navlinks, $cm);
     print_header($pagetitle, $course->fullname, $navigation, "", "", true, $update, navmenu($course, $cm));
     if (trim(strip_tags($resource->summary))) {
         print_simple_box(format_text($resource->summary, FORMAT_MOODLE, $formatoptions, $course->id), "center");
         print_spacer(10, 10);
     }
     $files = get_directory_list("{$CFG->dataroot}/{$relativepath}", array($CFG->moddata, 'backupdata'), false, true, true);
     if (!$files) {
         print_heading(get_string("nofilesyet"));
         print_footer($course);
         exit;
     }
     print_simple_box_start("center", "", "", '0');
     $strftime = get_string('strftimedatetime');
     $strname = get_string("name");
     $strsize = get_string("size");
     $strmodified = get_string("modified");
     $strfolder = get_string("folder");
     $strfile = get_string("file");
     echo '<table cellpadding="4" cellspacing="1" class="files" summary="">';
     echo "<tr><th class=\"header name\" scope=\"col\">{$strname}</th>" . "<th align=\"right\" colspan=\"2\" class=\"header size\" scope=\"col\">{$strsize}</th>" . "<th align=\"right\" class=\"header date\" scope=\"col\">{$strmodified}</th>" . "</tr>";
     foreach ($files as $file) {
         if (is_dir("{$CFG->dataroot}/{$relativepath}/{$file}")) {
             // Must be a directory
             $icon = "folder.gif";
             $relativeurl = "/view.php?blah";
             $filesize = display_size(get_directory_size("{$CFG->dataroot}/{$relativepath}/{$file}"));
         } else {
             $icon = mimeinfo("icon", $file);
             $relativeurl = get_file_url("{$relativepath}/{$file}");
             $filesize = display_size(filesize("{$CFG->dataroot}/{$relativepath}/{$file}"));
         }
         if ($icon == 'folder.gif') {
             echo '<tr class="folder">';
             echo '<td class="name">';
             echo "<a href=\"view.php?id={$cm->id}&amp;subdir={$subdir}/{$file}\">";
             echo "<img src=\"{$CFG->pixpath}/f/{$icon}\" class=\"icon\" alt=\"{$strfolder}\" />&nbsp;{$file}</a>";
         } else {
             echo '<tr class="file">';
             echo '<td class="name">';
             link_to_popup_window($relativeurl, "resourcedirectory{$resource->id}", "<img src=\"{$CFG->pixpath}/f/{$icon}\" class=\"icon\" alt=\"{$strfile}\" />&nbsp;{$file}", 450, 600, '');
         }
         echo '</td>';
         echo '<td>&nbsp;</td>';
         echo '<td align="right" class="size">';
         echo $filesize;
         echo '</td>';
         echo '<td align="right" class="date">';
         echo userdate(filemtime("{$CFG->dataroot}/{$relativepath}/{$file}"), $strftime);
         echo '</td>';
         echo '</tr>';
//.........这里部分代码省略.........
开发者ID:JackCanada,项目名称:moodle-hacks,代码行数:101,代码来源:resource.class.php

示例13: get_baseurl

 function get_baseurl()
 {
     // set the url base (first time only)
     if (!isset($this->baseurl)) {
         global $CFG;
         require_once $CFG->libdir . '/filelib.php';
         $this->baseurl = get_file_url($this->filedir) . '/';
     }
     return $this->baseurl;
 }
开发者ID:nadavkav,项目名称:MoodleTAO,代码行数:10,代码来源:lib.php

示例14: forum_print_attachments

/**
 * if return=html, then return a html string.
 * if return=text, then return a text-only string.
 * otherwise, print HTML for non-images, and return image HTML
 */
function forum_print_attachments($post, $return = NULL)
{
    global $CFG;
    $filearea = forum_file_area_name($post);
    $imagereturn = "";
    $output = "";
    if ($basedir = forum_file_area($post)) {
        if ($files = get_directory_list($basedir)) {
            $strattachment = get_string("attachment", "forum");
            foreach ($files as $file) {
                $icon = mimeinfo("icon", $file);
                $type = mimeinfo("type", $file);
                $ffurl = get_file_url("{$filearea}/{$file}");
                $image = "<img src=\"{$CFG->pixpath}/f/{$icon}\" class=\"icon\" alt=\"\" />";
                if ($return == "html") {
                    $output .= "<a href=\"{$ffurl}\">{$image}</a> ";
                    $output .= "<a href=\"{$ffurl}\">{$file}</a><br />";
                } else {
                    if ($return == "text") {
                        $output .= "{$strattachment} {$file}:\n{$ffurl}\n";
                    } else {
                        if (in_array($type, array('image/gif', 'image/jpeg', 'image/png'))) {
                            // Image attachments don't get printed as links
                            $imagereturn .= "<br /><img src=\"{$ffurl}\" alt=\"\" />";
                        } else {
                            echo "<a href=\"{$ffurl}\">{$image}</a> ";
                            echo filter_text("<a href=\"{$ffurl}\">{$file}</a><br />");
                        }
                    }
                }
            }
        }
    }
    if ($return) {
        return $output;
    }
    return $imagereturn;
}
开发者ID:r007,项目名称:PMoodle,代码行数:43,代码来源:lib.php

示例15: rss_get_url

function rss_get_url($courseid, $userid, $modulename, $id)
{
    global $CFG;
    require_once $CFG->libdir . '/filelib.php';
    return get_file_url($courseid . '/' . $userid . '/' . $modulename . '/' . $id . '/rss.xml', null, 'rssfile');
}
开发者ID:edwinphillips,项目名称:moodle-485cb39,代码行数:6,代码来源:rsslib.php


注:本文中的get_file_url函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。