PHP

PHP 5.3.1 RC3 released!

We are yet another release candidate closer to PHP 5.3.1.  A link to download PHP 5.3.1 RC3 is included below, as well as links to the changelog and current bugs.  One bug fix will help prevent DOS (denial of service) attacks via a new INI directive labeled max_file_uploads.  This will default to 100 files per request.

Download PHP 5.3.1 RC3

Share

10+ WordPress Functions Every Developer Should Know About

add_action($tag, $function_to_add, $priority, $accepted_args)
do_action($tag, $arg)

add_action() attaches a function to a specific action, which is then triggered by a do_action() call somewhere during execution. This can be used to execute a group of functions using the $priority parameter to determine order (optional), and arguments can be passed through the $accepted_args parameter. Below are a few examples of how this is used in the WordPress platform:

WordPress Logo

  • do_action(‘deleted_post’)
    This is executed after a post or page is deleted, and post or page ID is passed as a parameter.  This allows you add custom functionality whenever a post is deleted.  For example, lets say you want to be notified every time a post is deleted.  You can create a function to send the e-mail, and execute add_action(‘deleted_post’, ‘notify_when_deleted’, 10, $email). After that, when do_action(‘deleted_post’) is called, the notify_when_deleted() function will be called.
  • do_action(‘wp_head’)
    The wp_head action is traditionally called within a theme’s header.  If you wanted to create an SEO plugin, you could very easily add an action to wp_head to display meta tags. Read the rest of this entry »
Share

jQuery Tablesorter helper function for WordPress

In one of my projects, I converted WordPress into a reporting engine, which is used at 20 car dealerships to track Internet sales.  During development, I found that I was writing the same code over and over again for the jQuery Tablesorter plugin, which allows you to sort tables using a simple JavaScript call.

First, I would have to queue the script file, then add the appropriate JavaScript. To ensure the JavaScript was executed at the right time, I had to create a function to use it with add_action().  I found this to be tedious and unnecessary, and wrote a simple helper function to remedy this.  The following function was added to /wp-admin/includes/template.php, but if you use it, it will most likely go in a plugin or theme include.  This will prevent it from being overwritten during WordPress upgrades. Read the rest of this entry »

Share

Zend PHP 5 Certification: Actual vs. Mock Test

Over the course of the past few months, I have been studying and preparing for the Zend PHP 5 Certification exam (ZCE).  During this time, I purchased two five packs of mock tests.  The mock tests mimic the format of the actual test very well, though there are minor differences.  The one thing you will notice right off the bat is that the mock test returns a grade of PASS, FAIL, or EXCELLENT.  The Zend web site says the following with regard to actual vs. mock testing:

Mimics the exact setup of the actual exam and includes 70 questions to be completed in 90 minutes. The questions are different from the ones used in the real exam, however, they are also more difficult and complex—thus, if you score well on this exam, you should be comfortable that you are well-prepared to take the real test.

I got so-so grades on the first few mock tests, but still managed to get a passing grade.  By the end, I had two tests in a row with a grade of EXCELLENT.  I found out in the beginning that the two areas needing the most work were PHP4/5 Differences and Streams & Network Programming.  I studied these areas and brought the scores up to pass, and even excellent eventually.  I continued to study, but was fairly confident that I could pass the exam based on the statement from Zend, and the fact that I had taken and passed eight mock exams, including two classified as “excellent.”

Unfortunately, it was not that simple.  I took the test yesterday, and did not pass.  I was really disappointed because of the amount of work I put into preparing, but even more so due to the statement on Zend’s web site.  The actual test was much harder than they led me to believe.  I think that the statement should be reworded to effectively show the difficulty of this test.

I write this as a warning to those who take the approach I took.  While the mock tests serve as a good benchmark, getting an excellent or passing grade (even eight times) should not be an indication that you will be able to pass.  I know what I have to do now, but I wish I knew this $125 dollars ago.

Share

PHP 5.3.1 RC2 released

We are one step closer to PHP 5.3.1, which *should* mean more universal support from hosting providers, and software like cPanel/WHM with EasyApache. Let the countdown begin…

Download PHP 5.3.1 RC2

Share

Using PHPass password hasher with Zend Framework

In this tutorial, we will learn how to use PHPass, a portable PHP password hashing component, with the “glue”-based Zend Framework.  The popular PHP-based blogging platform WordPress utilizes PHPass to hash user passwords.  Using this library adds an extra level of security over a normal MD5-protected password. Read the rest of this entry »

Share

TPC! Memory Usage 0.4 for WordPress released!

We just released TPC! Memory Usage 0.4, which in addition to providing memory usage monitoring, provides WordPress users with a detailed System Info screen within the WordPress administration panel.  The system information screen includes information on web server, PHP, MySQL, and WordPress statuses and settings.  A link has been provided from the dashboard widget for easy access.  We also added additional information on the notification feature in the FAQ section on WordPress.org due to some confusion. Read the rest of this entry »

Share

Simple handling of jQuery dependencies with Zend Framework 1.9.x

I have a lot of experience with WordPress development, and I’ve grown to love the way JavaScript dependencies are handled in that particular application.  In WordPress, all JavaScript dependencies are defined in /wp-includes/script-loader.php.  To ensure jQuery loads before any jQuery-dependent scripts, you just use $script->add() and reference the jQuery library ID.  Easy as pie. Read the rest of this entry »

Share

PHP 5.2.11 released, fixing 75+ bugs

Yet another PHP 5.2.xx release took place a few days ago, which brought us over 75 bug fixes, some security-related.  If you are running any PHP 5.2.xx series release, make sure you apply this update.  Full details on the PHP 5.2.11 release can be viewed at PHP.net.  In addition, WHM/cPanel implemented this version of PHP in EasyApache, which updates smoothly.  Now, if they would only get to implementing 5.3 already… =) Read the rest of this entry »

Share

Passing parameters with Route in Zend Framework

When first approaching the Zend Framework, it almost appears that in order to get URLs like /controllername/page1 or /controllername/page2 (equivalent to /controllername/?varname=page1 w/o ZF) with their preconceived directory structure, you have to create a new action for each new page in order to serve the page.  This would ultimately mean a new function for every single page within that controller; however, with Zend_Controller_Front and Zend_Controller_Router_Route, we can avoid this and pass page1, page2, and any other string as variables. Read the rest of this entry »

Share