WPSEO_Advanced_Settings

Class containing methods for WPSEO Advanced Settings.

Defined (1)

The class is defined in the following location(s).

/inc/class-wpseo-advanced-settings.php  
  1. class WPSEO_Advanced_Settings { 
  2.  
  3. /** 
  4. * @var array The default advanced pages. 
  5. */ 
  6. private static $default_advanced_pages = array( 
  7. 'wpseo_titles',  
  8. 'wpseo_social',  
  9. 'wpseo_xml',  
  10. 'wpseo_advanced',  
  11. 'wpseo_tools',  
  12. ); 
  13.  
  14. /** 
  15. * @var array Additional advanced settings pages. 
  16. */ 
  17. private static $additional_advanced_pages = array(); 
  18.  
  19. /** 
  20. * Gets the list of default advanced pages. 
  21. * @return array The default advanced pages. 
  22. */ 
  23. public static function get_advanced_pages() { 
  24. return self::$default_advanced_pages; 
  25.  
  26. /** 
  27. * Adds a page as an advanced settings page if it isn't already present or a default page. 
  28. * @param string $page The page to add. 
  29. * @returns void 
  30. */ 
  31. public static function add_advanced_page( $page ) { 
  32. if ( ! in_array( $page, self::$default_advanced_pages ) && ! in_array( $page, self::$additional_advanced_pages ) ) { 
  33. self::$additional_advanced_pages[] = $page; 
  34.  
  35. /** 
  36. * Checks if the current page is a Yoast SEO advanced settings page. 
  37. * @param string $page The page to check. 
  38. * @return bool Whether or not the page is considered an advanced settings page. 
  39. */ 
  40. public static function is_advanced_settings_page( $page ) { 
  41. if ( is_string( $page ) ) { 
  42. return in_array( $page, self::$default_advanced_pages ) || in_array( $page, self::$additional_advanced_pages ); 
  43.  
  44. return false;