OneClick Framework
What is it?
It’s a framework to allow your plugins and themes to update themselves to the latest versions, so the users are never using the old version. It is just a port from the source code of the OneClick plugin, which featured the ability to instantly upgrade itself.
How do I use it.
Here are the steps you need to take to use the OneClick Framework:
- Download the zip files, and extract into the folder of your plugin/theme, as shown in these screenshots.

- in your php code, first set the three environment variables
Code (php)
-
require(‘framework.php’);
-
//using framework for a plugin
-
//create a new updater object
-
$updater=new ocframework();
-
//set the versionpath, pointing to a remote textfile containing only the latest version
-
$updater->versionpath=‘http://10.111.10.100/myplugin.txt’;
-
//set the current version of the plugin.
-
$updater->version=‘0.1′;
-
//set the path of the zip file to be downloaded
-
$updater->downloadpath=‘http://10.111.10.100/myplugin.zip’;
-
if($updater->checkForUpdate())//this returns a boolean value wether an update is available
-
{
-
$updater->update();
-
}
Essentially you’re creating a new object, and setting the file where it has to look for the latest version, and the path from which it has to download the zip file.
- Requirements for the zip file:
It should be uploaded on a stable remote server with a good uptime. Also the files must have a directory with *the same name* as the plugin. So, for myplugin, the screenshot would look like:
- That’s it! You still have to build your plugin or theme though.
How does it work?
It works by unzipping the contents of the remote zip file in the parent directory. so it will unzip the contents of myplugin in /wp-content/plugins/, thus effectively replacing the old version of the folder.
Suggestions:
- Be sure to ask the user before updating the theme. The function checkForUpdate returns a boolean value wether an update is available.
- Checking for an update takes up significant amount of resources and time. You might want to incorporate checking for an update everyday or something like that.
- Please don’t update without the user’s consent. Especially for themes. If the user has made modifications to the theme source code, it will be lost.
- All settings will be preserved for plugins and themes. You don’t need to reactivate the plugin after it’s updated.
- The next version has a feature where it can email the user that an update is available, and they can confirm and plugin/theme is updated.
- This framework was written in the span of two hours and hasn’t been extensively tested. It’s in beta right now. If you find a bug, email me. Check back for a stable release soon. Unfortunately the framework doesn’t update itself
Where can I get support for this?
If you have any question, leave a comment here and I’ll try getting back to you. In case you find a bug, have a feature suggestion, or want to help out with the code, send an email to anirudh at anirudhsanjeev dot org
Who are you?
I am Anirudh. I also happened to write the OneClick plugin for wordpress. This has been downloaded over 12000 times. This website is part of my new project, where I write articles on usability and interface design. It’s still under construction, as you can see.
Important:
I just found a minor bug that could’ve deleted your wp-admin folder(not a good thing). Now what you have to do is just add one more line to your code before checking for an update.
If you’re using it for a plugin, then add $updater->targetdir=”../wp-content/plugins/”; near the other environment variables
If you’re using it for a theme, then add $updater->targetdir=”../wp-content/themes/”; near the other environment variables
Download
Download the file: ocframework.zip (version 0.1)
Suggested Reading
- Popular post 2
- Popular post 2
- Popular post 2
- Popular post 2
- Popular post 2
- Popular post 2
- Popular post 2
- Popular post 2
- Popular post 1
- Popular post 1
- Popular post 1
- Popular post 1
- Popular post 1
- Popular post 1
- Popular post 1
- Popular post 1

October 4th, 2007 at 2:53 pm
test comment
October 8th, 2007 at 4:36 am
[…] One-click Framework allows your plugins and themes to update themselves to the latest versions, so the users are never using the old version. […]
October 9th, 2007 at 1:15 pm
[…] One-click Framework allows your plugins and themes to update themselves to the latest versions, so the users are never using the old version. […]
October 11th, 2007 at 12:45 pm
[…] One-click Framework allows your plugins and themes to update themselves to the latest versions, so the users are never using the old version. […]
October 11th, 2007 at 5:30 pm
[…] OneClick Framework | Daily Usability […]
October 11th, 2007 at 7:21 pm
[…] One-click Framework?????????????????????????????????? […]
October 11th, 2007 at 8:12 pm
[…] OneClick Framework | Daily Usability […]
October 12th, 2007 at 6:18 am
[…] OneClick Framework | Daily Usability […]
October 29th, 2007 at 1:39 pm
[…] OneClick Framework | Daily Usability […]