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
unknown_type $str:
Return value
unknown
20 calls to fp_get_machine_readable()
- admin_edit_group_form_validate in modules/
admin/ admin.groups.inc - Validate handler for edit group form.
- advise_what_if_selection_form in modules/
advise/ advise.module - fp_render_button in includes/
theme.inc - Returns the HTML to draw a pretty button.
- fp_render_content in includes/
render.inc - This is very similar to fp_get_form / fp_render_form, except in this case we are being passed the completed "render_array", which already contains all of our elements. We will call hooks on it, sort by weights, and then return the rendered…
- fp_render_currently_advising_box in includes/
theme.inc - Draws the CurrentlyAdvisingBox which appears at the top of the screen, containing the student's information like name, major, etc.
File
- includes/
misc.inc, line 768 - This file contains misc functions for FlightPath
Code
function fp_get_machine_readable($str) {
return preg_replace('@[^a-zA-Z0-9_]+@', '_', $str);
}