bootstrap.php
2 years ago
class-posts-list-page-notification.php
2 years ago
wp-posts-list.css
5 years ago
class-posts-list-page-notification.php
119 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Posts_List_Page_Notification file. |
| 4 | * Disable edit_post and delete_post capabilities for Posts Pages in WP-Admin and display a notification icon. |
| 5 | * |
| 6 | * @deprecated 13.7 Use Automattic\Jetpack\Masterbar\Posts_List_Page_Notification instead. |
| 7 | * |
| 8 | * @package Jetpack |
| 9 | */ |
| 10 | |
| 11 | namespace Automattic\Jetpack\Dashboard_Customizations; |
| 12 | |
| 13 | use Automattic\Jetpack\Masterbar\Posts_List_Page_Notification as Masterbar_Posts_List_Page_Notification; |
| 14 | |
| 15 | /** |
| 16 | * Class Posts_List_Page_Notification |
| 17 | * |
| 18 | * @package Automattic\Jetpack\Dashboard_Customizations |
| 19 | */ |
| 20 | class Posts_List_Page_Notification { |
| 21 | |
| 22 | /** |
| 23 | * Instance of \Automattic\Jetpack\Masterbar\Posts_List_Page_Notification |
| 24 | * Used for deprecation purposes. |
| 25 | * |
| 26 | * @var \Automattic\Jetpack\Masterbar\Posts_List_Page_Notification |
| 27 | */ |
| 28 | private $post_list_page_notification_wrapper; |
| 29 | |
| 30 | /** |
| 31 | * Posts_List_Page_Notification constructor. |
| 32 | * |
| 33 | * @deprecated 13.7 |
| 34 | * |
| 35 | * @param string $posts_page_id The Posts page configured in WordPress. |
| 36 | * @param string $show_on_front The show_on_front site option. |
| 37 | * @param string $page_on_front The page_on_front site_option. |
| 38 | */ |
| 39 | public function __construct( $posts_page_id, $show_on_front, $page_on_front ) { |
| 40 | _deprecated_function( __METHOD__, 'jetpack-13.7', 'Automattic\\Jetpack\\Masterbar\\Posts_List_Page_Notification::__construct' ); |
| 41 | $this->post_list_page_notification_wrapper = new Masterbar_Posts_List_Page_Notification( $posts_page_id, $show_on_front, $page_on_front ); |
| 42 | } |
| 43 | |
| 44 | /** |
| 45 | * Add in all hooks. |
| 46 | * |
| 47 | * @deprecated 13.7 |
| 48 | */ |
| 49 | public function init_actions() { |
| 50 | _deprecated_function( __METHOD__, 'jetpack-13.7', 'Automattic\\Jetpack\\Masterbar\\Posts_List_Page_Notification::init_actions' ); |
| 51 | $this->post_list_page_notification_wrapper->init_actions(); |
| 52 | } |
| 53 | |
| 54 | /** |
| 55 | * Creates instance. |
| 56 | * |
| 57 | * @deprecated 13.7 |
| 58 | * |
| 59 | * @return \Automattic\Jetpack\Masterbar\Posts_List_Page_Notification |
| 60 | */ |
| 61 | public static function init() { |
| 62 | _deprecated_function( __METHOD__, 'jetpack-13.7', 'Automattic\\Jetpack\\Masterbar\\Posts_List_Page_Notification::init' ); |
| 63 | return Masterbar_Posts_List_Page_Notification::init(); |
| 64 | } |
| 65 | |
| 66 | /** |
| 67 | * Disable editing and deleting for the page that is configured as a Posts Page. |
| 68 | * |
| 69 | * @deprecated 13.7 |
| 70 | * |
| 71 | * @param array $caps Array of capabilities. |
| 72 | * @param string $cap The current capability. |
| 73 | * @param string $user_id The user id. |
| 74 | * @param array $args Argument array. |
| 75 | * @return array |
| 76 | */ |
| 77 | public function disable_posts_page( $caps, $cap, $user_id, $args ) { |
| 78 | _deprecated_function( __METHOD__, 'jetpack-13.7', 'Automattic\\Jetpack\\Masterbar\\Posts_List_Page_Notification::disable_posts_page' ); |
| 79 | return $this->post_list_page_notification_wrapper->disable_posts_page( $caps, $cap, $user_id, $args ); |
| 80 | } |
| 81 | |
| 82 | /** |
| 83 | * Load the CSS for the WP Posts List |
| 84 | * |
| 85 | * @deprecated 13.7 |
| 86 | * |
| 87 | * We would probably need to move this elsewhere when new features are introduced to wp-posts-list. |
| 88 | */ |
| 89 | public function enqueue_css() { |
| 90 | _deprecated_function( __METHOD__, 'jetpack-13.7', 'Automattic\\Jetpack\\Masterbar\\Posts_List_Page_Notification::enqueue_css' ); |
| 91 | $this->post_list_page_notification_wrapper->enqueue_css(); |
| 92 | } |
| 93 | |
| 94 | /** |
| 95 | * Adds a CSS class on the page configured as a Posts Page. |
| 96 | * |
| 97 | * @deprecated 13.7 |
| 98 | * |
| 99 | * @param array $classes A list of CSS classes. |
| 100 | * @param string $class A CSS class. |
| 101 | * @param string $post_id The current post id. |
| 102 | * @return array |
| 103 | */ |
| 104 | public function add_posts_page_css_class( $classes, $class, $post_id ) { |
| 105 | _deprecated_function( __METHOD__, 'jetpack-13.7', 'Automattic\\Jetpack\\Masterbar\\Posts_List_Page_Notification::add_posts_page_css_class' ); |
| 106 | return $this->post_list_page_notification_wrapper->add_posts_page_css_class( $classes, $class, $post_id ); |
| 107 | } |
| 108 | |
| 109 | /** |
| 110 | * Add a info icon on the Posts Page letting the user know why they cannot delete and remove the page. |
| 111 | * |
| 112 | * @deprecated 13.7 |
| 113 | */ |
| 114 | public function add_notification_icon() { |
| 115 | _deprecated_function( __METHOD__, 'jetpack-13.7', 'Automattic\\Jetpack\\Masterbar\\Posts_List_Page_Notification::add_notification_icon' ); |
| 116 | $this->post_list_page_notification_wrapper->add_notification_icon(); |
| 117 | } |
| 118 | } |
| 119 |