function fp_get_machine_readable
Search API
7.x misc.inc | fp_get_machine_readable($str) |
6.x misc.inc | fp_get_machine_readable($str) |
4.x misc.inc | fp_get_machine_readable($str) |
5.x misc.inc | fp_get_machine_readable($str) |
Simple function to convert a string into a machine-readable string.
Useful for making possibly unsafe text work as an array index, a CSS class, etc. Replaces "bad" characters, or characters which might not be allowed for variables, for example, into underscores (_).
Parameters
string $str:
Return value
string
38 calls to fp_get_machine_readable()
- admin_edit_group_form_validate in modules/
admin/ admin.groups.inc - Validate handler for edit group form.
- advise_display_popup_change_term in modules/
advise/ advise.module - This popup allows the advisor to change the advising term.
- advise_what_if_selection_form in modules/
advise/ advise.module - AdvisingScreen::display_screen in classes/
AdvisingScreen.php - This function generates the HTML to display the screen. Should be used in conjunction with output_to_browser()
- AdvisingScreen::display_semester in classes/
AdvisingScreen.php - Given a Semester object, this will generate the HTML to draw it out to the screen. We will take advantage of the render engine, so we can utilize hook_content_alter later on.
File
- includes/
misc.inc, line 1390 - This file contains misc functions for FlightPath
Code
function fp_get_machine_readable($str) {
if (!$str) {
return (string) $str;
}
return preg_replace('@[^a-zA-Z0-9_]+@', '_', $str);
}