Chirpy!

Latest Version: 0.3
Released: 2007-02-09

Chirpy! 0.3 API Documentation

<<
Chirpy::Util

NAME

Chirpy::Util - Static utility class

FUNCTIONS

valid_username($username)

Returns whether or not the given username is valid. A username is valid if it is minimally 2, maximally 32 characters long. The characters can be letters, numbers, underscores or dashes.

valid_password($password)

Returns whether or not the given password is valid. A password is valid if it is minimally 4, maximally 256 characters long. The characters can be letters, numbers, underscores or dashes.

clean_up_submission($string)

Performs various cleanup operations on the given string, which is assumed to be filled in by the user somewhere. The operations include removal of leading and trailing whitespaces, and trimming down sequences of more than 2 line feeds.

parse_tags($tags)

Parses the string $tags into an array of valid tags and returns a reference to it. The array may be empty.

encrypt($string)

Encrypts the given string using the MD5 algorithm. This function is used for password encryption.

format_quote_rating($rating)

Returns a string representation of the given rating, i.e. the number prepended with the Unicode representation of its sign.

format_date_time($timestamp, $format, $gmt)

Formats $timestamp using the POSIX module's strftime() function and $format as the format. Returns Greenwich Mean Time if $gmt is true.

encode_xml_entities($string)

Returns $string with the character entities defined in XML encoded. The entities and their respective codes are:

 Character Entity
 ========= ======
     &     &amp;
     "     &quot;
     <     &lt;
     >     &gt;
decode_utf8($string)

Returns the given string with UTF-8 characters decoded.

PROCEDURES

ensure_writable_directory($path)

Attempts to make the directory specified by $path writable, creating it if it does not exist. If, upon completion, $path does represent a writable directory, execution is aborted.

abstract_method()

Aborts execution immediately, stating that the method is abstract and must be implemented. Hence, if you have an abstract method my_abstract_method(), you may define it as follows:

 *my_abstract_method = \&Chirpy::Util::abstract_method;

Invoking it will then cause a fatal error unless it is overridden in the module implementation.

AUTHOR

Tim De Pauw <ceetee@users.sourceforge.net>

SEE ALSO

Chirpy, http://chirpy.sourceforge.net/

COPYRIGHT

Copyright 2005-2007 Tim De Pauw. All rights reserved.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.