-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdopress.php
154 lines (114 loc) · 2.79 KB
/
dopress.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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
<?php
/**
* Plugin Name: DoPress
* Plugin URI : https://github.com/dwainm/dopress
* Description: Run your own todo list. DoPress is an elegant to do list app built on top of WordPress.
* It will take the page you choose and turn it into your a todo list. The list items are
* stored for per user.
* Author: dwainm
* Requires at least: 3.8
* Author URI: http://dwainm.com
* License: GPLv2
*/
if( ! defined('ABSPATH') ){ exit; } // exit if this file is accessed directly
if( !class_exists('DoPress') ){
final class DoPress{
/*
* Protected varialbe to hold reference to
* self intatance
* since 2.0
*/
protected static $_instance = null;
/**
* Public variables for this plugin
* @var $_PATH
*/
protected $_PATH;
/**
* private hoding class for the settings object
*
* @var $_PATH
*/
protected $settings;
/*
*
*/
protected $_URL;
/**
* Plubic instance creation class
* self intatance
* @since: 2.0
*/
public static function instance(){
if( is_null( self::$_instance ) ){
self::$_instance = new self();
}
return self::$_instance;
}
/**
* The DoPress Class constructor
* @since 2.0.0
* @author @dwainm
* @todo regist 'dopress' text domain
*/
public function __construct(){
register_activation_hook( __FILE__ , array( $this, 'activate' ) );
// include plugin files
$this->includes();
// seutp admin menu's
$this->post_type = new dp_cpt_item();
$this->settings = new dp_admin_settings();
register_deactivation_hook( __FILE__ , array( $this, 'deactivate' ) );
}
/**
* @author Dwain Maralack
* @since
* setup plugin path and URL
*/
// helper function to reference this plugins directory
private function path_url_initialize (){
// assing to global internal variables
$_PATH = plugin_dir_path( __FILE__);
$_URL = plugins_url( '', __FILE__);
}
/**
* included the files neeeded
*
* @since 2.0.0
*/
private function includes(){
require_once('includes/admin/class-dp-cpt-todo.php');
require_once('includes/admin/class-dp-admin-settings.php');
}
/**
* Register the activation hook needed to setup the plugin
* @access public
* @author dwainm
* @since 2.0
*/
public function activate(){
// initialize default settings
// delete data when deactivate
//
}
/**
* Register the de-activation hook
* @access public
* @author dwainm
* @since 2.0
*/
public function deactivate(){
//ad any activation stuff here
}
}// end class DoPress
} // end if class exists
/*
* Load public reference to DoPress
* after checking that it exists
*/
function DoPress(){
return DoPress::instance();
}
// set globals for access via the old method
$GLOBALS['DoPress'] = DoPress();
// setup wordpress hooks