定制 mrclay/elgg-url-sniffer 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

mrclay/elgg-url-sniffer

Composer 安装命令:

composer require 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.

README 文档

README

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

$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

统计信息

  • 总下载量: 474
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 0
  • 依赖项目数: 2
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-07-29

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固