mirror of
https://github.com/moodle/moodle.git
synced 2025-03-17 22:20:00 +01:00
Merged branch 'MDL-27695' of git://github.com/nebgor/moodle.git with changes
This commit is contained in:
commit
f6bd0b9e39
@ -2816,10 +2816,29 @@ function convert_tabrows_to_tree($tabrows, $selected, $inactive, $activated) {
|
||||
*/
|
||||
function get_docs_url($path) {
|
||||
global $CFG;
|
||||
if (!empty($CFG->docroot)) {
|
||||
return $CFG->docroot . '/' . current_language() . '/' . $path;
|
||||
// Check that $CFG->release has been set up, during installation it won't be.
|
||||
if (empty($CFG->release)) {
|
||||
// It's not there yet so look at version.php
|
||||
include($CFG->dirroot.'/version.php');
|
||||
} else {
|
||||
return 'http://docs.moodle.org/en/'.$path;
|
||||
// We can use $CFG->release and avoid having to include version.php
|
||||
$release = $CFG->release;
|
||||
}
|
||||
// Attempt to match the branch from the release
|
||||
if (preg_match('/^(.)\.(.)/', $release, $matches)) {
|
||||
// We should ALWAYS get here
|
||||
$branch = $matches[1].$matches[2];
|
||||
} else {
|
||||
// We should never get here but in case we do lets set $branch to .
|
||||
// the smart one's will know that this is the current directory
|
||||
// and the smarter ones will know that there is some smart matching
|
||||
// that will ensure people end up at the latest version of the docs.
|
||||
$branch = '.';
|
||||
}
|
||||
if (!empty($CFG->docroot)) {
|
||||
return $CFG->docroot . '/' . $branch . '/' . current_language() . '/' . $path;
|
||||
} else {
|
||||
return 'http://docs.moodle.org/'. $branch . '/en/' . $path;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user