-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
71 lines (64 loc) · 1.85 KB
/
index.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
<?php
if(!class_exists('FollowBMCPluginOptions')) :
// DEFINE PLUGIN ID
define('FOLLOWBMCPLUGINOPTIONS_ID', 'followbmc-plugin-options');
// DEFINE PLUGIN NICK
define('FOLLOWBMCPLUGINOPTIONS_NICK', 'Follow Button for Mailchimp');
class FollowBMCPluginOptions
{
/** function/method
* Usage: return absolute file path
* Arg(1): string
* Return: string
*/
public static function file_path($file)
{
return ABSPATH.'wp-content/plugins/'.str_replace(basename( __FILE__),"",plugin_basename(__FILE__)).$file;
}
/** function/method
* Usage: hooking the plugin options/settings
* Arg(0): null
* Return: void
*/
public static function register()
{
register_setting(FOLLOWBMCPLUGINOPTIONS_ID.'_options', 'followbmc_url');
}
/** function/method
* Usage: hooking (registering) the plugin menu
* Arg(0): null
* Return: void
*/
public static function menu()
{
// Create menu tab
add_options_page(FOLLOWBMCPLUGINOPTIONS_NICK.' Plugin Options', FOLLOWBMCPLUGINOPTIONS_NICK, 'manage_options', FOLLOWBMCPLUGINOPTIONS_ID.'_options', array('FollowBMCPluginOptions', 'options_page'));
}
/** function/method
* Usage: show options/settings form page
* Arg(0): null
* Return: void
*/
public static function options_page()
{
if (!current_user_can('manage_options'))
{
wp_die( __('You do not have sufficient permissions to access this page.') );
}
$plugin_id = FOLLOWBMCPLUGINOPTIONS_ID;
// display options page
include(self::file_path('options.php'));
}
/** function/method
* Usage: filtering the content
* Arg(1): string
* Return: string
*/
}
if ( is_admin() )
{
add_action('admin_init', array('FollowBMCPluginOptions', 'register'));
add_action('admin_menu', array('FollowBMCPluginOptions', 'menu'));
}
endif;
?>