Skip to content

Commit 7684e4c

Browse files
author
Tom Hanoldt
committed
make it static
1 parent 7c7e65f commit 7684e4c

File tree

1 file changed

+9
-14
lines changed

1 file changed

+9
-14
lines changed

admin/Dashboard.php

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,31 +3,29 @@
33
namespace cw\wp\admin;
44

55
class Dashboard{
6-
public function addMainWidget($id, $name, $callback, $priotirty='core'){
7-
return $this->addWidget($id, $name, $callback, 'normal', $priotirty);
6+
public static function addMainWidget($id, $name, $callback, $priotirty='core'){
7+
self::addWidget($id, $name, $callback, 'normal', $priotirty);
88
}
99

10-
public function addSideWidget($id, $name, $callback, $priotirty='core'){
11-
return $this->addWidget($id, $name, $callback, 'side', $priotirty);
10+
public static function addSideWidget($id, $name, $callback, $priotirty='core'){
11+
self::addWidget($id, $name, $callback, 'side', $priotirty);
1212
}
1313

14-
public function addWidget($id, $name, $callback, $where='normal', $priotirty='core'){
14+
public static function addWidget($id, $name, $callback, $where='normal', $priotirty='core'){
1515
add_action('wp_dashboard_setup', function() use($id, $name, $callback, $where, $priotirty){
1616
add_meta_box($id, $name, $callback, 'dashboard', $where, $priotirty);
1717
}, 1000);
18-
return $this;
1918
}
2019

21-
public function removeWidgets(){
20+
public static function removeWidgets(){
2221
add_action('wp_dashboard_setup', function(){
2322
global $wp_meta_boxes;
2423
$wp_meta_boxes['dashboard']['side'] = ['core' => []];
2524
$wp_meta_boxes['dashboard']['normal'] = ['core' => []];
2625
}, 1000);
27-
return $this;
2826
}
2927

30-
public function replaceWelcomePanel($input){
28+
public static function replaceWelcomePanel($input){
3129
add_action( 'admin_footer', function() use($input){
3230
if(is_callable($input))
3331
$input = $input();
@@ -37,10 +35,9 @@ public function replaceWelcomePanel($input){
3735

3836
echo '<script>(function($){$("#welcome-panel").html("'.$input.'");})(jQuery);</script>';
3937
}, 1000);
40-
return $this;
4138
}
4239

43-
public function appendToWelcomePanel($input){
40+
public static function appendToWelcomePanel($input){
4441
add_action( 'admin_footer', function() use($input){
4542
if(is_callable($input))
4643
$input = $input();
@@ -50,13 +47,11 @@ public function appendToWelcomePanel($input){
5047

5148
echo '<script>(function($){$("#welcome-panel").append("'.$input.'");})(jQuery);</script>';
5249
}, 1000);
53-
return $this;
5450
}
5551

56-
public function hideWidgetArea(){
52+
public static function hideWidgetArea(){
5753
add_action( 'admin_footer', function(){
5854
echo '<script>(function($){$("#dashboard-widgets-wrap").html("");})(jQuery);</script>';
5955
}, 101 );
60-
return $this;
6156
}
6257
}

0 commit comments

Comments
 (0)