Project

General

Profile

« Previous | Next » 

Revision 954

Added by Matthias over 15 years ago

Added language support for template_description (affects templates and themes)

View differences:

details.php
25 25

  
26 26
// Include the config file
27 27
require('../../config.php');
28
require_once(WB_PATH .'/framework/functions.php');
28 29

  
29 30
// Get template name
30 31
if(!isset($_POST['file']) OR $_POST['file'] == "") {
......
55 56
	$row = $result->fetchRow();
56 57
}
57 58

  
59
// check if a template description exists for the displayed backend language
60
$tool_description = false;
61
if(function_exists('file_get_contents') && file_exists(WB_PATH.'/templates/'.$file.'/languages/'.LANGUAGE .'.php')) {
62
	// read contents of the template language file into string
63
	$data = @file_get_contents(WB_PATH .'/templates/' .$file .'/languages/' .LANGUAGE .'.php');
64
	// use regular expressions to fetch the content of the variable from the string
65
	$tool_description = get_variable_content('template_description', $data, false, false);
66
	// replace optional placeholder {WB_URL} with value stored in config.php
67
	if($tool_description !== false && strlen(trim($tool_description)) != 0) {
68
		$tool_description = str_replace('{WB_URL}', WB_URL, $tool_description);
69
	} else {
70
		$tool_description = false;
71
	}
72
}
73
if($tool_description !== false) {
74
	// Override the template-description with correct desription in users language
75
	$row['description'] = $tool_description;
76
}	
77

  
58 78
$template->set_var(array(
59 79
								'NAME' => $row['name'],
60 80
								'AUTHOR' => $row['author'],

Also available in: Unified diff