Commit d393a131 authored by Martyn Smith's avatar Martyn Smith Committed by Martyn Smith

rename theme_get_image_path => theme_get_image_url

parent 6112a3c5
......@@ -88,7 +88,7 @@ if (empty($records)) {
$records = array();
}
$data = array();
$star = theme_get_image_path('star.png');
$star = theme_get_image_url('star.png');
$unread = get_string('unread', 'activity');
foreach ($records as &$r) {
......
......@@ -91,9 +91,9 @@ foreach (plugin_types() as $plugin) {
}
}
$loadingicon = theme_get_image_path('loading.gif');
$successicon = theme_get_image_path('success.gif');
$failureicon = theme_get_image_path('failure.gif');
$loadingicon = theme_get_image_url('loading.gif');
$successicon = theme_get_image_url('success.gif');
$failureicon = theme_get_image_url('failure.gif');
$loadingstring = get_string('upgradeloading', 'admin');
$successstring = get_string('upgradesuccesstoversion', 'admin');
......
......@@ -58,9 +58,9 @@ foreach (array_keys($alltemplates) as $t) {
$alltemplates[$t]['installed'] = true;
}
}
$loadingicon = theme_get_image_path('loading.gif');
$successicon = theme_get_image_path('success.gif');
$failureicon = theme_get_image_path('failure.gif');
$loadingicon = theme_get_image_url('loading.gif');
$successicon = theme_get_image_url('success.gif');
$failureicon = theme_get_image_url('failure.gif');
$loadingstring = get_string('upgradeloading', 'admin');
$successstring = get_string('upgradesuccess', 'admin');
......
......@@ -44,9 +44,9 @@ if (!$upgrades) {
}
$js = 'var todo = ' . json_encode(array_keys($upgrades)) . ";\n";
$loadingicon = theme_get_image_path('loading.gif');
$successicon = theme_get_image_path('success.gif');
$failureicon = theme_get_image_path('failure.gif');
$loadingicon = theme_get_image_url('loading.gif');
$successicon = theme_get_image_url('success.gif');
$failureicon = theme_get_image_url('failure.gif');
$loadingstring = get_string('upgradeloading', 'admin');
$installsuccessstring = get_string('installsuccess', 'admin');
......
......@@ -25,7 +25,7 @@ function smarty_function_image_path($params, &$smarty) {
$params['pluginlocation'] = '';
}
return theme_get_image_path($params['imagelocation'], $params['pluginlocation']);
return theme_get_image_url($params['imagelocation'], $params['pluginlocation']);
}
?>
......@@ -409,7 +409,7 @@ function template_render($template, $mode, $data=array()) {
$javascript = '';
if ($mode == TEMPLATE_RENDER_EDITMODE) {
$droplist = json_encode($droplist);
$spinner_url = json_encode(theme_get_image_path('loading.gif'));
$spinner_url = json_encode(theme_get_image_url('loading.gif'));
$wwwroot = get_config('wwwroot');
$json_emptylabel = json_encode(get_string('emptylabel', 'view'));
......
......@@ -301,7 +301,7 @@ function theme_get_parent($currtheme) {
* @param $imagelocation path to image relative to theme/$theme/static/
* @param $pluginlocation path to plugin relative to docroot
*/
function theme_get_image_path($imagelocation, $pluginlocation='') {
function theme_get_image_url($imagelocation, $pluginlocation='') {
$theme = theme_setup();
foreach ($theme->inheritance as $themedir) {
......@@ -311,6 +311,22 @@ function theme_get_image_path($imagelocation, $pluginlocation='') {
}
}
/**
* This function returns the full path to an image
* Always use it to get image paths
* @param $imagelocation path to image relative to theme/$theme/static/
* @param $pluginlocation path to plugin relative to docroot
*/
function theme_get_image_path($imagelocation, $pluginlocation='') {
$theme = theme_setup();
foreach ($theme->inheritance as $themedir) {
if (is_readable(get_config('docroot') . $pluginlocation . 'theme/' . $themedir . '/static/' . $imagelocation)) {
return get_config('docroot') . $pluginlocation . 'theme/' . $themedir . '/static/' . $imagelocation;
}
}
}
/**
* This function sends headers suitable for all JSON returning scripts.
*
......@@ -854,7 +870,12 @@ function admin_nav() {
'name' => 'uploadcsv',
'section' => 'admin',
'link' => $wwwroot . 'admin/users/uploadcsv.php'
)
),
array(
'name' => 'usersearch',
'section' => 'admin',
'link' => $wwwroot . 'admin/users/search.php'
),
)
),
array(
......@@ -1086,7 +1107,7 @@ function searchform() {
),
'submit' => array(
'type' => 'image',
'src' => theme_get_image_path('images/btn_search_off.gif')
'src' => theme_get_image_url('images/btn_search_off.gif')
)
)
));
......
......@@ -32,17 +32,29 @@ require('init.php');
$type = param_alpha('type');
switch ($type) {
case 'template':
require_once('template.php');
$name = param_alpha('name');
$template = template_locate($name);
if (isset($template['thumbnail'])) {
header("Content-type: " . $template['thumbnailcontenttype']);
readfile($template['thumbnail']);
exit;
}
throw new InvalidArgumentException("Couldn't find a template thumbnail for $name");
break;
case 'template':
require_once('template.php');
$name = param_alpha('name');
$template = template_locate($name);
if (isset($template['thumbnail'])) {
header("Content-type: " . $template['thumbnailcontenttype']);
readfile($template['thumbnail']);
exit;
}
header('Content-type: ' . 'image/gif');
readfile(theme_get_image_path('images/no_thumbnail.gif'));
exit;
break;
case 'user':
if (false) { // @todo find their real profile image
}
else {
header('Content-type: ' . 'image/gif');
readfile(theme_get_image_path('images/no_userphoto40x40.gif'));
}
break;
}
?>
......@@ -134,8 +134,8 @@ $smarty = smarty(
)
);
$smarty->assign('rootinfo', $rootinfo);
$smarty->assign('plusicon', theme_get_image_path('plus.png'));
$smarty->assign('minusicon', theme_get_image_path('minus.png'));
$smarty->assign('plusicon', theme_get_image_url('plus.png'));
$smarty->assign('minusicon', theme_get_image_url('minus.png'));
$smarty->assign('template', $template);
......
......@@ -196,8 +196,8 @@ $smarty = smarty(
)
);
$smarty->assign('rootinfo', $rootinfo);
$smarty->assign('plusicon', theme_get_image_path('plus.png'));
$smarty->assign('minusicon', theme_get_image_path('minus.png'));
$smarty->assign('plusicon', theme_get_image_url('plus.png'));
$smarty->assign('minusicon', theme_get_image_url('minus.png'));
$smarty->assign('template', $template);
......
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