WPDK
1.5.0
WordPress Development Kit
Main Page
Related Pages
Data Structures
Files
File List
Globals
All
Data Structures
Files
Functions
Variables
Pages
wpdk-wordpress-admin.php
Go to the documentation of this file.
1
<?php
19
class
WPDKWordPressAdmin
extends
WPDKObject
{
20
28
public
$__version
=
'0.9.0'
;
29
37
public
$bodyClasses
;
38
46
public
$plugin
;
47
57
public
function
__construct
(
WPDKWordPressPlugin
$plugin
)
58
{
59
// Save plugin
60
$this->plugin =
$plugin
;
61
62
// Admin page is loaded
63
if
( is_multisite() ) {
64
add_action(
'network_admin_menu'
, array( $this,
'admin_menu'
) );
65
}
66
else
{
67
// Let's add menu at last
68
add_action(
'admin_menu'
, array( $this,
'admin_menu'
), 99 );
69
}
70
71
// Register this plugin in body.
72
add_filter(
'admin_body_class'
, array( $this,
'admin_body_class'
) );
73
74
// Loading Script & style for backend
75
add_action(
'admin_enqueue_scripts'
, array( $this,
'wp_pointer'
) );
76
add_action(
'admin_enqueue_scripts'
, array( $this,
'admin_enqueue_scripts'
) );
77
78
}
79
85
public
function
wp_pointer
()
86
{
87
// WordPress Pointer
88
wp_enqueue_style(
'wp-pointer'
);
89
wp_enqueue_script(
'wp-pointer'
);
90
}
91
101
public
function
admin_body_class
( $classes )
102
{
103
if
( !empty( $this->bodyClasses ) ) {
104
$stack = array();
105
foreach
( $this->bodyClasses as $key => $enabled ) {
106
if
(
true
== $enabled ) {
107
$stack[] = $key;
108
}
109
}
110
$classes .=
' '
. join(
' '
, $stack );
111
}
112
return
$classes;
113
}
114
115
// -------------------------------------------------------------------------------------------------------------------
116
// Methods to override
117
// -------------------------------------------------------------------------------------------------------------------
118
124
public
function
admin_menu
()
125
{
126
/* Override. */
127
}
128
136
public
function
admin_enqueue_scripts
( $hook_suffix )
137
{
138
/* Override */
139
}
140
141
}