An almost complete rewrite of the older Extract URL Plus plugin.
This plugin is designed to take a URL (alone, or mixed in with other text, such as the automatic link the upload form might create) and dissect it into it’s seperate components.
For an example URL (this contains all components!):
http://user:pass@www.example.com:8080/articles/index.php?id=10&q=Hello+World#example_anchor
These components are named, as variables:
full_url ( [the given url] )
scheme (http)
user (user)
pass (pass)
host (www.example.com)
port (8080)
public_path (/articles)
file_path (/articles/index.php)
server_path (/var/www/html/articles/index.php)
file_name (index.php)
extension (php)
description (PHP File)
file_size (1.14KB)
query_string (id=10&q=Hello+World)
fragment (example_anchor)
The usage is pretty much identical as to the older version, so either:
Example A:
(remove space between % and variable name!)
{exp:zm_extract_url_plus show="% file_name (% file_size)"}
... Some text ...
{url_custom_field}
... Some more text ...
{/exp:zm_extract_url_plus)
Example B:
{exp:zm_extract_url_plus url="{url_custom_field}"}
{file_name} ({file_size})
{/exp:zm_extract_url_plus}
Both examples returning:
index.php (1.14KB)
There is an additional parameter in this version:
url_only=”” - Defaults to “no”, meaning the plugin will revert to using a regular expression to find the URL in text. This of course is more CPU intensive than if you are supplying JUST a URL, where you could set this paramater to “yes”.
Enjoy!
