Extending Zend_Acl to support custom roles and resources

Date November 29, 2007

Few days ago I played a little with the Zend_Acl package, which provides lightweight and flexible access control list functionality and privileges management. It was very easy to use, but I found that the base Zend_Acl package has some limitation/problem if you want to use it in a bigger real life project. Zend_Acl supports only logical roles, resources so I decided to extend it to allow using custom roles and resources which can represent existing entities (for example users/groups and topics in a database). You will find the full source code and sample sql dump in the end of the post. Read the rest of this entry »

What is new in PHP 5.3 – part 4: __callStatic, OpenID support, user.ini, XSLT profiling and more

Date November 20, 2007

We are already familiar with namespaces, late static binding and mysqlnd but PHP 5.3 has a lot more cool features. We can find some information about the features of the upcoming PHP version from Johannes Schlüter’s (the release manager of PHP 5.3) blog entry and from the PHP Release Management Wiki. Some of the features are interesting only for internals, but there are a lot of great ones for end users too: __callStatic, dynamic static call, OpenID support, improved ini handling, XSLT profiling, SQLite 3 support and more. Read the rest of this entry »

What is new in PHP 5.3 – part 3: mysqlnd

Date November 17, 2007

In the first two parts of this series I wrote about namespaces and late static binding. In this part I will cover mysqlnd (MySQL native driver for PHP), which is also a really cool feature of PHP 5.3. This a replacement library (not an extension) for libmysql (MySQL Client Library) offering a lot of advantage over it. While libmysql was developed primarily for C and C++, mysqlnd was designed and optimized for PHP, it takes advantages of the internal structure of Zend Engine. By the time of this writing mysql and mysqli are supported, and the integration to PDO is in working progress. Read the rest of this entry »

What is new in PHP 5.3 – part 2: late static binding

Date November 15, 2007

In the first part of this series I wrote about namespaces, in the second part we will deal with late static binding, which is a very exciting new feature in PHP 5.3 and which promise some really nifty code. :) This topic attracted attention after Zend’s webcast about the Zend Framework. There was a little outcry in the PHP blogosphere, that the ActiveRecord examples presented in this webcast can’t work in PHP even with the version 5.2. Now with late static binding it is possible to implement this style of ActiveRecord almost correctly. Read the rest of this entry »

What’s new in PHP 5.3 – part 1: namespaces

Date November 13, 2007

In my previous post I mentioned that PHP 5.3 will be released in early 2008 so I think it’s just in time to talk about the features of this version. It is started by this polling (in detail, in an ordered version) on the internal list. The big gun features are namespaces, late static binding and mysqlnd, but there are other interesting improvements, for example __callStatic, dynamic static calls. In this part of this series we are going to analyze namespaces in detail. Read the rest of this entry »

International PHP Conference 2007 Megapost

Date November 11, 2007

UPDATED: I added the following three talks to the post. If you know any other presentation which is accessible and is missing from here, please notify me! TIA

Beautiful code with AOP and DIRobert Lemke
This was a really great presentation, watch out: you will be infected! Robert shows us advanced programming concepts such as DDD (Domain Driven Design), AOP (Aspect-Oriented Programming), DI (Dependency Injection). This concepts serves a common aims to produce higher quality, maintainable, flexible software. Robert is the member of the Typo3 5.0 development team, and they are using this methods in their every day work. If you are interested in this topic you can find useful information in their home page or you should read the Bibles :) :

Recommended literature

Enhanced StreamWrappersFrank Kleine
This talk is about a really cool and unfortunately rarely used PHP feature: PHP streams. Frank will shows you how you can create custom stream wrappers, and some useful and advanced examples how you can use them.

Eclipse Hands On to development – Bastian Feder
Bastian’s mini talk is about how to integrate external tool to Eclipse. He is now setting up his blog, so you can download his presentation from my blog. Read the rest of this entry »

WordPress quicktag toolbar tweaking again

Date November 10, 2007

It is said that it is a good behavior to set title attribute to a tags. I usually put to the title the text of the link. The process is: I put the link to the clipboard, go to the editor, select the text, press Ctrl-A, insert the link to the dialog box, press enter, then put the text of the link to the clipboard, go to the opening a tag, insert title="" and finally paste the text from the clipboard to the attribute. This is a repetitive and tedious task, so like in the previous case I automate it. Read the rest of this entry »

Hungarian unicode qwerty keyboard layout

Date November 9, 2007

Unfortunately in the official Hungarian keyboard layout on Mac OS X the z and y letter are replaced. I like to program with English keyboard layout but for writing forum posts or emails I usually use Hungarian keyboard. It was a very schizophrenic situation that z and y was always changing, so I decided to create my own Hungarian keyboard layout. Fortunately there is a program named Ukelele with which it was quite easy to create a new keyboard layout. This is a unicode layout so you can even enter Å‘, ű in Firefox, which was not possible with the popular custom Hungarian layouts. Read the rest of this entry »

Fixing some problems in Template Lite

Date November 8, 2007

As a PHP developer probably you are familiar with Smarty, which is maybe the de facto PHP template engine. Smarty is sometimes criticized that it has too many feature and is too big. I think that in an average development Smarty could be a good choice, it gives you a lot of potential, and its speed and memory footprint has no impact on the overall performance of the application. But if you develop a really high traffic website these issues could become very important. Template Lite could be a good compromise between the features of Smarty and the performance. It is a lightweight version of Smarty, it is much faster and has much lower memory footprint. It has almost the same features like Smarty, so you won’t have any problem using it after Smarty. While Template Lite works very well, it needs a few improvements. Read the rest of this entry »

How to use Smarty resources

Date November 6, 2007

Have you ever faced the situation, that the content of a variable is a Smarty template like string, and you want to fetch or display it? I worked on project where we decided that our language file entries will be Smarty templates, because we need the flexibility of the template engine (sprintf was not enough). The problem is, that by default Smarty’s fetch/display method accepts a template file name. Of course we could write the text to a temporary file, but it would be bigger hack than PHPNuke. ;) Fortunately Smarty has the mechanism to solve this problem via defining custom resource types. Read the rest of this entry »