settings = $settings; } /** * Public, front-end viewable post types (attachments excluded). * * @return array */ public function post_types() { $types = array(); foreach ( get_post_types( array( 'public' => true ), 'objects' ) as $name => $object ) { if ( 'attachment' === $name || ! is_post_type_viewable( $object ) ) { continue; } $types[ $name ] = $object; } /** * Filters the post types Orbitstem SEO manages. * * @param array $types Post type objects keyed by name. */ return apply_filters( 'orbitstem_seo_post_types', $types ); } /** * Public, front-end viewable taxonomies (post formats excluded). * * @return array */ public function taxonomies() { $taxes = array(); foreach ( get_taxonomies( array( 'public' => true ), 'objects' ) as $name => $object ) { if ( 'post_format' === $name || ! is_taxonomy_viewable( $object ) ) { continue; } $taxes[ $name ] = $object; } /** * Filters the taxonomies Orbitstem SEO manages. * * @param array $taxes Taxonomy objects keyed by name. */ return apply_filters( 'orbitstem_seo_taxonomies', $taxes ); } /** * Whether a post type is managed. * * @param string $post_type Post type name. * @return bool */ public function supports_post_type( $post_type ) { return array_key_exists( $post_type, $this->post_types() ); } /** * Whether a taxonomy is managed. * * @param string $taxonomy Taxonomy name. * @return bool */ public function supports_taxonomy( $taxonomy ) { return array_key_exists( $taxonomy, $this->taxonomies() ); } /** * Post types present on the site that have no saved settings yet. * * @return string[] */ public function unconfigured_post_types() { $saved = (array) $this->settings->get( 'post_types' ); return array_values( array_diff( array_keys( $this->post_types() ), array_keys( $saved ) ) ); } /** * Taxonomies present on the site that have no saved settings yet. * * @return string[] */ public function unconfigured_taxonomies() { $saved = (array) $this->settings->get( 'taxonomies' ); return array_values( array_diff( array_keys( $this->taxonomies() ), array_keys( $saved ) ) ); } }