function finder_export in Finder 6
Same name and namespace in other branches
- 7.2 finder.module \finder_export()
- 7 finder.module \finder_export()
Build finder code string recursively.
2 calls to finder_export()
- finder_admin_export in includes/
finder.admin.inc - Admin finder export page.
- hook_finder_export_alter in ./
finder.api.php - Alter the default output of an export string.
1 string reference to 'finder_export'
- finder_admin_export in includes/
finder.admin.inc - Admin finder export page.
File
- ./
finder.module, line 1518 - The finder module.
Code
function finder_export($var, $iteration = 0) {
$tab = '';
for ($i = 0; $i < $iteration; $i++) {
$tab = $tab . " ";
}
$iteration++;
if (is_object($var)) {
$var = (array) $var;
$var['#_finder_object'] = '1';
}
if (is_array($var)) {
$empty = empty($var);
$code = "array(" . ($empty ? '' : "\n");
foreach ($var as $key => $value) {
$out = $tab . " '" . $key . "' => " . finder_export($value, $iteration) . ",\n";
drupal_alter('finder_export', $out, $tab, $key, $value, $iteration);
$code .= $out;
}
$code .= ($empty ? '' : $tab) . ")";
return $code;
}
else {
if (is_string($var)) {
return "'" . addslashes($var) . "'";
}
elseif (is_numeric($var)) {
return $var;
}
elseif (is_bool($var)) {
return $var ? 'TRUE' : 'FALSE';
}
else {
return 'NULL';
}
}
}