-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathliminal_membership.php
94 lines (60 loc) · 2.17 KB
/
liminal_membership.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
88
89
90
91
92
93
94
<?php
/*
Plugin Name: Tech Liminal Community
Plugin URI: https://github.com/techliminal/Liminal-Community
Description: A plugin for managing the Tech Liminal Community
Author: Anca Mosoiu
Author URI: http://www.techliminal.com/
Version: 0.1
License: GNU General Public License v2.0 (or later)
License URI: http://www.opensource.org/licenses/gpl-license.php
*/
/**
* The Plugin class handles activation, deactivation, and
* loading the different components.
*/
class TLCommunityPlugin{
public $settings_field = 'techliminal_community';
public $admin_page = 'techliminal_community';
/** Constructor */
function __construct() {
register_activation_hook( __FILE__, array( $this, 'activation_hook' ) );
register_deactivation_hook( __FILE__, array( $this, 'deactivation_hook' ) );
add_action( 'admin_init', array( $this, 'javascript' ) );
add_action( 'admin_init', array( $this, 'register_settings' ) );
add_action( 'admin_menu', array( $this, 'add_menu' ), 15 );
add_action( 'admin_notices', array( $this, 'notices' ) );
}
function activation_hook() {
//nothing to see here
}
function deactivation_hook() {
// nothing to see here.
}
function javascript() {
//wp_enqueue_script( 'tl-community-js', plugin_dir_url(__FILE__) . 'js/admin.js', array( 'jquery' ), '', true );
}
function register_settings() {
register_setting( $this->settings_field, $this->settings_field );
add_option( $this->settings_field, $this->settings_defaults() );
}
function notices() {
if ( ! isset( $_REQUEST['page'] ) || $this->admin_page != $_REQUEST['page'] )
return;
if ( isset( $_REQUEST['updated'] ) && 'true' == $_REQUEST['updated'] ) {
echo '<div id="message" class="updated"><p><strong>' . __( 'Settings Saved', 'techliminal' ) . '</strong></p></div>';
}
}
function settings_defaults() {
return array(
'setting' => 'value'
);
}
function add_menu() {
add_menu_page('techliminal', __('Tech Liminal Community','techliminal'), 'manage_options', 'techliminal_community', array( &$this, 'admin_page' ) );
}
function admin_page() {
echo "Hello World";
}
}
$liminal_community = new TLCommunityPlugin;