function google_tag_text_clean in GoogleTagManager 7.2
Same name in this branch
- 7.2 includes/form/container.inc \google_tag_text_clean()
- 7.2 includes/form/settings.inc \google_tag_text_clean()
Same name and namespace in other branches
- 7 includes/admin.inc \google_tag_text_clean()
Cleans a string representing a list of items.
Parameters
string $text: The string to clean.
string $format: The final format of $text, either 'string' or 'array'.
4 calls to google_tag_text_clean()
- google_tag_container_form_validate in includes/
form/ container.inc - Form validation handler for google_tag_container_form().
- google_tag_settings_form_validate in includes/
form/ settings.inc - Form validation handler for google_tag_settings_form().
- _google_tag_validate_listed_classes in includes/
variable.inc - Element validation handler for google_tag_listed_classes.
- _google_tag_validate_text in includes/
variable.inc - Element validation handler for text values.
File
- includes/
form/ settings.inc, line 297 - Contains the settings form callbacks.
Code
function google_tag_text_clean(&$text, $format = 'string') {
$text = explode("\n", $text);
$text = array_map('trim', $text);
$text = array_filter($text, 'trim');
if ($format == 'string') {
$text = implode("\n", $text);
}
}