本文整理汇总了PHP中Chamilo\CoreBundle\Framework\Container::getUrlAppend方法的典型用法代码示例。如果您正苦于以下问题:PHP Container::getUrlAppend方法的具体用法?PHP Container::getUrlAppend怎么用?PHP Container::getUrlAppend使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Chamilo\CoreBundle\Framework\Container
的用法示例。
在下文中一共展示了Container::getUrlAppend方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: api_get_path
//.........这里部分代码省略.........
* api_get_path(TO_WEB, $_SERVER['REQUEST_URI'])
* api_get_path(TO_SYS, $_SERVER['PHP_SELF'])
* api_get_path(TO_REL, __FILE__)
* ...
*/
function api_get_path($path_type, $path = null)
{
static $paths = array(WEB_PATH => '', SYS_PATH => '', REL_PATH => '', WEB_SERVER_ROOT_PATH => '', SYS_SERVER_ROOT_PATH => '', WEB_COURSE_PATH => '', SYS_COURSE_PATH => '', REL_COURSE_PATH => '', REL_CODE_PATH => '', WEB_CODE_PATH => '', SYS_CODE_PATH => '', SYS_LANG_PATH => 'lang/', WEB_IMG_PATH => 'web/bundles/chamilocore/img/', SYS_IMG_PATH => 'web/bundles/chamilocore/img/', WEB_CSS_PATH => 'web/css/', SYS_CSS_PATH => 'app/Resources/public/css/', SYS_PLUGIN_PATH => 'plugin/', WEB_PLUGIN_PATH => 'plugin/', SYS_ARCHIVE_PATH => 'app/cache/', WEB_ARCHIVE_PATH => 'app/cache/', SYS_APP_PATH => 'app/', WEB_APP_PATH => 'app/', SYS_UPLOAD_PATH => 'app/upload/', REL_UPLOAD_PATH => 'app/upload/', INCLUDE_PATH => 'inc/', LIBRARY_PATH => 'inc/lib/', CONFIGURATION_PATH => 'app/config/', WEB_LIBRARY_PATH => 'inc/lib/', WEB_LIBRARY_JS_PATH => 'web/bundles/chamilocore/js/', WEB_AJAX_PATH => 'inc/ajax/', SYS_TEST_PATH => 'tests/', WEB_TEMPLATE_PATH => 'template/', WEB_UPLOAD_PATH => 'app/upload/', WEB_PUBLIC_PATH => 'web/', SYS_TEMPLATE_PATH => 'template/', SYS_PUBLIC_PATH => 'web/', WEB_FONTS_PATH => 'fonts/', SYS_FONTS_PATH => 'fonts/');
static $resource_paths = array(FLASH_PLAYER_AUDIO => 'inc/lib/mediaplayer/player.swf', FLASH_PLAYER_VIDEO => 'inc/lib/mediaplayer/player.swf', SCRIPT_SWFOBJECT => 'inc/lib/swfobject/swfobject.js', SCRIPT_ASCIIMATHML => 'inc/lib/javascript/asciimath/ASCIIMathML.js', DRAWING_ASCIISVG => 'inc/lib/javascript/asciimath/d.svg');
static $is_this_function_initialized;
static $server_base_web;
// No trailing slash.
static $server_base_sys;
// No trailing slash.
static $root_rel;
$root_web = Container::getUrlGenerator()->generate('home', [], \Symfony\Component\Routing\Generator\UrlGeneratorInterface::ABSOLUTE_URL);
$rootDir = Container::getRootDir();
// Configuration data for already installed system.
$root_sys = $rootDir;
$code_folder = 'main/';
$course_folder = 'courses/';
// Configuration data for already installed system.
$load_new_config = false;
// To avoid that the api_get_access_url() function fails since global.inc.php also calls the main_api.lib.php
if ($path_type == WEB_PATH) {
if (isset($_configuration['access_url']) && $_configuration['access_url'] != 1) {
//we look into the DB the function api_get_access_url
$url_info = api_get_access_url($_configuration['access_url']);
$root_web = $url_info['active'] == 1 ? $url_info['url'] : $_configuration['root_web'];
$load_new_config = true;
}
}
if (!$is_this_function_initialized) {
$root_rel = Container::getUrlAppend();
// Dealing with trailing slashes.
$root_web = api_add_trailing_slash($root_web);
$root_sys = api_add_trailing_slash($root_sys);
$root_rel = api_add_trailing_slash($root_rel);
$code_folder = api_add_trailing_slash($code_folder);
$course_folder = api_add_trailing_slash($course_folder);
// Web server base and system server base.
$server_base_web = preg_replace('@' . $root_rel . '$@', '', $root_web);
// No trailing slash.
$server_base_sys = preg_replace('@' . $root_rel . '$@', '', $root_sys);
// No trailing slash.
// Initialization of a table that contains common-purpose paths.
$paths[WEB_PATH] = $root_web;
$paths[SYS_PATH] = $root_sys;
$paths[REL_PATH] = $root_rel;
$paths[WEB_SERVER_ROOT_PATH] = $server_base_web . '/';
$paths[SYS_SERVER_ROOT_PATH] = $server_base_sys . '/';
$paths[WEB_COURSE_PATH] = $root_web . $course_folder;
$paths[REL_COURSE_PATH] = $root_rel . $course_folder;
$paths[REL_CODE_PATH] = $root_rel . $code_folder;
$paths[WEB_CODE_PATH] = $root_web . $code_folder;
$paths[SYS_CODE_PATH] = $root_sys . $code_folder;
$paths[REL_UPLOAD_PATH] = $root_rel . $paths[SYS_UPLOAD_PATH];
$paths[WEB_DEFAULT_COURSE_DOCUMENT_PATH] = $paths[WEB_CODE_PATH] . 'default_course_document/';
$paths[REL_DEFAULT_COURSE_DOCUMENT_PATH] = $paths[REL_PATH] . 'main/default_course_document/';
// Now we can switch into api_get_path() "terminology".
$paths[SYS_LANG_PATH] = $paths[SYS_CODE_PATH] . $paths[SYS_LANG_PATH];
$paths[SYS_APP_PATH] = $paths[SYS_PATH] . $paths[SYS_APP_PATH];
$paths[WEB_APP_PATH] = $paths[WEB_PATH] . $paths[WEB_APP_PATH];
$paths[SYS_UPLOAD_PATH] = $paths[SYS_PATH] . $paths[SYS_UPLOAD_PATH];
$paths[SYS_PLUGIN_PATH] = $paths[SYS_PATH] . $paths[SYS_PLUGIN_PATH];
$paths[SYS_ARCHIVE_PATH] = Container::getTempDir();
示例2: fputs
// Setting the extension
$extension = 'html';
$content = Security::remove_XSS($values['content'], COURSEMANAGERLOWSECURITY);
/*if (strpos($content, '/css/frames.css') == false) {
$content = str_replace('</head>', '<link rel="stylesheet" href="./css/frames.css" type="text/css" /><style> body{margin:50px;}</style></head>', $content);
}*/
// Don't create file with the same name.
if (file_exists($filepath . $filename . '.' . $extension)) {
Display::display_header($nameTools, 'Doc');
Display::display_error_message(get_lang('FileExists') . ' ' . $title, false);
Display::display_footer();
exit;
}
if ($fp = @fopen($filepath . $filename . '.' . $extension, 'w')) {
//$courseUrl = \Chamilo\CoreBundle\Framework\Container::getUrlGenerator()->generate('course_url').'/';
$content = str_replace(api_get_path(WEB_COURSE_PATH), Container::getUrlAppend() . '/courses/', $content);
fputs($fp, $content);
fclose($fp);
chmod($filepath . $filename . '.' . $extension, api_get_permissions_for_new_files());
$file_size = filesize($filepath . $filename . '.' . $extension);
$save_file_path = $dir . $filename . '.' . $extension;
$document_id = add_document($_course, $save_file_path, 'file', $file_size, $title, null, $readonly);
if ($document_id) {
api_item_property_update($_course, TOOL_DOCUMENT, $document_id, 'DocumentAdded', $userId, $to_group_id, null, null, null, $current_session_id);
// Update parent folders
item_property_update_on_folder($_course, $dir, $userId);
$new_comment = isset($_POST['comment']) ? trim($_POST['comment']) : '';
$new_title = isset($_POST['title']) ? trim($_POST['title']) : '';
$new_title = htmlspecialchars($new_title);
if ($new_comment || $new_title) {
$ct = '';