1 | <?php |
||
16 | class Posts_List_Page_Notification { |
||
17 | |||
18 | /** |
||
19 | * Site's Posts page id |
||
20 | * |
||
21 | * @var int|null |
||
22 | */ |
||
23 | private $posts_page_id; |
||
24 | |||
25 | /** |
||
26 | * If the Post_list contains the site's Posts Page |
||
27 | * |
||
28 | * @var bool |
||
29 | */ |
||
30 | private $is_page_in_list = false; |
||
31 | |||
32 | /** |
||
33 | * Class instance. |
||
34 | * |
||
35 | * @var Posts_List_Page_Notification|null |
||
36 | */ |
||
37 | private static $instance = null; |
||
38 | |||
39 | /** |
||
40 | * Posts_List_Page_Notification constructor. |
||
41 | * |
||
42 | * @param string $posts_page_id The Posts page configured in WordPress. |
||
43 | */ |
||
44 | public function __construct( $posts_page_id ) { |
||
49 | |||
50 | /** |
||
51 | * Add in all hooks. |
||
52 | */ |
||
53 | public function init_actions() { |
||
59 | |||
60 | /** |
||
61 | * Creates instance. |
||
62 | * |
||
63 | * @return Posts_List_Page_Notification |
||
64 | */ |
||
65 | public static function init() { |
||
72 | |||
73 | /** |
||
74 | * Disable editing and deleting for the page that is configured as a Posts Page. |
||
75 | * |
||
76 | * @param array $caps Array of capabilities. |
||
77 | * @param string $cap The current capability. |
||
78 | * @param string $user_id The user id. |
||
79 | * @param array $args Argument array. |
||
80 | * @return array |
||
81 | */ |
||
82 | public function disable_posts_page( $caps, $cap, $user_id, $args ) { |
||
93 | |||
94 | /** |
||
95 | * Load the CSS for the WP Posts List |
||
96 | * |
||
97 | * We would probably need to move this elsewhere when new features are introduced to wp-posts-list. |
||
98 | */ |
||
99 | public function enqueue_css() { |
||
102 | |||
103 | /** |
||
104 | * Adds a CSS class on the page configured as a Posts Page. |
||
105 | * |
||
106 | * @param array $classes A list of CSS classes. |
||
107 | * @param string $class A CSS class. |
||
108 | * @param string $post_id The current post id. |
||
109 | * @return array |
||
110 | */ |
||
111 | public function add_posts_page_css_class( $classes, $class, $post_id ) { |
||
122 | |||
123 | /** |
||
124 | * Add a info icon on the Posts Page letting the user know why they cannot delete and remove the page. |
||
125 | */ |
||
126 | public function add_notification_icon() { |
||
140 | } |
||
141 |