-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdo-you-know.php
109 lines (96 loc) · 2.27 KB
/
do-you-know.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
<?php
/**
* Plugin Name: Do You Know Widget
* Plugin URI: https://wordpress.org/plugins/do-you-know-widget/
* Description: Adds a widget with a user recognition game.
* Version: 1.0.1
* Author: Konnektiv
* Author URI: http://konnektiv.de/
* License: GNU AGPL (licence.txt)
* Text Domain: do-you-know-widget
*/
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
class DoYouKnowPlugin {
/**
*
*
* @var DoYouKnowPlugin
*/
private static $instance;
/**
* Main DoYouKnowPlugin Instance
*
* Insures that only one instance of DoYouKnowPlugin exists in memory at
* any one time. Also prevents needing to define globals all over the place.
*
* @since DoYouKnowPlugin (1.0.0)
*
* @staticvar array $instance
*
* @return DoYouKnowPlugin
*/
public static function instance() {
if ( ! isset( self::$instance ) ) {
self::$instance = new DoYouKnowPlugin;
self::$instance->setup_globals();
self::$instance->includes();
self::$instance->setup_filters();
self::$instance->setup_actions();
}
return self::$instance;
}
/**
* A dummy constructor to prevent loading more than one instance
*
* @since DoYouKnowPlugin (1.0.0)
*/
private function __construct() { /* Do nothing here */
}
/**
* Component global variables
*
* @since DoYouKnowPlugin (1.0.0)
* @access private
*
*/
private function setup_globals() {
load_plugin_textdomain( 'do-you-know-widget', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
}
/**
* Includes
*
* @since DoYouKnowPlugin (1.0.0)
* @access private
*/
private function includes() {
require_once 'do-you-know-widget-class.php';
require_once 'bp-member-with-avatar.php';
}
/**
* Setup the filters
*
* @since DoYouKnowPlugin (1.0.0)
* @access private
*
* @uses remove_filter() To remove various filters
* @uses add_filter() To add various filters
*/
private function setup_filters() {
}
/**
* Setup the actions
*
* @since DoYouKnowPlugin (1.0.0)
* @access private
*
* @uses remove_action() To remove various actions
* @uses add_action() To add various actions
*/
private function setup_actions() {
add_action( 'widgets_init', create_function( '', 'return register_widget("DoYouKnow_widget");' ) );
}
}
DoYouKnowPlugin::instance();