/** * Get the post types that are associated with TEC. * * @return array The post types associated with this plugin */ public static function getPostTypes() { return apply_filters('tribe_events_post_types', Tribe__Main::get_post_types()); }
/** * Matcher for administration pages that are from Tribe the easier way * * @param string|array|null $id What will be checked to see if we return true or false * * @return boolean */ public function is_screen($id = null) { global $current_screen; // Not in the admin we don't even care if (!is_admin()) { return false; } // Doing AJAX? bail. if (Tribe__Main::instance()->doing_ajax()) { return false; } // Avoid Notices by checking the object type of WP_Screen if (!$current_screen instanceof WP_Screen) { return false; } // Match any screen from Tribe if (is_null($id) && false !== strpos($current_screen->id, 'tribe')) { return true; } // Match any of the pages set if (!is_scalar($id) && in_array($current_screen->id, (array) $id)) { return true; } // Match a specific page if ($current_screen->id === $id) { return true; } // Match any post type page in the supported post types $defaults = apply_filters('tribe_is_post_type_screen_post_types', Tribe__Main::get_post_types()); if (!in_array($current_screen->post_type, $defaults)) { return false; } return false; }
/** * Run the caching functionality that is executed on save post. * * @param int $post_id The post_id. * @param WP_Post $post The current post object being saved. */ public function save_post($post_id, $post) { if (in_array($post->post_type, Tribe__Main::get_post_types())) { $this->cache->set_last_occurrence('save_post'); } }