Commit 15796c10 authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Modify help files customisation to search for all help files inside the...


Modify help files customisation to search for all help files inside the local/lang/.../help/ directory, even if the help files come from plugins
Signed-off-by: default avatarRichard Mansfield <richardm@catalyst.net.nz>
parent 15d40342
...@@ -236,31 +236,29 @@ function get_helpfile($plugintype, $pluginname, $form, $element, $page=null, $se ...@@ -236,31 +236,29 @@ function get_helpfile($plugintype, $pluginname, $form, $element, $page=null, $se
function get_helpfile_location($plugintype, $pluginname, $form, $element, $page=null, $section=null) { function get_helpfile_location($plugintype, $pluginname, $form, $element, $page=null, $section=null) {
$file = 'help/'; $subdir = 'help/';
if ($plugintype != 'core') {
$location = $plugintype . '/' . $pluginname . '/lang/';
}
else {
$location = 'lang/';
}
if ($page) { if ($page) {
$page = str_replace('-', '/', $page); $pagebits = split('-', $page);
$file = array_pop($pagebits) . '.html';
if ($plugintype != 'core') { if ($plugintype != 'core') {
$file .= 'pages/' . $page . '.html'; $subdir .= 'pages/' . join('/', $pagebits) . '/';
} }
else { else {
$file .= 'pages/' . $pluginname . '/' . $page . '.html'; $subdir .= 'pages/' . $pluginname . '/' . join('/', $pagebits) . '/';
} }
} }
else if ($section) { else if ($section) {
$file .= 'sections/' . $section . '.html'; $subdir .= 'sections/';
$file = $section . '.html';
} }
else if (!empty($form) && !empty($element)) { else if (!empty($form) && !empty($element)) {
$file .= 'forms/' . $form . '.' . $element . '.html'; $subdir .= 'forms/';
$file = $form . '.' . $element . '.html';
} }
else if (!empty($form) && empty($element)) { else if (!empty($form) && empty($element)) {
$file .= 'forms/' . $form . '.html'; $subdir .= 'forms/';
$file = $form . '.html';
} }
else { else {
return false; return false;
...@@ -276,13 +274,26 @@ function get_helpfile_location($plugintype, $pluginname, $form, $element, $page= ...@@ -276,13 +274,26 @@ function get_helpfile_location($plugintype, $pluginname, $form, $element, $page=
} }
//try the local settings //try the local settings
$langfile = get_config('docroot') . 'local/' . $location . $lang . '/' . $file; $langfile = get_config('docroot') . 'local/lang/' . $lang . '/' . $subdir;
if ($plugintype != 'core') {
$langfile .= $plugintype . '.' . $pluginname . '.' . $file;
}
else {
$langfile .= $file;
}
if (is_readable($langfile)) { if (is_readable($langfile)) {
return $langfile; return $langfile;
} }
if ($plugintype != 'core') {
$location = $plugintype . '/' . $pluginname . '/lang/';
}
else {
$location = 'lang/';
}
// try the current language // try the current language
$langfile = get_language_root() . $location . $lang . '/' . $file; $langfile = get_language_root() . $location . $lang . '/' . $subdir . $file;
if (is_readable($langfile)) { if (is_readable($langfile)) {
return $langfile; return $langfile;
} }
...@@ -294,7 +305,7 @@ function get_helpfile_location($plugintype, $pluginname, $form, $element, $page= ...@@ -294,7 +305,7 @@ function get_helpfile_location($plugintype, $pluginname, $form, $element, $page=
if ($parentlang == 'en.utf8') { if ($parentlang == 'en.utf8') {
$trieden = true; $trieden = true;
} }
$langfile = get_language_root($parentlang) . $location . $parentlang . '/' . $file; $langfile = get_language_root($parentlang) . $location . $parentlang . '/' . $subdir . $file;
if (is_readable($langfile)) { if (is_readable($langfile)) {
return $langfile; return $langfile;
} }
...@@ -303,7 +314,7 @@ function get_helpfile_location($plugintype, $pluginname, $form, $element, $page= ...@@ -303,7 +314,7 @@ function get_helpfile_location($plugintype, $pluginname, $form, $element, $page=
// if it's STILL not found, and we haven't already tried english ... // if it's STILL not found, and we haven't already tried english ...
if (empty($data) && empty($trieden)) { if (empty($data) && empty($trieden)) {
$langfile = get_language_root('en.utf8') . $location . 'en.utf8/' . $file; $langfile = get_language_root('en.utf8') . $location . 'en.utf8/' . $subdir . $file;
if (is_readable($langfile)) { if (is_readable($langfile)) {
return $langfile; return $langfile;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment