-
Notifications
You must be signed in to change notification settings - Fork 0
/
welcomewp.php
144 lines (129 loc) · 3.44 KB
/
welcomewp.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
<?php
/**
* Plugin Name: WelcomeWP
* Description: A simple WordPress plugin to create welcome messages.
* Author: Taras Dashkevych
* Author URI: https://tarascodes.com
* Version: 1.0.4
* Text Domain: welcomewp
* Domain Path: languages
*
* WelcomeWP 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
* any later version.
*
* WelcomeWP 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.
*
* GNU General Public License: <http://www.gnu.org/licenses/>.
*
* @package WelcomeWP
* @author Taras Dashkevych
* @since 1.0.0
* @license GPL-2.0+
*/
/* Exit if accessed directly. */
if ( ! defined( 'ABSPATH' ) ) {
return;
}
if ( ! class_exists( 'WelcomeWP' ) ) :
/**
* Main WelcomeWP class.
*
* @since 1.0.0
* @package WelcomeWP
*/
final class WelcomeWP {
/**
* The one true WelcomeWP.
*
* @since 1.0.0
* @var object
*/
private static $instance;
/**
* Plugin version for enqueueing, etc.
*
* @since 1.0.0
* @var sting
*/
public $version = '1.0.3';
/**
* Main WelcomeWP Instance.
*
* Insures that only one instance of WelcomeWP exists in memory at any one
* time. Also prevents needing to define globals all over the place.
*
* @since 1.0.0
* @return WelcomeWP
*/
public static function instance() {
if ( ! isset( self::$instance ) && ! ( self::$instance instanceof WelcomeWP ) ) {
self::$instance = new WelcomeWP();
self::$instance->constants();
self::$instance->load_textdomain();
self::$instance->includes();
$pointerplus = new PointerPlus( array( 'prefix' => 'welcomewp' ) );
$dashboard = new WelcomeWP_Dashboard();
$greeter = new WelcomeWP_Greeter( $dashboard );
}
return self::$instance;
}
/**
* Setup plugin constants.
*
* @since 1.0.0
*/
private function constants() {
// Plugin version
if ( ! defined( 'WELCOMEWP_VERSION' ) ) {
define( 'WELCOMEWP_VERSION', $this->version );
}
// Plugin Folder Path
if ( ! defined( 'WELCOMEWP_PLUGIN_DIR' ) ) {
define( 'WELCOMEWP_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
}
// Plugin Folder URL
if ( ! defined( 'WELCOMEWP_PLUGIN_URL' ) ) {
define( 'WELCOMEWP_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
}
// Plugin Root File
if ( ! defined( 'WELCOMEWP_PLUGIN_FILE' ) ) {
define( 'WELCOMEWP_PLUGIN_FILE', __FILE__ );
}
}
/**
* Loads the plugin language files.
*
* @since 1.0.0
*/
public function load_textdomain() {
load_plugin_textdomain( 'welcomewp', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
}
/**
* Include files.
*
* @since 1.0.0
*/
private function includes() {
// Global includes.
require_once WELCOMEWP_PLUGIN_DIR . 'includes/class-pointerplus.php';
require_once WELCOMEWP_PLUGIN_DIR . 'includes/class-dashboard.php';
require_once WELCOMEWP_PLUGIN_DIR . 'includes/class-message.php';
require_once WELCOMEWP_PLUGIN_DIR . 'includes/class-greeter.php';
}
}
endif;
/**
* The function which returns the one WelcomeWP instance.
*
* @since 1.0.0
* @return object
*/
function welcomewp() {
return WelcomeWP::instance();
}
welcomewp();