Information Technology

Utility Library

aLogin2 uses a set of general functions collected together in a pdclib.php file.  These functions can used outside of aLogin2 and even with applications that don’t use aLogin2. You should not create functions or variables using these names.  You can create your own utility function file, but it must have functions with these names and perform the required functions.  Note that not all of these functions are used in aLogin2.

The file contains the following functions at this time (this is subject to update at any time).

ml_memberof(array $alist, string $astring) – This function takes a string and sees whether it matches an element in an array.  Returns true if found else false.

ml_cleanquotes(string $astring) – Takes a string and replaces a single quotes with &#039 and double quotes with &quot:.  Returns the new string.  This function is useful when html is being stored in a database.  Normal quote characters within values being passed to or from the database case be handled incorrectly in some situations.

ml_restorequotes(string $astring) – Reverses the ml_cleanquotes function.  Returns the converted string.

ml_sort_order_date(string $adate) – Takes a date in the form of mm_dd_yyyy and switches it to yyyy/mm/dd to make sorting easier.  It’s assumed that the date and month are both two digits using leading zeros if necessary.  Returns the new date string.

ml_display_order_date(string $date) – Reverses the effect of ml_sort_order_date function so the date is more presentable.  Returns the new date string.

ml_sort_order_time(string $atime) – Despite the name all does is take a time in the form of 2:15 PM and convert it into the form  14_15. Used to force a consistent sortable time into databases. Returns the new string.

ml_display_order_time(string $atime) – Reverses the effect of ml_sort_order_time, including adding AM or PM at end of string.  Returns the new string.

We believe that only ml_cleanquotes and ml_restorequotes are the only functions being used by aLogin2 at this time.