This project is not covered by Drupal’s security advisory policy.
The Link API is a set of modules for managing URLs.
The basic API module provides no useful end-user functionality on its own, but does provide a flexible API for storing and retrieving URL information in the database. It can be leveraged by other modules which need to keep track of link information.
The 7.x branch has none of the modules of 6.x currently, however they may be ported in the future. Currently, it consists entirely of classes for normalising, validating and manipulating URLs. You should only install if you require it for another module, or want to use its features in your own code.
NOTE The internal API changed in a recent 7.x-2.x development snapshot. If you are using it in your own project you may need to update some of your code.
To normalise and sanitize a URL...
$link = link_api_url('http://example.com/some/path') $url = $link->getUrl();
To load a URL helper:
// Normalise. $normalised_url = link_api_helper()->normaliseURL($url); // Convert a relative link to an absolute link. $base_url = 'http://someurl.com/with/other/parts'; $url_parts = link_api_url('with/parts') ->getParts(PHP_URL_PATH); $url = link_api_helper()->relativeToAbsolute($base_url, $url_parts); // Normalise a query string. $link = link_api_helper()->sortQueryString($url); // Calculate a URL hash. $hash = link_api_helper()->hash($url);
The included module set provides a basic set of features. Included modules are available for:
- Enabling/disabling the user interface (Link API UI)
- Scanning the body field of enabled node types for links to add to the database (Link API Scan)
- Editing individual link records (Link API Edit)
- Globally replacing URL parts across all links (Link API Global Replace)
- Using a content type to track individual links (Link API Node)
- Link API is based on PHPs native URL handling, with a number of additions to validate and create URLs and URL parts.
- Full CRUD functionality (6.x only)
- Given a node ID and a set of links, maintain the database listing of links (6.x only)
- Link validity and sanitizing
- Useful hooks for link creation, view and deletion (6.x only)
- Hash functions for lookups
- Tools to access parts of URLs easily
There are some other link management modules with slightly different approaches:
- Web Links
- Link checker - extracts links from your content when saved and periodically tries to detect broken hypertext links.
- Links package - manage URL links in a master directory, and attach them in various ways to your content pages. It includes both an API for developers and user-visible content modules.
- Maintenance status: Actively maintained
- Development status: Under active development
- Module categories: Developer
- Reported installs: 2 sites currently report using this module. View usage statistics.
- Downloads: 1,320
- Last modified: 28 November 2014
- This project is not covered by the security advisory policy.
Use at your own risk! It may have publicly disclosed vulnerabilities.