Plugin Directory

Object Oriented Plugin Template Solution

A well engineered template for creating plugins using object-oriented programming practices. Uses Settings API, multisite, i18n, PHPUnit tests.

  1. Download the zip file from WordPress' plugin site: http://wordpress.org/extend/plugins/oop-plugin-template-solution/

  2. Unzip the file

  3. 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
    
  4. Now get down to making the plugin do what you want. See the FAQ for instructions about particular aspects.

  5. Upload your plugin directory to your server's /wp-content/plugins/ directory

  6. Activate the plugin using WordPress' admin interface:

    • Regular sites: Plugins
    • Sites using multisite networks: My Sites | Network Admin | Plugins

Removal

  1. 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.

  2. Use WordPress' "Plugins" admin interface to click the "Deactivate" link

  3. Remove the plugins directory from the server

Requires: 3.3 or higher
Compatible up to: 3.5beta1
Last Updated: 2012-11-28
Downloads: 741

Ratings

5 stars
5 out of 5 stars

Support

0 of 1 support threads in the last two months have been resolved.

Got something to say? Need help?

Compatibility

+
=
Not enough data

0 people say it works.
0 people say it's broken.

100,1,1 100,1,1 100,1,1 100,1,1