Commit 8c679b32 authored by merlinofchaos's avatar merlinofchaos
Browse files

#298934 by redndahead: Allow &path& as a more robust token replacement. Also for topic and base_url

parent 67f61a76
......@@ -509,10 +509,12 @@ function advanced_help_view_topic($module, $topic, $popup = FALSE) {
if ($popup) {
$output = preg_replace('/href="topic:([^"]+)"/', 'href="' . strtr(url('help/$1', array('query' => 'popup=true')), array('%24' => '$')) . '"', $output);
$output = preg_replace('/src="topic:([^"]+)"/', 'src="' . strtr(url('help/$1', array('query' => 'popup=true')), array('%24' => '$')) . '"', $output);
$output = preg_replace('/&topic:([^"]+)&/', strtr(url('help/$1', array('query' => 'popup=true')), array('%24' => '$')), $output);
else {
$output = preg_replace('/href="topic:([^"]+)"/', 'href="' . strtr(url('help/$1'), array('%24' => '$')) . '"', $output);
$output = preg_replace('/src="topic:([^"]+)"/', 'src="' . strtr(url('help/$1'), array('%24' => '$')) . '"', $output);
$output = preg_replace('/&topic:([^"]+)&/', strtr(url('help/$1'), array('%24' => '$')), $output);
global $base_path;
......@@ -520,10 +522,12 @@ function advanced_help_view_topic($module, $topic, $popup = FALSE) {
// Change 'path:' to the URL to the base help directory.
$output = preg_replace('/href="path:([^"]+)"/', 'href="' . $base_path . $info['path'] . '/$1"', $output);
$output = preg_replace('/src="path:([^"]+)"/', 'src="' . $base_path . $info['path'] . '/$1"', $output);
$output = str_replace('&path&', $base_path . $info['path'] .'/', $output);
// Change 'base_url:' to the URL to the site.
$output = preg_replace('/href="base_url:([^"]+)"/', 'href="' . strtr(url('$1'), array('%24' => '$')) . '"', $output);
$output = preg_replace('/src="base_url:([^"]+)"/', 'src="' . strtr(url('$1'), array('%24' => '$')) . '"', $output);
$output = str_replace('&base_url&', $base_path, $output);
if (!empty($info['navigation'])) {
$topics = advanced_help_get_topics();
......@@ -28,16 +28,19 @@ id. To embed links, use the following format:
$output .= theme('advanced_help_topic', $module, $topic);
<p>Inside your help file, link to other topics using the format <strong>&lt;a href=&quot;topic:module/topic"&gt;</strong>. This
<p>Inside your help file, link to other topics using the format <strong>&lt;a href="&amp;topic:module/topic&amp;"&gt;</strong>. This
format will ensure the popup status remains consistent when switching between links.</p>
<p>Use <strong>&lt;a href=&quot;path:example.jpg"&gt;</strong> to reference items
<p>Use <strong>&lt;a href="&amp;path&amp;example.jpg"&gt;</strong> to reference items
within the help directory, such as images you wish to embed within the help text.</p>
<p>Use <strong>&lt;a href=&quot;base_url:admin/settings/site-configuration"&gt;</strong> to reference any normal path in the site.</p>
<p>Use <strong>&lt;a href="&amp;base_url&amp;admin/settings/site-configuration"&gt;</strong> to reference any normal path in the site.</p>
<p>If the search module is enabled, the contents of help system will be indexed on cron. If you enable new modules and wish to immediately index its help text, visit the "Administration -> Reports -> Status report" and click the "Run cron manually" link.</p>
<p>Example: <a href="path:nowhere.jpg">Don't click this!</a></p>
<p>Example: <a href="&path&nowhere.jpg">Don't click this!</a></p>
<p>See: <a href="topic:advanced_help/ini-file">ini file format</a></p>
<p>See: <a href="&topic:advanced_help/ini-file&">ini file format</a></p>
<p><strong>NOTE: </strong> In previous versions Advanced Help did not require the &amp;'s wrapped around the topic:, path:, and base_url: links. This
is currently still supported, but may be removed in a future version. By adding the &'s these tokens are now not limited to href="" and src="" paramaters.</p>
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