Posts Tagged ‘PHP’

PHP Global Object Code Completion

Any IDE worth using provides code completion suggestions as you type. For example, this is what Netbeans suggests when you type “wp_” inside a WordPress project. The problem with dynamically typed languages like PHP is that it can be difficult for the IDE to provide intelligent suggestions for variables that have been defined in the global scope. It’s possible to help your IDE be a little smarter by providing it with hints about the types of objects.

[More]

NetBeans FTP File Permissions Fix

I’ve been trying out NetBean’s “PHP Application from Remote Server” feature this weekend. The idea is that when you save a file, it uploads that file to a remote server where it can be run.

The problem I ran into is that when NetBeans uploads that file and overwrites the old version, the permissions on the file change. I did some searching and it sounds like NetBeans doesn’t set permissions on the file, which means it just takes the server default. This doesn’t make much sense (should keep permissions of previous file) and for me it meant that the permissions were set so low that I couldn’t run the PHP scripts I was uploading.

[More]

Plugin Release: Short Comment Filter

Today I’m releasing a new plugin: Short Comment Filter

It automatically spams or deletes comments that are too short.

You can view more information about the plugin and download it here.

Making Backward Compatible Themes

When creating WordPress themes, one problem I’ve faced is using template tags and other functions which aren’t implemented in older versions of WordPress. Of course the best solution is for people to upgrade their version of WordPress, but you can’t exactly force people to do this. If you want to use new functions, but want to support people with older versions of WordPress, there’s something you can do. As an example, let’s look at wp_page_menu().

[More]

Converting PHP Associative Arrays to Variables

EDIT: Nick Ohrn pointed out that a function exists for doing this automatically. The following post is still a valid look at how this could be implemented if the functionality didn’t already exist, but it is better to use extract because it is likely more efficient.

Associative arrays are one of my favorite PHP features. They’re simple to use and easy to understand. Sometimes though, being able to reference the values of associative arrays with variables can be more convenient. Today I’m going to share a simple way to convert an associative array to variables.

[More]

Creating Breadcrumb Navigation in WordPress

Bread Crumbs are something that’s been around for quite some time. I first remember seeing them in ANGEL when my dad was working for the company in 2005. Similar things can be found in File Browsers, and browser history is really a kind of bread crumb.

[More]