forked from fyaconiello/wp_plugin_template-DEPRECATED-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwp_plugin_template.php
87 lines (76 loc) · 2.69 KB
/
wp_plugin_template.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<?php
/*
Plugin Name: WP Plugin Template
Plugin URI: https://github.com/fyaconiello/wp_plugin_template
Description: A simple wordpress plugin template
Version: 1.0
Author: Francis Yaconiello
Author URI: http://www.yaconiello.com
License: GPL2
*/
/*
Copyright 2012 Francis Yaconiello (email : [email protected])
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2, as
published by the Free Software Foundation.
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.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
if(!class_exists('WP_Plugin_Template'))
{
class WP_Plugin_Template
{
/**
* Construct the plugin object
*/
public function __construct()
{
// Initialize Settings
require_once(sprintf("%s/settings.php", dirname(__FILE__)));
$WP_Plugin_Template_Settings = new WP_Plugin_Template_Settings();
// Register custom post types
require_once(sprintf("%s/post-types/post_type_template.php", dirname(__FILE__)));
$Post_Type_Template = new Post_Type_Template();
} // END public function __construct
/**
* Activate the plugin
*/
public static function activate()
{
// Do nothing
} // END public static function activate
/**
* Deactivate the plugin
*/
public static function deactivate()
{
// Do nothing
} // END public static function deactivate
} // END class WP_Plugin_Template
} // END if(!class_exists('WP_Plugin_Template'))
if(class_exists('WP_Plugin_Template'))
{
// Installation and uninstallation hooks
register_activation_hook(__FILE__, array('WP_Plugin_Template', 'activate'));
register_deactivation_hook(__FILE__, array('WP_Plugin_Template', 'deactivate'));
// instantiate the plugin class
$wp_plugin_template = new WP_Plugin_Template();
// Add a link to the settings page onto the plugin page
if(isset($wp_plugin_template))
{
// Add the settings link to the plugins page
function plugin_settings_link($links)
{
$settings_link = '<a href="options-general.php?page=wp_plugin_template">Settings</a>';
array_unshift($links, $settings_link);
return $links;
}
$plugin = plugin_basename(__FILE__);
add_filter("plugin_action_links_$plugin", 'plugin_settings_link');
}
}