class-menu.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <?php
  2. /**
  3. * WPSEO plugin file.
  4. *
  5. * @package WPSEO\Admin\Menu
  6. */
  7. /**
  8. * Registers the regular admin menu and network admin menu implementations.
  9. */
  10. class WPSEO_Menu implements WPSEO_WordPress_Integration {
  11. /** The page identifier used in WordPress to register the admin page !DO NOT CHANGE THIS! */
  12. const PAGE_IDENTIFIER = 'wpseo_dashboard';
  13. /** @var array List of classes that add admin functionality. */
  14. protected $admin_features;
  15. /**
  16. * Registers all hooks to WordPress.
  17. *
  18. * @return void
  19. */
  20. public function register_hooks() {
  21. $admin_menu = new WPSEO_Admin_Menu( $this );
  22. $admin_menu->register_hooks();
  23. if ( WPSEO_Utils::is_plugin_network_active() ) {
  24. $network_admin_menu = new WPSEO_Network_Admin_Menu( $this );
  25. $network_admin_menu->register_hooks();
  26. }
  27. $capability_normalizer = new WPSEO_Submenu_Capability_Normalize();
  28. $capability_normalizer->register_hooks();
  29. }
  30. /**
  31. * Returns the main menu page identifier.
  32. *
  33. * @return string Page identifier to use.
  34. */
  35. public function get_page_identifier() {
  36. return self::PAGE_IDENTIFIER;
  37. }
  38. /**
  39. * Loads the requested admin settings page.
  40. *
  41. * @return void
  42. */
  43. public function load_page() {
  44. $page = filter_input( INPUT_GET, 'page' );
  45. $this->show_page( $page );
  46. }
  47. /**
  48. * Shows an admin settings page.
  49. *
  50. * @param string $page Page to display.
  51. *
  52. * @return void
  53. */
  54. protected function show_page( $page ) {
  55. switch ( $page ) {
  56. case 'wpseo_tools':
  57. require_once WPSEO_PATH . 'admin/pages/tools.php';
  58. break;
  59. case 'wpseo_titles':
  60. require_once WPSEO_PATH . 'admin/pages/metas.php';
  61. break;
  62. case 'wpseo_social':
  63. require_once WPSEO_PATH . 'admin/pages/social.php';
  64. break;
  65. case 'wpseo_licenses':
  66. require_once WPSEO_PATH . 'admin/pages/licenses.php';
  67. break;
  68. case 'wpseo_files':
  69. require_once WPSEO_PATH . 'admin/views/tool-file-editor.php';
  70. break;
  71. case 'wpseo_configurator':
  72. require_once WPSEO_PATH . 'admin/config-ui/class-configuration-page.php';
  73. break;
  74. default:
  75. require_once WPSEO_PATH . 'admin/pages/dashboard.php';
  76. break;
  77. }
  78. }
  79. }