Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.x #2767 Optimize URLHelper methods is_local and is_external #2782

Merged
merged 14 commits into from
Jul 28, 2023

Commits on Jun 8, 2023

  1. Fix URLHelper methods is_local and is_external

    Resolves #2766
    
    Changed:
    - Method `is_local()` to find occurrence on URL's hostname instead of the entire URL.
    - Method `is_external()` to use `is_local()`.
    mcaskill committed Jun 8, 2023
    Configuration menu
    Copy the full SHA
    df93be2 View commit details
    Browse the repository at this point in the history
  2. Replace URLHelper is_local strstr with strict comparison

    This will resolve issues where the current host is a subdomain or substring of the URL's host.
    mcaskill committed Jun 8, 2023
    Configuration menu
    Copy the full SHA
    6bde71e View commit details
    Browse the repository at this point in the history

Commits on Jul 25, 2023

  1. Configuration menu
    Copy the full SHA
    1b98847 View commit details
    Browse the repository at this point in the history
  2. Shorten returns

    gchtr committed Jul 25, 2023
    Configuration menu
    Copy the full SHA
    f73f5a2 View commit details
    Browse the repository at this point in the history
  3. Fix test assertion

    gchtr committed Jul 25, 2023
    Configuration menu
    Copy the full SHA
    9324d64 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    8fee077 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    ecc59ac View commit details
    Browse the repository at this point in the history
  6. Replace strstr in URLHelper is_external method

    Replaced with `str_starts_with()` to check for the double slash and `parse_url()` to check for the scheme.
    
    This will resolve issues where `http` or `//` might be a substring of the URL's path.
    mcaskill committed Jul 25, 2023
    Configuration menu
    Copy the full SHA
    0cd8e04 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    83f66d3 View commit details
    Browse the repository at this point in the history
  8. Improve URLHelper is_local method

    if `wp_parse_url()` fails to extract or does not find a host name in the given URL parameter, presume that the parameter might be a host name itself, such as `example.org` (see unit test).
    mcaskill committed Jul 25, 2023
    Configuration menu
    Copy the full SHA
    7c5e0d7 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    8c61e97 View commit details
    Browse the repository at this point in the history

Commits on Jul 27, 2023

  1. Configuration menu
    Copy the full SHA
    8d06cf8 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    51214af View commit details
    Browse the repository at this point in the history
  3. Update method descriptions

    gchtr committed Jul 27, 2023
    Configuration menu
    Copy the full SHA
    46b5a28 View commit details
    Browse the repository at this point in the history