PHP file
14
Simple chatting script to be placed on a corner of a website 
Also a good example how to use ajax.

Also a good example how to use ajax.
14
Display contents of a folder, see comments in code.
14
This function calculates how many lines will text occupy.
Example (simple):
$string = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Phasellus tincidunt posuere dolor";
$num_lines = how_many_lines(10, $string);
It accepts a third, optional, parameter $options, that allows you to change behaviour. $options should be array. Following configuration options are available:
'white_spaces' - default: array(' ', "\t") - array of chars, that should be treated as whitespace.
'new_lines' - default: array("\r\n", "\n") - array of strings, that should be treated as newlines. For example, for HTML you can set 'new_lines' => array('');
'force_line_breaks' - default: true - force wrapping, when the token is longer than width, or not. If set to false, and token cannot be fitted into $width, function will return false;
'callback' - default: null - callback function for determining character width. Must accept at least one parameter - $char
'callback_params' - default: array() - optional additional callback parameters
'char_widths' - default: null - associative array in a form $char => $width, which contains char width. If $char is not found in the array, it's width is defaulted to 0.
Example (simple):
$string = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Phasellus tincidunt posuere dolor";
$num_lines = how_many_lines(10, $string);
It accepts a third, optional, parameter $options, that allows you to change behaviour. $options should be array. Following configuration options are available:
'white_spaces' - default: array(' ', "\t") - array of chars, that should be treated as whitespace.
'new_lines' - default: array("\r\n", "\n") - array of strings, that should be treated as newlines. For example, for HTML you can set 'new_lines' => array('');
'force_line_breaks' - default: true - force wrapping, when the token is longer than width, or not. If set to false, and token cannot be fitted into $width, function will return false;
'callback' - default: null - callback function for determining character width. Must accept at least one parameter - $char
'callback_params' - default: array() - optional additional callback parameters
'char_widths' - default: null - associative array in a form $char => $width, which contains char width. If $char is not found in the array, it's width is defaulted to 0.
14
Get File Extensio
14
Strip HTML
15
Basic internal class loading for PHP. Could make some plugins with this code if used properly.
15
This litle snippet shows how to store passwords and then check inputed passwords if they are correct.
(In this snippet we use som pseduo code for the database connection).
(In this snippet we use som pseduo code for the database connection).
15
A small recursive php function to determine the size of a directory by adding all it's contents together and returning them as an integer.
15
Generates a tree view within a dropdown select box.
15
This is a bare-bones DB connectivity class. It's really just meant to abstract a few basic mysql_ functions so that if you ever have to change DBs you don't have to change every database function call.
I really just threw this together on a whim with no testing what-so-ever. Also, it only abstracts the most basic MySQL functions--this is intentional; please expand it as you see fit.
I really just threw this together on a whim with no testing what-so-ever. Also, it only abstracts the most basic MySQL functions--this is intentional; please expand it as you see fit.









