Created
January 10, 2012 18:05
-
-
Save mattwiebe/1590277 to your computer and use it in GitHub Desktop.
A good starting place for a static class-based WordPress plugin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: A Plugin Name | |
Plugin URI: http://somadesign.ca/ | |
Description: Be descriptive. | |
Version: 0.1 | |
Author: Soma Design | |
Author URI: http://somadesign.ca/ | |
License: GPL v2 | |
*/ | |
/** | |
* Copyright (c) 2012 Soma Design. All rights reserved. | |
* | |
* Released under the GPL v2 license | |
* http://www.opensource.org/licenses/gpl-2.0.php | |
* | |
* This is an add-on for WordPress | |
* http://wordpress.org/ | |
* | |
* ********************************************************************** | |
* This program is free software; you can redistribute it and/or modify | |
* it under the terms of the GNU General Public License as published by | |
* the Free Software Foundation; either version 2 of the License, or | |
* (at your option) any later version. | |
* | |
* This program is distributed in the hope that it will be useful, | |
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
* GNU General Public License for more details. | |
* ********************************************************************** | |
*/ | |
register_activation_hook(__FILE__, array('PLUGIN_CLASS_NAME', 'activate') ); | |
register_deactivation_hook(__FILE__, array('PLUGIN_CLASS_NAME', 'deactivate') ); | |
class PLUGIN_CLASS_NAME { | |
/* VARS AND CONSTANTS */ | |
private static $url = ''; | |
private static $dir = ''; | |
/* INIT */ | |
public static function init() { | |
/* These are filtered so that plugins can optionally be moved into themes */ | |
self::$url = apply_filters( __CLASS__.'_url', plugins_url('/', __FILE__), __FILE__ ); | |
self::$dir = apply_filters( __CLASS__.'_dir', plugin_dir_path(__FILE__), __FILE__ ); | |
self::load(); | |
self::add_actions(); | |
self::add_filters(); | |
} | |
/** | |
* Load components/3rd-party libraries | |
*/ | |
protected static function load() { | |
} | |
protected static function add_actions() { | |
} | |
protected static function add_filters() { | |
} | |
/* DE/ACTIVATE */ | |
public static function activate() { | |
} | |
public static function deactivate() { | |
} | |
/* CALLBACKS */ | |
/* PUBLIC METHODS */ | |
/* INTERNAL METHODS */ | |
} | |
add_action( 'init', array('PLUGIN_CLASS_NAME', 'init') ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment