ACF.php
5 years ago
BuddyPress.php
5 years ago
EventsCalendar.php
5 years ago
GravityForms.php
5 years ago
MetaBox.php
5 years ago
NinjaForms.php
5 years ago
Pods.php
5 years ago
Types.php
5 years ago
WooCommerce.php
5 years ago
YoastSeo.php
5 years ago
WooCommerce.php
52 lines
| 1 | <?php |
| 2 | |
| 3 | namespace AC\Integration; |
| 4 | |
| 5 | use AC\Integration; |
| 6 | use AC\ListScreen; |
| 7 | use AC\ListScreenPost; |
| 8 | use AC\Screen; |
| 9 | use AC\Type\Url\Site; |
| 10 | |
| 11 | final class WooCommerce extends Integration { |
| 12 | |
| 13 | public function __construct() { |
| 14 | parent::__construct( |
| 15 | 'ac-addon-woocommerce/ac-addon-woocommerce.php', |
| 16 | __( 'WooCommerce', 'codepress-admin-columns' ), |
| 17 | 'assets/images/addons/woocommerce.png', |
| 18 | __( 'Enhance the products, orders and coupons overviews with new columns and inline editing.', 'codepress-admin-columns' ), |
| 19 | null, |
| 20 | new Site( Site::PAGE_ADDON_WOOCOMMERCE ) |
| 21 | ); |
| 22 | } |
| 23 | |
| 24 | public function is_plugin_active() { |
| 25 | return class_exists( 'WooCommerce', false ); |
| 26 | } |
| 27 | |
| 28 | private function get_post_types() { |
| 29 | return [ |
| 30 | 'product', |
| 31 | 'shop_order', |
| 32 | 'shop_coupon', |
| 33 | ]; |
| 34 | } |
| 35 | |
| 36 | public function show_notice( Screen $screen ) { |
| 37 | $is_user_screen = 'users' === $screen->get_id(); |
| 38 | $is_post_screen = 'edit' === $screen->get_base() |
| 39 | && in_array( $screen->get_post_type(), $this->get_post_types() ); |
| 40 | |
| 41 | return $is_user_screen || $is_post_screen; |
| 42 | } |
| 43 | |
| 44 | public function show_placeholder( ListScreen $list_screen ) { |
| 45 | $is_user_screen = $list_screen instanceof ListScreen\User; |
| 46 | $is_post_screen = $list_screen instanceof ListScreenPost |
| 47 | && in_array( $list_screen->get_post_type(), $this->get_post_types() ); |
| 48 | |
| 49 | return $is_user_screen || $is_post_screen; |
| 50 | } |
| 51 | |
| 52 | } |