nexuslinkservices/external-link-purifier

v1.2.2 2016-08-31 11:48 UTC

This package is not auto-updated.

Last update: 2024-09-14 18:53:16 UTC


README

根据需要定义真/假值以净化外部链接或所有链接

Latest Version Software License Scrutinizer Code Quality Build Status

安装

如果您使用composer,可以通过运行以下命令添加此包:

composer require galiteintechnologies/external-link-purifier

用法

例如:我想从我的内容中移除外部链接,因此我需要在我的配置yaml文件中定义以下变量。

external_link:
    purify: true    
Note(s): 
1. If configuration yaml is not there in your project then the default configuration will be taken into consideration.
2. The bundle uses symfony yaml component to parse the yaml configuration.

以下是使其工作的参考代码:

/**
 * CODE

 * create a new object of LinkPurifier class
 * call purify method with 3 arguments
 * $content to purify links
 * $domain keep links of this domain and remove other external links (optional), If not specified remove all links
 * $purify true/false (optional)
 */

$linkPurifier = new LinkPurifier($pathToYaml);  //$pathToYaml is optional as mentioned earlier
$filteredContent = $linkPurifier->Purify($contentToBePurifyForLinks, $domainToKeep, $purify);

使用这个包就完成了。

贡献

欢迎提交pull requests。