taxonomies.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. /**
  3. * WPSEO plugin file.
  4. *
  5. * @package WPSEO\Admin\Views
  6. */
  7. if ( ! defined( 'WPSEO_VERSION' ) ) {
  8. header( 'Status: 403 Forbidden' );
  9. header( 'HTTP/1.1 403 Forbidden' );
  10. exit();
  11. }
  12. $wpseo_taxonomies = get_taxonomies( array( 'public' => true ), 'objects' );
  13. if ( is_array( $wpseo_taxonomies ) && $wpseo_taxonomies !== array() ) {
  14. $view_utils = new Yoast_View_Utils();
  15. $recommended_replace_vars = new WPSEO_Admin_Recommended_Replace_Vars();
  16. $editor_specific_replace_vars = new WPSEO_Admin_Editor_Specific_Replace_Vars();
  17. // Explicitly hide all the core taxonomies we never want to do stuff for.
  18. $wpseo_taxonomies = array_diff_key( $wpseo_taxonomies, array_flip( array( 'link_category', 'nav_menu' ) ) );
  19. foreach ( array_values( $wpseo_taxonomies ) as $wpseo_taxonomy_index => $wpseo_taxonomy ) {
  20. $wpseo_taxonomy_presenter = new WPSEO_Paper_Presenter(
  21. $wpseo_taxonomy->labels->name,
  22. dirname( __FILE__ ) . '/paper-content/taxonomy-content.php',
  23. array(
  24. 'collapsible' => true,
  25. 'expanded' => ( $wpseo_taxonomy_index === 0 ),
  26. 'paper_id' => $wpseo_taxonomy->name,
  27. 'view_data' => array(
  28. 'wpseo_taxonomy' => $wpseo_taxonomy,
  29. 'view_utils' => $view_utils,
  30. 'recommended_replace_vars' => $recommended_replace_vars,
  31. 'editor_specific_replace_vars' => $editor_specific_replace_vars,
  32. ),
  33. 'title_after' => ' (<code>' . esc_html( $wpseo_taxonomy->name ) . '</code>)',
  34. )
  35. );
  36. echo $wpseo_taxonomy_presenter->get_output();
  37. }
  38. unset( $wpseo_taxonomy_index, $wpseo_taxonomy_presenter, $view_utils, $recommended_replace_vars );
  39. }
  40. unset( $wpseo_taxonomies );
  41. printf( '<h2>%s</h2>', esc_html__( ' Category URLs', 'wordpress-seo' ) );
  42. require dirname( __FILE__ ) . '/taxonomies/category-url.php';