Browse files

improved name of function - clean_getstring_data() - and call it only

is data is actually defined.
  • Loading branch information...
1 parent 6add2db commit 5fe35ab0e34e79e2063b77a0d75283e7dc450bef thepurpleblob committed Jun 23, 2005
Showing with 5 additions and 3 deletions.
  1. +5 −3 lib/moodlelib.php
View
8 lib/moodlelib.php
@@ -4249,15 +4249,15 @@ function print_string($identifier, $module='', $a=NULL) {
* @param mixed $a An object, string or number that can be used
* @return mixed the supplied parameter 'cleaned'
*/
-function clean_a( $a ) {
+function clean_getstring_data( $a ) {
if (is_string($a)) {
return str_replace( '%','%%',$a );
}
elseif (is_object($a)) {
$a_vars = get_object_vars( $a );
$new_a_vars = array();
foreach ($a_vars as $fname => $a_var) {
- $new_a_vars[$fname] = clean_a( $a_var );
+ $new_a_vars[$fname] = clean_getstring_data( $a_var );
}
return (object)$new_a_vars;
}
@@ -4336,7 +4336,9 @@ function get_string($identifier, $module='', $a=NULL) {
}
// if $a happens to have % in it, double it so sprintf() doesn't break
- $a = clean_a( $a );
+ if ($a) {
+ $a = clean_getstring_data( $a );
+ }
/// Define the two or three major locations of language strings for this module

0 comments on commit 5fe35ab

Please sign in to comment.