class-link-utils.php 903 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. /**
  3. * WPSEO plugin file.
  4. *
  5. * @package WPSEO\Admin\Links
  6. */
  7. /**
  8. * Represents the utils for the links module.
  9. */
  10. class WPSEO_Link_Utils {
  11. /**
  12. * Returns all the supported public post types.
  13. *
  14. * @return array The supported public post types.
  15. */
  16. public static function get_public_post_types() {
  17. _deprecated_function( __METHOD__, '5.9', 'WPSEO_Post_Type::get_accessible_post_types' );
  18. return WPSEO_Post_Type::filter_attachment_post_type( WPSEO_Post_Type::get_accessible_post_types() );
  19. }
  20. /**
  21. * Returns the value that is part of the given url.
  22. *
  23. * @param string $url The url to parse.
  24. * @param string $part The url part to use.
  25. *
  26. * @return string The value of the url part.
  27. */
  28. public static function get_url_part( $url, $part ) {
  29. $url_parts = wp_parse_url( $url );
  30. if ( isset( $url_parts[ $part ] ) ) {
  31. return $url_parts[ $part ];
  32. }
  33. return '';
  34. }
  35. }