2017 © Pedro Peláez
 

library elgg-url-sniffer

Analyze a URL to see if it's within an Elgg site, is an action/page, likely represents a GUID, etc.

image

mrclay/elgg-url-sniffer

Analyze a URL to see if it's within an Elgg site, is an action/page, likely represents a GUID, etc.

  • Monday, August 29, 2016
  • by mrclay
  • Repository
  • 1 Watchers
  • 2 Stars
  • 218 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 0 Forks
  • 2 Open issues
  • 6 Versions
  • 1 % Grown

The README.md

elgg-url-sniffer

Analyze a URL to see if it's within an Elgg site, is an action/page, likely represents a GUID, etc., (*1)

$site_url = new \UFCOE\Elgg\SiteUrl('http://example.org/my-elgg-site/');

$path = $site_url->getSitePath($given_url);
if (!$path) {
    // URL is not within Elgg site
    // e.g. 'https://example.org/my-elgg-site/' (scheme mismatch)
    // e.g. 'http://example.com/my-elgg-site/' (host mismatch)
    // e.g. 'http://example.org/other-path' (not in site path)
    return;
}

// let's say URL was http://example.org/my-elgg-site/blog/view/1234/my-friendly-title

// URL segments within the site. ["blog", "view", "1234", "my-friendly-title"]
$path->getUrlSegments();

// path within the site. Here "blog/view/1234/my-friendly-title"
$path->getPath();

// URL corresponds to a GUID. Here 1234
$path->getGuid();

// URL corresponds to a container GUID. Here 0 (unknown)
$path->getContainerGuid();

// an action name. e.g. "profile/edit", Here null
$path->getAction();

// a username if a profile page or null
$path->getUsername();

// test whether the path is within a given one
$path->isWithinPath("blog"); // is any blog view page, so true
$path->isWithinPath("blo");  // first URL segment must be "blo", so false
$path->isWithinPath("blog/view");  // is any blog view page, so true

The Versions

29/08 2016

dev-master

9999999-dev

Analyze a URL to see if it's within an Elgg site, is an action/page, likely represents a GUID, etc.

  Sources   Download

MIT

The Requires

  • php >=5.3

 

The Development Requires

url routing elgg analyze sniff

29/08 2016

3.1.0

3.1.0.0

Analyze a URL to see if it's within an Elgg site, is an action/page, likely represents a GUID, etc.

  Sources   Download

MIT

The Requires

  • php >=5.3

 

The Development Requires

url routing elgg analyze sniff

29/08 2016

3.0.0

3.0.0.0

Analyze a URL to see if it's within an Elgg site, is an action/page, likely represents a GUID, etc.

  Sources   Download

MIT

The Requires

  • php >=5.3

 

The Development Requires

url routing elgg analyze sniff

29/07 2016

2.0.1

2.0.1.0

Analyze a URL to see if it's within an Elgg site, is an action/page, likely represents a GUID, etc.

  Sources   Download

MIT

The Requires

  • php >=5.3

 

The Development Requires

url routing elgg analyze sniff

29/07 2016

2.0.0

2.0.0.0

Analyze a URL to see if it's within an Elgg site, is an action/page, likely represents a GUID, etc.

  Sources   Download

MIT

The Requires

  • php >=5.3

 

The Development Requires

url routing elgg analyze sniff

24/10 2015

1.0.0

1.0.0.0

Analyze a URL to see if it's within an Elgg site, is an action/page, likely represents a GUID, etc.

  Sources   Download

MIT

The Requires

  • php >=5.3

 

url routing elgg analyze sniff