For developers
Sun Jul 12 2009
All classes are documented very well.
The site is event-driven. Events are fired similar to how events work
in browser model. You can write up a new extension that will subscribe to
any specific event and then do its thing when such
event fires. For example, we have events 'onUserLogin',
'onProfileUpdate', 'onLogout', 'onNewReply', and many more... Or yes, our
event system implements SplSubject Interface
and if you want to subscribe to the events all you have to do is make
sure that your class implements SplObserver interface.
Good form validation with using form rules. We use HTML_QuickForm pear
class, slightly modified (improved), so if you are familiar with this class
it will be very easy for you to create new forms
and add any form validation rules (like required fields, validate email
address, validate alphanumeric only, etc.)
We use many SPL classes, like SPL fileinfo to represent a file,
ArrayObject to represent many arrays and objects, many of our objects
implement serializable interface. Basically if you are
familiar with SPL objects, it will be easy for you to understand the
design of many of our classes. If you are not familiar with SPL but always
wanted to learn how to use theme, then working on
our project is going to make this easy for you you will become an
expert in using SPL in no time!
Some event types also bubble up, just like events in
javascript.
With events it's easy to hook to the objects. For example, you can
write a spam filter that listens to 'onNewReply', then examines the
contents of the reply and if any spam words are found it
will issue
a cancelEvent() call, so that the reply will never be added to the
database.
An excellent logging system makes debugging and development very easy.
You can add a simple line:
$this->log('something happened); anywhere in your script.
The logger will automatically extract the class name and line number of
this line, so in your log you will see a timestamp, class, line as well as
your message.
This means you don't have to add __METHOD__.' line: '.__LINE__ to every
one of your log messages, this is done automatically for you.
Also admin is automatically notified by email every time the message is
added to log that contains the work 'Error', so you may log some
problematic events this way:
$this->log('Error: uploaded file could not be saved');
This message will be added to log and a copy of it will be sent to
admin.
We even have a javascript logging console. You can use logging in any
of your own javascripts. Just add
$L('got response ' + response);
This will immediately appear on logging console (small draggable panel
on the page)
This javascript logging panel is only visible to developers (you must
add your ip address to special file)
Lastly there is an sql query logging. All SQL queries on the site go
through the Database class which logs query as well as time before and time
after the query, so the time (in milliseconds) is
known for every sql query. This data is then dumped to the bottom of a
page. Again, this will be visible ONLY to developers and is only activated
when request comes from one of the ip addresses
added to developer's Ips)
All these things makes developing with Lampcms an unusually pleasant
experience.