public marks

PUBLIC MARKS from imelgrat with tag "PHP Classes"

17 July 2007 16:30

IAM Backup - A Free Database Backup PHP Class

IAM Backup is package made of two classes. One performs the backup of the selected MySQL database, and the second restores the database. Both classes support gzip-compressed files for improved performance. When performing the backup, the user is prompted to download the backup file, straight from the browser. Alternatively, the backup can be stored on the local server at a predefined location. Restoring the database (or copying it to another server) is just as easy.

IAM CSVDump - Export SQL Queries to CSV

This class takes the results of a SQL query and outputs in the CSV (comma separated values) format in only 2 lines of code. This comes very handy when exporting data since CSV is a format that can be readily read by Excel and many other applications. You can even use it for Word’s Mail Merge! The class offers the choice of sending the output to the browser or downloading it as a file. The name and extension of the dump file are defined by the developer.

IAMCalendar - Generate a HTML calendar from PHP (Free PHP Class)

This class can be used to display calendar of a given month in an HTML page. Holidays or other events can be configured to be highlighted in a special way (using CSS styles). The days of the month can rendered with a form checkbox or radio buttons so they can be selected by the user. Rendering of the different calendar elements can be configured using CSS styles. The names of the months and days of the week can be configured, so that they’re displayed in a language other than English.

Create Excel Spreadsheets from PHP (Free PHP Class)

IAM-XLS is a PHP class for generating an XLS file. Alternatively, it can be used for performing a query dump and sending it to the browser as an Excel File. It allows the user to enter text and numeric values into a Excel spreadsheet. It has browser and OS detection capabilities for appropriate handling of downloads (content-type, etc.). This class is licensed under the GNU Lesser General Public License (LGPL), so feel free to use it, modify it as you want, although a little credit is always welcome.

17 July 2007 16:15

Using Regular Expressions to Find RSS Links on a Page

the class performs three main steps. First, the cURL library is used to fetch the content pointed to by the URL the user passed.. Second, since PHP doesn’t have an SGML parser built in like Python seems to, so getting all the "link" tags has to be done manually. A few regular expressions and some simple string splitting made it all real easy. Last but not least, the function goes through all the links found, figures out which ones belong to RSS feeds, resolves them to absolutes URL if necessary, and stores them on an array, making sure the link isn’t already listed to prevent duplicate links (e.g., the RSS appears more than once in the page).