1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
// Exit if accessed directly |
4
|
|
|
if ( ! defined( 'ABSPATH' ) ) { |
5
|
|
|
exit; |
6
|
|
|
} |
7
|
|
|
|
8
|
|
|
if ( ! class_exists( 'WP_List_Table' ) ) { |
9
|
|
|
require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
10
|
|
|
} |
11
|
|
|
|
12
|
|
|
/** |
13
|
|
|
* Creates the Schedule List table for Post Promoter Pro |
14
|
|
|
*/ |
15
|
|
|
class PPP_Accounts_Table extends WP_List_Table { |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* Generate the Class from it's parent |
19
|
|
|
*/ |
20
|
|
|
public function __construct() { |
21
|
|
|
global $status, $page; |
22
|
|
|
|
23
|
|
|
parent::__construct( array( |
24
|
|
|
'singular' => __( 'Social Media Service', 'ppp-txt' ), |
25
|
|
|
'plural' => __( 'Social Media Services', 'ppp-txt' ), |
26
|
|
|
'ajax' => false, |
27
|
|
|
) ); |
28
|
|
|
} |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* What to show if no items are found |
32
|
|
|
* @return void |
33
|
|
|
*/ |
34
|
|
|
public function no_items() { |
35
|
|
|
_e( 'No Social Media Services Registered', 'ppp-txt' ); |
36
|
|
|
} |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* The Default columns |
40
|
|
|
* @param array $item The Item being displayed |
41
|
|
|
* @param string $column_name The column we're currently in |
42
|
|
|
* @return string The Content to display |
43
|
|
|
*/ |
44
|
|
|
public function column_default( $item, $column_name ) { |
45
|
|
|
return $item[ $column_name ]; |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* The columns for our list view |
50
|
|
|
* @return array Columns shown on the Schedule page |
51
|
|
|
*/ |
52
|
|
|
public function get_columns() { |
53
|
|
|
$columns = array( |
54
|
|
|
'icon' => '', |
55
|
|
|
'avatar' => __( 'Avatar', 'ppp-txt' ), |
56
|
|
|
'name' => __( 'Connected As', 'ppp-txt' ), |
57
|
|
|
'actions' => __( 'Actions', 'ppp-txt' ), |
58
|
|
|
'extras' => __( 'Additional Info', 'ppp-txt' ) |
59
|
|
|
); |
60
|
|
|
|
61
|
|
|
return $columns; |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* Prepare the data for the WP List Table |
66
|
|
|
* @return void |
67
|
|
|
*/ |
68
|
|
|
public function prepare_items() { |
69
|
|
|
$columns = $this->get_columns(); |
70
|
|
|
$hidden = array(); |
71
|
|
|
$data = array(); |
72
|
|
|
$sortable = false; |
73
|
|
|
$this->_column_headers = array( $columns, $hidden, $sortable ); |
74
|
|
|
|
75
|
|
|
$accounts = apply_filters( 'ppp_register_social_service', array() ); |
76
|
|
|
|
77
|
|
|
foreach ( $accounts as $account ) { |
78
|
|
|
$data[$account] = array( |
79
|
|
|
'icon' => apply_filters( 'ppp_account_list_icon-' . $account, '' ), |
80
|
|
|
'avatar' => apply_filters( 'ppp_account_list_avatar-' . $account, '' ), |
81
|
|
|
'name' => apply_filters( 'ppp_account_list_name-' . $account, '' ), |
82
|
|
|
'actions' => apply_filters( 'ppp_account_list_actions-' . $account, '' ), |
83
|
|
|
'extras' => apply_filters( 'ppp_account_list_extras-' . $account, '' ), |
84
|
|
|
); |
85
|
|
|
} |
86
|
|
|
|
87
|
|
|
$this->items = $data; |
88
|
|
|
} |
89
|
|
|
} |
90
|
|
|
|
91
|
|
|
$ppp_account_table = new PPP_Accounts_Table(); |
92
|
|
|
|