A well engineered template for creating plugins using object-oriented programming practices. Uses Settings API, multisite, i18n, PHPUnit tests.
Download the zip file from WordPress' plugin
site: http://wordpress.org/extend/plugins/oop-plugin-template-solution/
Unzip the file
Here are some semi-automated steps to copy this plugin and rename the files, class names, and identifiers. The commands are in Bash, adjust them as needed for your environment. Replace the three mentions of "My Plugin" in the settings section with the name of your plugin.
# Settings -----
# Plugin identifier / directory (hyphen separated).
old_id=oop-plugin-template-solution
new_id=my-plugin
# Class name (underscore separated).
old_class=oop_plugin_template_solution
new_class=my_plugin
# Plugin Name (space separated).
old_name="Object Oriented Plugin Template Solution"
new_name="My Plugin"
# --------------
# Copy and rename the files.
cp -R $old_id $new_id
cd $new_id
mv $old_id.php $new_id.php
# Replace strings in the files.
find . -type f -exec sed "s/$old_id/$new_id/g" -i {} \;
find . -type f -exec sed "s/$old_class/$new_class/g" -i {} \;
find . -type f -exec sed "s/$old_name/$new_name/g" -i {} \;
find . -type f -exec sed -E "s/^ \* (Author:|Author URI:|@author|@copyright) (.*)$/ * \1/g" -i {} \;
find . -type f -exec sed "s@REPLACE_PLUGIN_URI@http://wordpress.org/extend/plugins/oop-plugin-template-solution/@g" -i {} \;
sed -E "s/^(Contributors|Donate link|Tags): (.*)$/\1:/g" -i readme.txt
Now get down to making the plugin do what you want. See the FAQ for instructions about particular aspects.
Upload your plugin directory to your server's /wp-content/plugins/
directory
Activate the plugin using WordPress' admin interface:
This plugin offers the ability to remove all of this plugin's settings from your database. Go to WordPress' "Plugins" admin interface and click the "Settings" link for this plugin. In the "Deactivate" entry, click the "Yes, delete the damn data" button and save the form.
Use WordPress' "Plugins" admin interface to click the "Deactivate" link
Remove the plugins directory from the server
Requires: 3.3 or higher
Compatible up to: 3.5beta1
Last Updated: 2012-11-28
Downloads: 741
0 of 1 support threads in the last two months have been resolved.
Got something to say? Need help?