It’s been a while since the version 3.2.2 of Meta Box Script was released. I was working on this script for refactoring, making a good architect for it so that users and developers can easily use and customize it. The result of refactoring (which I call v4.0 beta) is put on GitHub. There’re many major changes in this version:
1. Make it a plugin
Although the script can work as a stand-alone package, making it a plugin can help it uses plugin advantages (such as functions to detect plugin’s path, URL). It also helps submitting the script to WordPress repository to make it’s easy to update (this is planned, and will be done after the v4.0 is completed).
2. Separating field functions (enqueue scripts and styles, add actions, show, save) into separated classes
Wrap all field things in one file can make us easy to have an overview of the structure, but it makes the process of optimizing, improving or fixing bugs more difficult. I decided to separate all these things into their own files to avoid those problems.
3. Use filters to let user change HTML of fields
As you know, in previous version the only way to change HTML markup of a field is overwrite it. That’s not a good approach, at least for end users, and it’s not the WordPress way! I decide to use filters to make it more easy to handle that thing.
4. Use filters to validate/change field values instead of validation class
For the same reason as #2, using filters to change/validate field values makes the process of validating more WP-friendly and easier. But I still haven’t found a way to show validate messages.
5. Don’t use Ajax on image upload as it’s buggy and complicated. Revert to default upload
While the image upload with Thickbox is good, it causes many problems of inserting images. So many many comments complaint about this. I also received some request that change the uploader back to normal upload, just for simplicity. So, in this version, I decide to drop Thickbox uploader (it’ll be dropped in WordPress 3.3 anyway).
6. Use local JS/CSS libs instead of remote files for better control if conflict occurs
Using jQuery UI at Google CDN is good, but not the best. We don’t use all the modules of jQuery UI, and the redundancy may make our script conflicts with others. Keep everything simple can help us detect the problems if they present.
There’re many works around this version: check (optimize) the code architect, fix bugs that have been reported, write documentations. And I really need your help! All you need is fork the project on GitHub, create patch and send pull requests.
There’re 3 things that you can help me on collaboration:
- Bug hunting: using the Issues of GitHub to report
- Code collaboration: using the pull request to send your patch
- Documentation: I’m not sure the Wiki on GitHub helps
Not only me, but hundreds of users appreciate your help! So, let’s do the great work now.